[Tex/LaTex] TikZ’s externalization and thelatex

format-filestikz-externaltikz-pgf

I know I am greedy…

I have tried for quite a while to get TikZ's externalization facilities to work nicely with mylatex, without any luck.

My document currently looks like

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize{filename}
\begin{document}
Some text.
\end{document}

I first compile it with

pdfetex -shell-escape --output-format pdf --jobname=filename-pdf --ini \&latex mylatex.ltx filename.tex

which builds a filename-pdf.fmt format file, which I then use

latex -shell-escape --output-format pdf &filename-pdf filename.tex

If I remove the two lines referring to externalization, this scheme works.
With them, no output is generated. (If instead of \tikzexternalize{filename}
I say \tikzexternalize the second run uses filename-pdf as jobname for the pdflatex runs used to compile externalized images, which does not work…)

Any ideas?

Best Answer

The problem here are the different jobnames of the format file and the main document. To resolve this, simply name your format file filename.fmt instead of filename-pdf.fmt and all will be fine:

filename.tex

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize{filename}
\begin{document}
Some text.
\end{document}

Compile the format file with

pdfetex -shell-escape --output-format pdf --jobname=filename --ini \&latex mylatex.ltx filename.tex

This creates filename.fmt. Afterwards, run the compilation of your document with

latex -shell-escape --output-format pdf &filename filename.tex
Related Question