[Tex/LaTex] Exporting all equations from a document as individual svg files

conversionequationssvg

I'm currently a presentation based on a paper originally written in Latex. Currently, I use Kile and Ubuntu for my work.

What I'm finding is that I need a large number of the equations from the original paper scattered around the presentations (and are using them to annotate diagrams etc). My current method of screenshots + gimp is rather slow 🙂

So, what I would like to do is compile the tex document and instead of creating a pdf/dvi, I would like it to spit out a number of files, which each file being one of the equations from the document, preferably in a vector format, but I will live with a PNG if I have to, so long as it's of high enough resolution.

I've had a look at a number of utilities.

The following web utility: http://www.codecogs.com/latex/eqneditor.php does more or less what I want for an individually typed equation. However, I've used a lot of mactros in equations that make it a little messy to use (for example)

\newcommand{\SkewSymmetric}[1]{\ensuremath{ \left[ #1 \right]_{\times}}}

I've had a look at pdf2svg, but it doesn't quite do what I want – I still need to crop out the equation of interest.

Is there anything else I should look at?

Best Answer

Check out the preview package. E.g., including

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{equation}

prints all equation environments and nothing else, each cropped, one to a page. It's equally effective with DVI and pdf output. Embedded macros in equation (or whatever) environments are handled transparently and properly.

The pdf can then be converted to SVG images with the following command:

pdf2svg filename.pdf output-page%03d.svg all
Related Question