Exporting all equations from a document as individual svg files
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
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"
# Create a copy of the existing file
cp $file $file.strip_backup
sed -i 's/begin{equation\*}/begin{align*}/g' $file
sed -i 's/end{equation\*}/end{align*}/g' $file
sed -i 's/begin{equation}/begin{align*}/g' $file
sed -i 's/end{equation}/end{align*}/g' $file
sed -i 's/begin{align}/begin{align*}/g' $file
sed -i 's/end{align}/end{align*}/g' $file
done
The individual equations can be extracted using:
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{align*}
(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
mkdir output-equations
pdf2svg filename.pdf output-equations/output-page%03d.svg all
If the svg images are still not properly cropped, Inkscape can fix that:
inkscape -z --verb=FitCanvasToDrawing --verb=FileSave --verb=FileClose output-equations/*.svg