0

I want to switch from PDFLaTeX to LuaLaTeX to use OpenType Fonts. When I switched my compiler I got lots of errors, the first one beeing:

Undefined control sequence.
<argument> \pdfpagewidth

l.5 \begin{document}

This is what Overleaf has to say to this issue:

The compiler is having trouble understanding a command you have used.
Check that the command is spelled correctly.
If the command is part of a package,
make sure you have included the package in your preamble using \usepackage{...}.

And here is a corresponding minimal working example:

\documentclass{article}

\usepackage[pdftex]{graphicx}

\begin{document} Test \end{document}

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
thunermay
  • 163
  • 6
  • 3
    LuaTeX renames a number of primitives, including \pdfpagewidth. However, before we try to 'fix' that, can you give a full MWE? For end user documents, the primitives shouldn't normally show up at all, and package code 'knows' about these differences in the main. – Joseph Wright Feb 28 '24 at 07:15
  • 1
    that is a pdftex primitive that shouldn't normally be set directly, but see the luatex manual for equivalents, or use luatex85 package to define many such pdftex commands – David Carlisle Feb 28 '24 at 07:16
  • 3
  • Also related (but only the main reason and the answers, standalone like most packages does not have this problem any longer): https://tex.stackexchange.com/q/315025/277964 – cabohah Feb 28 '24 at 07:29
  • 1
    Voters: proposed dupe isn't about \usepackage[pdftex]{graphicx}. – Joseph Wright Feb 28 '24 at 08:00
  • 1
    Well it may describes the command, but this is not a solution suitable for me. The error was with the import of graphicx, from which I don't see anything in the proposed question – thunermay Feb 28 '24 at 08:07
  • @JosephWright Sorry, but without MWE and any information in the question, that this happens when loading graphicx, I really wasn't able to guess, that loading graphicx with a (generally superfluous and now) unsuitable option was the mistake. – cabohah Feb 28 '24 at 09:02
  • 1
    @cabohah Sure, but the self-answer clears that up .. anyway, I'm sure there must be an appropriate dupe – Joseph Wright Feb 28 '24 at 09:03
  • @JosephWright My guess was before the self-answer. – cabohah Feb 28 '24 at 09:04
  • 1
    I've now added all information that is IMHO needed. So the answer is also suitable and if there really isn't already a dupe (which I almost cannot believe, but I didn't find any) this question and answer can be useful for others. – cabohah Feb 28 '24 at 09:12

1 Answers1

2

The problem was when importing graphicx. In pdftex the template I used used \usepackage[pdftex]{graphicx} to import graphicx. After removing pdftex like this \usepackage{graphicx}, the error disappeared.

thunermay
  • 163
  • 6
  • 4
    Glad you found the culprit. It would have been helpful to include the piece of information about loading the graphicx package with the option pdftex in your posting. – Mico Feb 28 '24 at 07:48
  • @Mico I didn't know it was there. I am using a template and have like 40 imports from which I understand maybe 5 (exaggerated). If I would known this, I would have tried it before. Also Latex didn't care to have any information on where the error was, beside \begin{document} so no luck there either. – thunermay Feb 28 '24 at 07:53