[tex-live] hyperref.cfg/\@ifundefined

Heiko Oberdiek oberdiek@ruf.uni-freiburg.de
Wed, 5 Jun 2002 15:20:11 +0200 (MET DST)


Hello,

hyperref.cfg of TeX Live contains:

\ProvidesFile{hyperref.cfg}%
  [2001/06/04 v1.0 hyperref configuration of TeXLive]
\@ifundefined{pdfoutput}{\ExecuteOptions{dvips}}{\ExecuteOptions{pdftex}}
\endinput

A good idea to switch the default from "hypertex" to
"dvips" if pdfTeX is not running.

This check for pdfTeX, however, is problematic:
* After \@ifundefined{pdfoutput} \pdfoutput will
  have the meaning \relax if it is previously \undefined.
* There are people that want to use pdfTeX in DVI mode
  (for example they want to have the non-PDF features of
  pdfTeX, but cannot use pdfTeX in PDF mode because of
  psfrag, pstricks, ...)

Therefore I suggest:

\ProvidesFile{hyperref.cfg}%
  [2001/06/05 v1.1 hyperref configuration of TeXLive]
% Change default driver option to "dvips" unless
% pdfTeX is running in PDF mode.
\begingroup
  \def\x{\endgroup\ExecuteOptions{dvips}}%
  \ifx\pdfoutput\undefined
    % pdfTeX is not running
  \else
    \ifx\pdfoutput\relax
      % result of \@ifundefined{pdfoutput}
    \else
      \ifcase\pdfoutput
        % \pdfoutput=0 ==> DVI mode
      \else
        % \pdfoutput=1 ==> PDF mode
        \def\x{\endgroup\ExecuteOptions{pdftex}}%
      \fi
    \fi
  \fi
\x
\endinput

Yours sincerely
  Heiko <oberdiek@uni-freiburg.de>