[texhax] dvi page bursting: suggestions wanted

hh-brasil hh-brasil at bol.com.br
Sat Sep 26 13:05:38 CEST 2009

I would think that TeX is an excellent writing programs but may be 
not too good for special demands a printing business has.

Or - if the single pages are needed for some kind of  projection - 
then the beamer.sty should be used.

But anyway: if you produce a ps-file from the dvi-file with any number of pages, you 
can easily open it with Adobe Acrobat and save it just as single eps- 
or pdf-pages. The other - more time consuming way - would be to extract the dvi-pages one by one with
the dvips-command. This - most probably - could be automated with a batch file.

From:           	texhax-request at tug.org
Subject:        	texhax Digest, Vol 2009, Issue 370
To:             	texhax at tug.org
Send reply to:  	texhax at tug.org
Date sent:      	Sat, 26 Sep 2009 12:00:02 +0200

> I have the following situation: my LaTeX file is  of the form
> \nextpage{.....}
> \nextpage{.....}
>     ...
> \nextpage{.....}
> 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
> like
> \def\nextpage#1{
> \ifnum \value{page}=\value{pagewanted}
>    \printpage{#1}
> \fi
> \stepcounter{page}
> }
> 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?
> Cheers,
> Michael

More information about the texhax mailing list