Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
Are you not writing your presentation in LaTeX? –  Loop Space Apr 5 '11 at 8:30
1  
I'm embarrassed to admit it, but no :) –  Damien Apr 6 '11 at 0:55

3 Answers 3

up vote 17 down vote accepted

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
share|improve this answer
4  
the option displaymath should do it anyway. –  Herbert Apr 5 '11 at 5:57
    
Almost... The equation number is still embedded in each equation. Is there a way to automatically get rid of it? –  Damien Apr 6 '11 at 0:49
1  
@Damien: sure, assuming your document is based on one of the standard LaTeX classes, define the equation number out of existence thus: \makeatletter\renewcommand\@eqnnum{}\makeatother. –  Kilgore Apr 6 '11 at 11:59
    
Not sure what I've done wrong. I've placed the suggested \makeatletter command before \begin{document} and after. It seems not to make a difference, even with a standard template. Any ideas? –  Damien Apr 7 '11 at 12:36
    
I have included some additional notes in a new answer below to get rid of the whitespace and embedded equation numbering. –  Damien Aug 19 '11 at 7:45

To extend the answer from @Kilgore:

To get rid of the equation numbers (AND you have an excellent backup of the original file(s)!), yon can do the following:

#!/bin/bash

files=`find . | grep -e '\.tex$'`

for file in $files ; do 

    echo "Stripping: $file"
    sed -i 's/begin{equation}/begin{equation*}/g'   $file
    sed -i 's/end{equation}/end{equation*}/g'   $file

done

The individual equations can be extracted using:

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

(Note the addition of the *)

To remove the excessive whitespace, use the following utility:

pdfcrop output.pdf

And, finally, you can split this into individual svg files

pdf2svg filename.pdf output-page%03d.svg all
share|improve this answer

Make a Metapost file with one figure per equation, with each equation in an "unboxed box":

beginfig(1)
  boxit.a(btex $$e^{i\pi}+1=0$$ etex);
  a.c = (0,0);
  drawunboxed(a);
endfig(1);

beginfig(2)
  boxit.a(btex $$F={G m_1 m_2 \over d^2}$$ etex);
  a.c = (0,0);
  drawunboxed(a);
endfig(2);

Run mptosvg, which will generate one SVG file per figure, with the right bounding boxes.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.