Wednesday, May 30, 2007

LaTeX and PDFLaTeX

Last time I wrote the following to detect whether latex or pdflatex is used to compile a source, but I noticed today this will confuse the latex commend in Cygwin. The latex commend in Cygwin is a symbolic link to pdflatex and this makes pdflatex to produce a pdf file instead of a xdvi file even though you call latex.


\ifx\pdftexversion\undefined
\usepackage[dvips]{hyperref}
\else
\usepackage[pdftex]{hyperref}
\fi

After searching webs, the following works fine.

\usepackage{ifpdf}
\ifpdf
\usepackage[pdftex]{hyperref}
\else
\usepackage[dvips]{hyperref}
\fi

1 comment: