[pdftex] Typesetting a paper collection
Laurent Siebenmann
Laurent.Siebenmann at math.u-psud.fr
Tue Oct 15 17:15:31 CEST 2002
Hi all,
John Culleton <john at wexfordpress.com>
wrote on Mon, 14 Oct 2002 17:00:24 -0400
> The great virtue in plain tex or plain pdftex is that
> you are in control and you don't have to search out
> some special style to trick out the system.
Since there are (I'm betting) more macro packages than
(pdf)tex primitives I do believe that there will always be
a small but resiliant group of (pdf)tex users who above
all seek understanding of primitives and their function in
the architecture of (pdf)tex. I'm one of them and I
imagine most others are tex professionals (like John) who
need boundless capabilities in predictable time, or else
mathematically oriented scientists (like me) for whom
understanding is the staff of life.
Hence this plea:- A great many responses by the leading
experts on this list give only bluser-oriented syntax
recipes and/or macro package names to solve any given
practical problem -- while leaving aside
mention/explanation of the crucial pdftex primitives on
which they are based. Why not give *both* at moderate
extra cost?
I'll illustrate with the recent problem of breaking a pdf
file into single-page pdf files that arose in the related
thread "Re: [pdftex] producing a5 booklets from a4". This
can be done for page 7 (say) by simply redefining the
primeval tex primitive \shipout to choke, except on the 7th
occasion it is called. Similarly for any selection of
pages in place of 7, say all odd pages, or a chapter from
a book.
The primitive \shipout is classical TeX's one-and-only
channel for binary output and it's easy to install a good
deal of postprocessing there quite free of entanglement
with the output routine.
Now, what are the advantages, primitives, and secrets of
the more complex(?) and more pdf approach espoused by
Andreas Matthias and Heiko Oberdiek?
Cheers
Laurent S.
%%%%%%%%%%%%%%%%%%%%%
A few details of the primeval approach: After checking
that \shipout is still primitive, preface your
document body with the snippet:
\let\shipoutORI=\shipout
\newcount\shipcount
\shipcount=0
\newbox\trashcan
\def\shipoutNIL{\deadcycles=0\global\setbox\trashcan=}%
%% Here \deadcycles=0 emulates a
%% normal action of \shipout. Necessary.
\def\shipout{\global\advance\shipcount1\relax
\ifnum\shipcount=7\relax
\let\action=\shipoutORI
\else
\let\action=\shipoutNIL
\fi
\action
}
Then processing it with pdftex will give a one-page dvi or
pdf file for page 7. I'll leave the full automation of
this for all pages as an exercise -- needing something like
a \write18 extension or unix shell.
One drawback of this solution is that, to get all the
one-page pdf's, it takes as many tex runs as there are
document pages. With just Knuth's tex primitives there is
no better solution, I suspect, since a single tex run can
produce only one binary output file.
PS. Incidentally, suppose we are extracting a few complex
tables with their captions and footnotes from a big pdf
document; the extracted tables should ideally
hyper-reference the main document text. Seems hackable to
me! Any ready-made solutions?
More information about the pdftex
mailing list