# How to export each TikZ image to a separate PDF file?

I am creating some graphs for my dissertation in one file .tex

using the TikZ package in LaTeX.
I am using a separate document class so that my plots are generated without spaces.

How can I export each graph to a separate PDF file so that I can download them separately in another project?

+3

source to share

When compiling a file, generate1.tex

it will create a file generate1.pdf

. When you rename the file .tex

(fe generate2.tex

), the new pdf will also have a different name ( generate2.pdf

), so the old pdf will not be deleted.

If you only want to display TikZ images use \PreviewEnvironment{tikzpicture}

. If you're interested, you can find some sample code here .

+1

source

The tikz external library does just what you want:

\usetikzlibrary{external}
\tikzexternalize

It will generate one PDF at a time tikzpicture

. You can determine the output directory with:

\tikzexternalize[prefix=./dir]

+1

source

All Articles