Create pdf of single picture

13 Mar 2008

Use the package preview to generate .pdf files containing single pictures. Works particularly well with tikz. Use the following wrapper latex code, then run pdflatex on it.

\documentclass{article}

\usepackage{tikz}
\usepackage[active,pdftex,tightpage]{preview}
\PreviewEnvironment[{[]}]{tikzpicture}

\begin{document}

\begin{tikzpicture}[options]
...
\end{tikzpicture}

\end{document}

Alternatively, you might use the standalone package to spit, e.g., multiple individual .png files

\documentclass[preview,multi,margin=2pt,convert={density=108}]{standalone}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\begin{document}

\begin{preview}
This is an example \LaTeX\ output.
\end{preview}

\begin{preview}
This is another with a formula: $e = mc^2$.
\end{preview}

\end{document}