2

I am running ubuntu 20.4, with texlive-binaries (and texlive itelf) installed. I have several documents I managed to compile with XeTeX, but are supposed to be compiled with LuaTeX. I indeed have a luatex binary (v1.12), but it throws "Unrecognized control sequence" on the first line (basically \newcommand{\example}{1}).

I have constructed an MWE as follows:

\documentclass{article}
\begin{document}
example
\end{document}

which fails with output

This is LuaTeX, Version 1.12.0 (TeX Live 2020) 
 restricted system commands enabled.
(./test.tex
! Undefined control sequence.
l.1 \documentclass
                {article}
2
  • 2
    you need to use lualatex with a latex document. Sep 25, 2021 at 18:50
  • At least I can confirm that your code works on Overleaf (LuaLaTeX, TeXLive 2020). Sep 25, 2021 at 18:50

1 Answer 1

2

TLDR: LuaTeX is to LuaLaTeX what PlainTeX is to LaTeX (or, these days, pdfLaTeX). To compile your test document, you need LuaLateX, not LuaTeX.

The first line of the log file that's produced when I compile your test document on my TeX system (MacTeX2021, w/ all updates applied) looks like this:

... pdfTeX (aka PlainTeX): This is pdfTeX, Version 3.141592653-2.6-1.40.23 (TeX Live 2022/dev) (preloaded format=pdftex 2021.7.29)

... pdfLaTeX (aka LaTeX): This is pdfTeX, Version 3.141592653-2.6-1.40.23 (TeX Live 2022/dev) (preloaded format=pdflatex 2021.9.22)

... LuaTeX: This is LuaTeX, Version 1.13.2 (TeX Live 2021) (format=luatex)

... LuaLaTeX: This is LuaHBTeX, Version 1.13.2 (TeX Live 2021) (format=lualatex)

... XeTeX: This is XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2021) (preloaded format=xetex 2021.9.22)

... XeLaTeX: This is XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2021) (preloaded format=xelatex 2021.9.22)

If the 'preloaded format' isn't either pdflatex, lualatex, or xelatex, your test program won't compile. In fact, the test program will crash on the very first instruction, viz., \documentclass. That's precisely what you report in your query. (Actually, you claim that compilation crashes on \newcommand{\example}{1}. A closer check, though, will reveal that LuateX crashes on \documentclass.)

Moral of the story? Be care to select an appropriate combination of TeX engine and format before trying to compile the document.

1
  • 1
    Thanks! Indeed I was compiling it with XeLaTeX, not XeTeX, quite easy to be confused tbh. The \newcommand was refering to the original document where I faced the issue, the log was for the MWE
    – Atai Ambus
    Sep 26, 2021 at 6:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .