[texhax] getting embedded vs paged pdf (eps/png)

Hartmut Henkel hartmut_henkel at gmx.de
Wed Mar 12 00:24:40 CET 2008


On Wed, 13 Feb 2008, George Georgalis wrote:

> The subject sums up the task, not sure why I cannot find anything on
> the topic searching for embed* and page*
>
> I'd like to use pdflatex generate stand alone formulas and tables, ie
> without page layout. these will be used in web pages and/or word
> processors; final output needs be in eps or png format. Doesn't really
> matter if pdflatex output is converted to eps/png or if they are
> generated directly, but how can I make stand alone images (eg size of
> the table/formula) vs typeset into the paper size?

A PDF file with tiny formula pages can also be generated directly by
pdflatex, as this rough example shows (ugly mix of plain TeX and LaTeX,
sorry, and too many parameters to reset):

\documentclass[12pt]{article}
\pagestyle{empty}
\newbox\formbox
\newdimen\fmargin\fmargin=0.2pt
\def\fpage#1{%
  \setbox\formbox=\hbox{#1}%
  \offinterlineskip
  \hoffset=-1in
  \voffset=-1in
  \parskip=0pt
  \parindent=0pt
  \lineskip=0pt
  \topmargin=0pt
  \headheight=0pt
  \headsep=0pt
  \oddsidemargin=0pt
  \evensidemargin=0pt
  \textwidth=\hsize
  \setbox\formbox=\vbox{\kern\fmargin
    \hbox{\kern\fmargin\box\formbox\kern\fmargin}\kern\fmargin}%
  \topskip=\ht\formbox
  \hsize=\wd\formbox
  \vsize=\ht\formbox
  \pdfpagewidth=\hsize
  \pdfpageheight=\vsize
  \box\formbox
  \clearpage
}
\begin{document}
\fpage{hello}
\fpage{$f=\frac{1}{2\pi\sqrt{LC}}$}
\end{document}

>From here you can create the PNGs by a simple "convert xx.pdf xx.png",
creates xx-0.png, xx-1.png...

Regards, Hartmut


More information about the texhax mailing list