# [texhax] compile to a small PDF

ap tug at alxp.gr
Mon Sep 8 15:59:18 CEST 2008

```Hi all,

I didn't find any previous post on this topic, so sorry if it had
already been covered (it seems to me that it should be a frequent
question).

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 [itex]...[/itex] 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) ?