# [NTG-pdftex] images in formats

Martin Schröder martin at oneiros.de
Wed Jun 27 14:48:11 CEST 2007

2007/6/27, David Kastrup <dak at gnu.org>:
> "Martin Schröder" <martin at oneiros.de> writes:
> > 2007/6/27, David Kastrup <dak at gnu.org>:
> >> For example, preview-latex uses mylatex.ltx to dump the state of the
> >> TeX at \begin{document} time.  Not allowing any image references (like
> >> in \savebox commands) before that point of time is a rather brutal
> >> restriction.
> >
> > Why do you need it
>
> What?  preview-latex?  mylatex.ltx?

\savebox

> > and what do you gain by using \savebox?
>
> Uh, it is _there_.  For a reason.  Saying that it (and similar
> functionality) should not get used anymore is creating a rather sordid
> restriction and backward incompatibility.
>
> > The speed increase is most likely minimal
>
> The speed increase of what is most likely minimal?  Of dumping a
> format with the preamble?  Absolutely not.  It is very relevant in
> preview-latex, for common editing work on single formulas easily a
> factor of 5.  And we are talking about an interactive editing task and
> its response time here.

The speed increase of using \savebox.

> > and the document needs to read the image anyway -- unless you want
> > to dump fragments of pdf code into the format.
>
> In DVI mode, a pointer to the image gets dumped in the form of a
> special.  A similarly sufficient amount of information would have to
> get there in PDF mode.
>
> > If we expanded the dvi model we would dump the meta information
> > about pdf things and then undump them later. This needs code for
> > dumping and undumping this meta information. And
> > \immediate\pdfximage would still fail.

[...]

> > Don't forget: pdfTeX is one-pass, while TeX->dvips is two-pass.
>
> Where is the relevance?

It was not designed with making two-pass-like solutions (which we are
discussing here) working, instead the two passes are intermingled. The
"sufficient amount of information" aka "meta information" is most
likely not in the code in one piece and there is currently no way to
dump and undump that. And a proper solution would not only handle
\pdfximage, but also \pdfobj, \pdfxform, ...

Best
Martin