How I can redefine the command \pdfoutput=1 to be ignored?

I need to compile a file with lualatex (see https://tex.stackexchange.com/a/586129/33634) but it contains the command \pdfoutput=1. I cannot make changes to the file so I thought I can redefine it at some point. Maybe with \AtBeginDocument or with etoolbox's \AtEndPreamble passing it to the engine.

How can I achieve it?

  • 1
    \newcount\pdfoutput somewhere before the command should work. – Ulrike Fischer Mar 6 at 22:12

It is a counter variable (primitive, but still), so


should do. That's not a great idea though, because some code may use that to check if pdfTeX is being used and the test will give a false positive.

  • 1
    tests relying on it are bound to break anyway, e.g. if luatex85 is loaded, so imho one doesn't need to worry about it. – Ulrike Fischer Mar 6 at 22:14
  • @UlrikeFischer Curiously there are lots of \ifx\pdfoutput\@undefined and such in my installation (surely, most are likely fine, but there are a few that can be problematic). Probably the value of \pdfoutput (in an engine that doesn't have it) is more important than it existing or not... Anyway, just rambling :) – Phelype Oleinik Mar 6 at 22:20
  • It works. Thanks. Works also with \pdfminorversion. – Gabriele Nicolardi Mar 6 at 22:25
  • @GabrieleNicolardi Yes, all are count registers (you can do \<register>=<number>) so will work in the same way. If you have some dimension register, for example \pdfpagewidth, you can use \newdimen instead – Phelype Oleinik Mar 6 at 22:30

If you compile from the command line,

lualatex "\let\pdfoutput\outputmode\input filename"

will do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.