[texhax] compile to a small PDF

William Adams will.adams at frycomm.com
Mon Sep 8 17:30:19 CEST 2008

On Sep 8, 2008, at 9:59 AM, ap wrote:

> I wanted to know if there's a method to compile a small piece of LaTeX
> code to a standalone PDF output containing only that part. I might not
> be very clear, but I basically want to convert for example a formula
> to a PDF output displaying that formula as interpreted by LaTeX (for
> example as latex2html does, or even as MediaWiki does with texvc and
> the <math>...</math> construct - except I am looking for PDF output
> and not PNG).
> For the moment, I am only aware of the following workaround:
> -create a tex file that will contain nothing more than the formula to
> be displayed (i.e. use \pagestyle{empty}).
> -use the latex engine
> -use dvips -E to find a tight bounding box
> -convert to PDF.
> But that's not satisfactory when I want, for some reasons, to compile
> using the pdflatex engine. So my question is, how can I generate a PDF
> using pdflatex in a way that acts like (latex + dvips -E + epstopdf) ?
> Thanks for your answers.

You'll need to:

  - wrap the equation / tex bit in a wrapper which loads any needed  
macros and packages and \begin/\end{document}s

  - include a macro wrapper which typesets the macro into a box,  
measures the box and sets the page size to that (using say the  
geometry package)

Or you could post-process the .pdf

If you're using Mac OS X you may find LaTeXiT of interest:


Which is a re-creation of the NeXTstep TeXview.app's tex eq -> eps  
Service for .pdfs


William Adams
senior graphic designer
Fry Communications

More information about the texhax mailing list