[pdftex] Multiple references to image fails.

Heiko Oberdiek oberdiek at uni-freiburg.de
Tue Jun 10 19:33:00 CEST 2008


On Tue, Jun 10, 2008 at 08:51:58AM -0400, John Culleton wrote:

> On Monday 09 June 2008 11:48:17 pm Heiko Oberdiek wrote:
> > On Mon, Jun 09, 2008 at 11:55:30PM +0200, Hartmut Henkel wrote:
> > > On Mon, 9 Jun 2008, John Culleton wrote:
> > > > \edef\firstimage{\the\pdflastximage}
> > >
> > > maybe it's in a group and therefore you need \global\edef or
> > > \xdef.
> >
> > Also he is reinventing the wheel. graphicx/pdftex.def exists,
> > it also reuses the image number and also works for plain-TeX
> > (with the help of miniltx.tex).
> >
> > Yours sincerely
> >   Heiko <oberdiek at uni-freiburg.de>
> 
> I am more copying the wheel than reinventing it.  The \edef statement 
> is lifted from the source for samplepdf.tex.  If the alternative you 
> suggest has additonal virtues, i.e., is more robust, less verbose or 
> in particular is more economical of system resources than the \edef 
> option I would be glad to hear more about it.  Where is it 
> documented?

* grfguide

 
> Back to the current setup. Following the hints of several people I 
> moved three image definitions out of an \hbox and defined them 
> separately thus:
> -----------------------
>  \pdfximage width 2.5in{snapshot9.png} 
> \edef\firstimage{\the\pdflastximage}
> \pdfximage width 2.5in{snapshot6.png}
> \edef\secondimage{\the\pdflastximage}
> \pdfximage width 3.5in{snapshot7.png} 
> \edef\thirdimage{\the\pdflastximage}
> \hbox{
> \pdfrefximage\firstimage 
> \hskip .25in
> \pdfrefximage\secondimage 
> \hskip .25in 
> \pdfrefximage \thirdimage }  
> --------------------------------------
> Moving the definitions out of the box made them global.

No. As plain-TeX user you should know that.

Documentation:
* Donald E. Knuth: The TeXbook
* Victor Eijkhout: TeX by Topic

> Now my real objective was to not only reuse \firstimage but use it at 
> different sizes. AFAIK that cannot be done without reloading the 
> image.

Easy: see \scalebox (Documentation: grfguide)
Implementation: copy code from pdftex.def

Of course, pdftex.def handles different pdfTeX versions, thus
you have to figure out the code for your version.

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>
-- 


More information about the pdftex mailing list