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?


source to share

2 answers

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 .

If you want to download them use includepdf .



The tikz external library does just what you want:



It will generate one PDF at a time tikzpicture

. You can determine the output directory with:





All Articles