[texhax] dvi page bursting: suggestions wanted

Michael Doob mdoob at ccu.umanitoba.ca
Fri Sep 25 21:06:02 CEST 2009

I have the following situation: my LaTeX file is  of the form


Each call to \nextpage will print one page.
There is also a macro \printpage{#1} which takes the parameters
from \nextpage and "puts the ink on the page."
I want to "burst" the dvi file, that is, get a dvi file for each 
page by running LaTeX repeatedly on the source (there are reasons 
not to use dvidvi or other such programs). My approach is:

Use a counter \newcounter{pagewanted} and run something essentially

\ifnum \value{page}=\value{pagewanted}

This ensures that only one page actually output to the dvi file. 
In addition, the \printpage macro is of the form
\def\printpage{... \label{lastpageprinted}\newpage} 
so that the aux file will have a record of the actual page printed. 

On the next run I can refer to \pageref{lastpageprinted}, as in
\setcounter{pagewanted}{\pageref{lastpageprinted}}, and then
increment the counter and carry on as before.

This works OK, although there are some initial value problems on the 
first run.

I have the feeling that there should be a more clever way that still 
avoids playing with the output routine. Anyone got any bright ideas?


Michael Doob                    Telephone: (204) 474-9796
Department of Mathematics       Fax: (204) 474-7606
University of Manitoba          email: Michael_Doob at umanitoba.ca
Winnipeg, MB, Canada R3T 2N2

More information about the texhax mailing list