# [Mac OS X TeX] Plain TeX and PDF figures

Bruno Voisin Bruno.Voisin at hmg.inpg.fr
Mon Feb 4 17:53:57 CET 2002


> is there a macro package for including PDF files into Plain TeX? I need
> nothing fancy, something very basic should do fine for me. Of course, I
> know about LaTeX packages, but this is not what I want...

I'm not aware of a macro package, but the following code should work
(for including a file name.pdf, the same works with JPEG):

\pdfximage{name.pdf}\pdfrefximage\pdflastximage

It might be safer to put everything in a \hbox (don't ask me anything
about the syntax above, it appears unnecessarily complicated to me, but
it works).

Things get sexier when you want to set the size of the image, or when
you want to include the image at its natural size while your plain TeX
document uses \magnification=\magstep1 or similar. That's what I had to
do to make it work, for example:

\newbox\logobox \newdimen\logowidth
\setbox\logobox=\hbox{\pdfximage{logolegi.jpg}%
\pdfrefximage\pdflastximage}
\logowidth=\wd\logobox
\divide\logowidth by\mag
\multiply\logowidth by1000
\setbox\logobox=\hbox{\pdfximage width\logowidth{logolegi.jpg}%
\pdfrefximage\pdflastximage}
\copy\logobox

/usr/local/teTeX/share/texmf/doc/pdftex/base. See pdftexman.pdf and the
extensively documented samplepdf.tex.

ConTeXt might make it simple, but I know nothing about it, and hey! it's
not plain TeX.

Hope this helps,

Bruno Voisin

-----------------------------------------------------------------
To UNSUBSCRIBE, send email to <info at email.esm.psu.edu> with
"unsubscribe macosx-tex" (no quotes) in the body.
For additional HELP, send email to <info at email.esm.psu.edu> with
"help" (no quotes) in the body.
This list is not moderated, and I am not responsible for
messages posted by third parties.
-----------------------------------------------------------------