[texhax] Why pdftex in dvi mode and in pdf mode works differently?

Igor Liferenko igor.liferenko at gmail.com
Wed Feb 15 04:51:34 CET 2017


Hi all,

Consider the following test.tex

%\let\myif=\iftrue
\ifnum\pdfoutput=1
  \def\a#1#2{\myif#1\else#2\fi}
\fi
\end

If we run it in pdftex in pdf mode, it does not give error,
and if we run it in pdftex in dvi mode, it gives the following error:

This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdftex)
 restricted \write18 enabled.
(./test.tex
! You can't use `macro parameter character #' in vertical mode.
l.3   \def\a#1#2{\myif#1\else#
                              2\fi}
?

If we uncomment the first line, there is no error in both cases.

It is unclear to me why the error is not generated in pdf mode.

Regards,
Igor

P.S.

To run the example in pdf and in dvi mode, I used the following
commands to generate the format:

pdftex -ini -jobname pdftex '\input plain \pdfoutput=0 \dump' >/dev/null
pdftex -ini -jobname pdftex '\input plain \pdfoutput=1 \dump' >/dev/null


More information about the texhax mailing list