# [texhax] texhax Digest, Vol 2009, Issue 370

hh hh-brasil at bol.com.br
Sat Sep 26 12:57:54 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 with any number of pages, you
can easily open it with Adobe Acrobat and save it just as single eps-
or pdf-pages.
hh

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