7

TikZ‘s externalization feature creates – by default – images like “nameOfFile-figure0.pdf”, “nameOfFile-figure1.pdf” and so on. One can change this behavior, for example I configured TikZ to save similar figures in the same directory. However I was unable to find out how to reset the counter, so that the next figure will be saved as “…-figure0.pdf”.

Probably one has just to know the counter name. But sadly enough, i cannot google it.

If anyone is wondering why this could be useful: I am writing a beamer presentation and split a TikZ picture on multiple frames (see this question). The given solution works, but I cannot name the following picture (it would be overwritten by the following one), so I set a specific directory for a new picture. Then it would be more convenient to start with “0” again for each directory, so adding a new picture at the beginning of my document would not force me to recompile everything.

2
  • 1
    Could you give an example of a situation where this would be needed?
    – Jake
    Commented Jan 14, 2014 at 14:08
  • 3
    I am writing a beamer presentation and split a TikZ picture on multiple frames (see this question). The given solution works, but I cannot name the following picture (it would be overwritten by the following one), so I set a specific directory for a new picture. Then it would be more convenient to start with “0” again for each directory, so adding a new picture at the beginning of my document would not force me to recompile everything.
    – Keba
    Commented Jan 14, 2014 at 14:12

1 Answer 1

3

I believe it isn't documented but for external figures with figure name foo as set with

\tikzset{external/figure name = foo}

the counter can be reset through

\tikzset{external/reset counter = foo}

I don't think there's a LaTeX counter involved since TikZ is a generic bundle and also should be usable with plain TeX or ConTeXt.

This works (although it doesn't make much sense) and only produces files for foo0:

% arara: pdflatex: { shell: on }
\documentclass{scrbook}

\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize

\tikzset{external/figure name = foo}

\begin{document}

\begin{tikzpicture}
  \draw (0,0)--(2,1) ;
\end{tikzpicture}

\tikzset{external/reset counter = foo}

\begin{tikzpicture}
  \draw (0,0)--(2,1) ;
\end{tikzpicture}

\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .