[pdftex] creating multiple versions of same document

Dok, D. van d.vandok at ecn.nl
Thu Mar 29 10:37:21 CEST 2001


> From: "David Carlisle" <davidc at nag.co.uk>
> > 
> > > You could also use some macro program, either m4 or sed,
> > 
> > there is another macro program that comes to mind for
> > users of this list...
> > 
> > \documentclass[\options]{article}
> > 
> > pdflatex \def\options{twoside,a4paper}\input test.tex
> > 
> 
> Yay! Great!
> 
> I really ought to use TeX more like a macro/programming language...

Although TeX is very powerful it is still hard to create two PDF files from
a single source in one run. But how about a docstrip-like scheme?

in pseudocode, the file thesis.tex would look like:
-----------------------------------------------------------------
\iffirstpass
\openoutputfile{0}{thesis-s.tex}  % <-- don't know the right syntax
\openoutputfile{1}{thesis-p.tex}
\writetofile{0}{
  < all the options for the screen version>
  \firstpassfalse
  \input thesis.tex
}
\writetofile{1}{
  < all the options for the printer version>
  \firstpassfalse
  \input thesis.tex
}
\endinput
\fi

<the actual document goes here>
-----------------------------------------------------------------

This allows you to keep your work in one place. A simple makefile can take
care of production runs.


Dennis van Dok



More information about the pdftex mailing list