# \documentclass: undefined control sequence

There's probably a ton of questions about this already but I've been spending all day feeling overwhelmed with the TeX learning curve.

I'm trying to learn LuaTeX (by the way, if you know of a good tutorial I'd love to know about it). I have downloaded TeX Live 2011 for Windows yesterday. I have a LaTeX document with working syntax which renders properly. When I switch the typeset setting to "ConTeXt (LuaTeX)", I get "Undefined control sequence" for the first line, "\documentclass{report}". What am I doing wrong?

-
You don't say what your editing environment is, but you are trying to compile a LaTeX document using ConTeXt (which is not LuaLaTeX). So you need to compile your file with LuaLaTeX, and then things should work. – Alan Munn Sep 1 '11 at 3:26
You might use LuaTeX and not LuaLaTeX. Also, IMHO, there is not that much difference for a beginner between LuaLaTeX and the normal (pdf)LaTeX. LuaLaTeX is "just" a pdfLaTeX compiler with Lua (a scripting language) support. AFAIK there are some differences in font and language support, but the rest is just LaTeX. – Martin Scharrer Sep 1 '11 at 6:49
@Martin: glifchits asked a question about using system fonts earlier, so this is why he's getting to use LuaTeX. – ℝaphink Sep 1 '11 at 8:09

## 2 Answers

I hope this answer can clarify a few basic concepts for you.

TeX TeX is a (macro) programming language invented by Knuth. It is a Turing complete language. That is, theoretically you can do almost anything you can do with other languages, though not necessarily easily.

TeX Engine A program that can interpret the TeX language. It is like the perl program for the Perl language. The first TeX engine was written by Knuth. Nowadays, popular engines include pdftex, xetex, luatex. pdftex is much faster than the other two though the other two provide extra functionality, especially for using opentype fonts. luatex provides much more than fonts.

LaTeX and ConTeXt These are formats. A format is just a set of TeX macros (well, not exactly so simple). They define a lot of macros for you to use. For example, LaTeX defines the \documentclass and \begin{document} macros while ConTeXt defines \starttext. It will take a much longer paragraph to answer what there really is in a format. For now, you may just think the program lualatex is a shortcut for starting the luatex engine, inputting the LaTeX macro packages (i.e., the format), and then processing your input. (I know this is not the exact explanation, but I believe it helps a beginner to understand).

LuaLaTeX, XeLaTeX, pdfLaTeX, ... these are all just shortcuts for using the LaTeX format with a TeX engine.

In the question, you seems to think ConTeXt and LuaTeX are the same. This is not true. ConTeXt Mark IV requires LuaTeX as an engine to process this format. Just like many LaTeX packages and the forthcoming LaTeX3 format requires an engine with e-TeX features.

Please correct me if there's anything wrong with this answer.

-
 Thank you for your helpful comments. This does help me understand things a lot better. – glifchits Sep 1 '11 at 23:31

Most likely, you typed luatex to compile a LaTeX document. The proper command to use to compile LateX code with LuaTeX is lualatex.

-
 The real confusion I've been having stems from that you suggested I use LuaTeX since I installed TeX Live. However, (as you confirmed on my other question) TeXworks doesn't have LuaTeX. And to be specific, I don't manually type any commands when I compile my document. So I guess I should ask you, how do I typeset a document in LuaTeX using TeXworks? Does it mean I have to download, install, and configure (or any combination of those actions) LuaTeX within TeXworks on my own? Also, while I've got a giant question going, is LuaTeX and LuaLaTeX different? – glifchits Sep 1 '11 at 23:42 Right. I think @YanZhou's answer clears up most of these points. If it still doesn't answer everything, you should open a new question. – ℝaphink Sep 1 '11 at 23:44