Re: [2.96.1] problem: latex generates pdf rather than dvi

Reinhard Kotucha <[email protected]>
Newsgroups gmane.comp.tex.tetex.beta
Message-ID <[email protected]>
>>>>> "Thomas" == Thomas Esser <[email protected]> writes:

    > Nobody suggests that "latex foo" should generate foo.pdf by
    > default.  We are talking about broken documents where someone
    > did not know that pdftex can be used to produce dvi output.

Unfortunately some packages do not check carefully enough, see below.

The reason that users specify a driver file explicitly is that there
are many examples in the literature looking like:
\usepackage[pdftex]{...}
even if this is not necessary.  I don't remember any case where I had
to do this.

    > Here, adding a simple \usepackage{dvi} is a possible work-around
    > that David Kastrup has suggested.

Yes, but I suppose that most problems come from macro packages.  They
have to be fixed anyway.  As far as the documents are cocerned, it is
not much more work to fix the bugs than to add \usepackage{dvi}.

People then must say
\usepackage{ifpdf}
\ifpdf\else\usepackage{dvi}\fi

And if the \ifpdf code would be part of the package, its name would be
misleading. 

    > Of course, the real fix is to change broken code to
    > \usepackage{ifpdf} or something similar. Non-broken documents do
    > not need this and they don't even need \usepackage{dvi}.

What I'm not happy about is that ifpdf.sty uses plain TeX syntax, i.e.

\ifpdf
   <is pdf>
\else
   <is not pdf>
\fi  

instead of

\ifpdf{<is pdf>}{<is not pdf>}

This cannot be changed because ifpdf.sty is used by many people.  But
maybe something similar could be provided.  Note that I'm now talking
about LaTeX, not about a particular TeX implementation.  Some people
might want to create HTML from their LaTeX sources.  Then it would be
good to have a macro which could test this as well.

\ifoutput{pdf}{<is pdf>}{<is not pdf>}

This can be adopted for other other output formats as well.

As mentioned above, there are some macro packages where problems can
be expected.  The following list is most likely incomplete, I just
called  "grep -rHC5 'pdfoutput' *" in texmf-dist, but maybe someone
used \pdftexversion instead of \pdfoutput or anything else.

tex/context/base/core-var.tex:
\ifx\pdfoutput\undefined \else

  \prependtoks \pdfoutput=0 \to \everyjob


tex/context/base/supp-emp.tex:
\ifx\pdfoutput\undefined \chardef\pdfoutput=0 \fi


tex/context/base/supp-mis.tex:
\ifx \undefined \pdfoutput \chardef\pdfoutput=0 \fi


tex/context/base/syst-prm.tex:
\ifx\pdftexversion\undefined \newcount\pdfoutput \fi \pdfoutput=0


tex/context/base/syst-tex.tex:
\ifx\pdftexversion\undefined 
  \chardef\pdfoutput=0
\else
  \pdfoutput=0
\fi 


tex/latex/base/ltnews.cls:
\ifx\pdfoutput\@undefined\else
  \pdfinfo{%
    /Title (LaTeX News)
    /Author (The LaTeX project)
    }


tex/latex/misc/changebar.sty:
  \ifx\pdfoutput\undefined
    \RequirePackage[dvipsnames]{color}%
  \else
    \RequirePackage[pdftex,dvipsnames]{color}%
  \fi


tex/latex/listings/lstdoc.sty:
\newif\ifhyper \@ifundefined{pdfoutput}{}
    {\IfFileExists{hyperref.sty}{\hypertrue}{}}


tex/latex/pdfpages/pdfpages.sty:
\@ifundefined{pdfoutput}{%
  \@ifundefined{OpMode}{%
     \PackageError{pdfpages}
            {You are using neither pdfTeX nor VTeX.\MessageBreak
             Package pdfpages does not work with other\MessageBreak
             TeX implementations}


tex/generic/context/mptopdf.tex:
\ifx\pdfoutput\undefined 
  \message{Sorry, you should use pdf(e)TeX instead.} 
  \expandafter \endinput 
\fi


tex/generic/thumbpdf/thumbpdf.tex:
\ifx\pdfoutput\undefined
  \immediate\write16{%
    !!! Process this file `\jobname.tex' with pdf(e)tex %
    (NOT tex) !!!%
  }%


tex/latex/hyperref/hyperref.sty:
    \providecommand*{\Hy@defaultdriver}{hypertex}%
    \begingroup\expandafter\expandafter\expandafter\endgroup
    \expandafter\ifx\csname pdfoutput\endcsname\relax
      \begingroup\expandafter\expandafter\expandafter\endgroup
      \expandafter\ifx\csname OpMode\endcsname\relax
        \let\Hy@driver\Hy@defaultdriver
      \else

Regards,
  Reinhard

-- 
----------------------------------------------------------------------------
Reinhard Kotucha			              Phone: +49-511-4592165
Marschnerstr. 25
D-30167 Hannover	                      mailto:[email protected]
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.