3

I downloaded iftex from CTAN and installed it. I think I'm using it according to the documentation:

\documentclass{article}
\usepackage{iftex}
\ifPDFTeX
  \errmessage{Don't use pdflatex.  Use plain latex and dvipdf}
\else
  \errmessage{Good. You aren't using pdflatex}
\fi
\end

However, this construct does not recognize pdflatex . I get the message "Good. You aren't using pdflatex" whether I use latex or pdflatex.

$ latex iftex.tex
This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
entering extended mode
(./iftex.tex
LaTeX2e <2003/12/01>
Babel <v3.8d> and hyphenation patterns for american, french, german, ngerman, b
ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch, esperanto, e
stonian, finnish, greek, icelandic, irish, italian, latin, magyar, norsk, polis
h, portuges, romanian, russian, serbian, slovak, slovene, spanish, swedish, tur
kish, ukrainian, nohyphenation, loaded.
(/usr/share/texmf/tex/latex/base/article.cls
Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/size10.clo))
(/usr/share/texmf/tex/latex/iftex/iftex.sty)
! Good. You aren't using pdflatex.
l.6   \errmessage{Good. You aren't using pdflatex}

? x
No pages of output.
Transcript written on iftex.log.
$
$ pdflatex iftex.tex
This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
entering extended mode
(./iftex.tex
LaTeX2e <2003/12/01>
Babel <v3.8d> and hyphenation patterns for american, french, german, ngerman,
[...]
nohyphenation, loaded.
(/usr/share/texmf/tex/latex/base/article.cls
Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/size10.clo))
(/usr/share/texmf/tex/latex/iftex/iftex.sty)
! Good. You aren't using pdflatex.
l.6   \errmessage{Good. You aren't using pdflatex}

? x
No pages of output.
Transcript written on iftex.log.
$

Am I doing something wrong?

  • What system are you running this on? The sources seem outdated, including the compiler. I can't replicate your result on TeX Live 2018 with all content up-to-date. – Werner Oct 23 '18 at 19:26
7

The \ifPDFTEX test is checking the engine in use (TeX90 vs pdfTeX vs XeTeX vs LuaTeX), not the output format. For that, you want the ifpdf package

\documentclass{article}
\usepackage{ifpdf}
\ifpdf
  \errmessage{Don't use pdflatex.  Use plain latex and dvipdf}
\else
  \errmessage{Good. You aren't using pdflatex}
\fi
\end
3

In recent TeX Distributions latex is actually a symbolic link (or the equivalent in systems that don't support symbolic links) to pdftex (actually pdfetex) which runs the latex format in dvi mode.

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.