I'm creating some graphs for my thesis in a single .tex
file using the TikZ package in LaTeX.
I'm using the standalone document class so that my graphs are generated without whitespaces.
How can I export every graph in a separate PDF file so I can load them individually in another project?
The tikz library external does just what you want:
\usetikzlibrary{external}
\tikzexternalize
It will generate one PDF per tikzpicture
. You can define an output directory with:
\tikzexternalize[prefix=./dir]
When you compile generate1.tex
file, it will produce generate1.pdf
file. When you rename the .tex
file (f.e. generate2.tex
), new pdf will also have different name (generate2.pdf
), thus the old pdf won't be deleted.
If you want to display TikZ images only, use \PreviewEnvironment{tikzpicture}
. If you are interested, you can find the sample code here.
If you want to load them, use includepdf.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With