[pdftex] dvi output from pdflatex?

Reinhard Kotucha reinhard.kotucha at web.de
Sat Aug 16 22:16:32 CEST 2008


Paul Vojta writes:
 > On Wed, Aug 13, 2008 at 01:19:53AM +0200, Reinhard Kotucha wrote:
 > > John Culleton writes:
 > >  > In pdftex and Context there are one line commands (not macros)  that 
 > >  > will change the output, assuming they don't get overruled on the 
 > >  > command line:
 > >  > For pdftex:
 > >  > \pdfoutput 1 %pdf
 > >  > \pdfoutput 0 %dvi
 > >  > for Context:
 > >  > \setupoutput[pdf]
 > >  > or
 > >  > \setupoutput[dvi]
 > >  > 
 > >  > These are usually the first statements in the first file of the 
 > >  > compile.
 > > 
 > >  > No doubt pdflatex has something suitably more complex to do the same 
 > >  > thing.  
 > >  
 > > Nonsense.  \pdfoutput is a primitive and can be used in LaTeX the same
 > > way as it can be used in plain Tex or Context.
 > 
 > Yes, but does it screw something up when you do it?  Who knows.

Hi Paul,
no, it doesn't screw anything up.  It's already used everywhere for
years in TeX Live and nobody complained so far.  There are only two
programs: (Knuth's) tex and pdftex.  Only if you invoke "tex", you get
Knuth's tex, all the other programs are actually symlinks to pdftex.

See the file texmf-dist/tex/latex/latexconfig/latex.ini (comments
stripped): 

--------------------
\ifx\pdfoutput\undefined \else
  \ifx\pdfoutput\relax \else
    \input pdftexconfig
    \pdfoutput=0
  \fi
\fi
\scrollmode
\input latex.ltx
\endinput
--------------------

The *.ini files are used to dump the formats.

The variable \pdfoutput is used by plain tex (if invoked as etex),
pdftex, latex, pdflatex, xmltex, and all the others in order to create
the format files.  It doesn't cause any harm.

Because latex.ltx is not aware of this variable, you can safely change
it later in your documents.  You have to change it before the first
page is shipped out, but if you load any macro packages it's advisable
to set \pdfoutput before.  See below.

 > As an example, you could do \font\foo=ptmr7t\foo Test of \emph{italic},
 > but you wouldn't get the results that some users would expect.
 > 
 > >  > No doubt pdflatex has something suitably more complex to do the same 
 > >  > thing.  
 > > 
 > > Yeah, LaTeX indeed provides something which is more powerful than what
 > > you propose.  Look into Heiko's package "ifpdf".  What you propose is
 > > quite crude. Please study Heiko's code before you come up with such
 > > platitudes.  ifpdf should work with plain TeX and Context too.
 > 
 > ifpdf does not set \pdfoutput.

Please excuse my misleading wording.  I mentioned ifpdf and said that
it works everywhere in order to make clear that latex doesn't need any
extra treatment.  A brief look into the file is quite useful: You'll
see immediately that no attempt had been made to detect whether you
are using latex at all.

Another reason I mentioned ifpdf is that if you alter the value of
\pdfoutput you probably want to compile your [la]tex document in
dvi-mode *and* in pdf-mode.  Then you need something like \ifpdf, at
least in plain tex, in order to make sure that the appropriate graphic
files are included (eps vs. pdf), for instance.  latex users need
\ifpdf only in some rare situations because latex selects the
appropriate drivers quite reliably.  Just setting \pdfoutput is not
always sufficient.

Regards,
  Reinhard

-- 
----------------------------------------------------------------------------
Reinhard Kotucha			              Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------


More information about the pdftex mailing list