I'd like to externalize my Tikz pictures and automatically give them the Name Figure1.pdf, Figure2a.pdf, Figure2b.pdf etc.
Therefore, I'd like to combine \textsetnextfilename with some thing like cleveref which gives me the reference string I like automatically.
The purpose is, that I have to submit all figures individually as a PDF for a journal and I'd like to make sure they know which figure belongs where, without me naming everything manually and keeping track of which pdf is where after I moved stuff in the document.
%MWE
\documentclass{article}
\usepackage{cleveref}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize
\begin{document}
\tikzsetnextfilename{Figure1 (manually)} %%% Here should be some construct with \cref{fig:Test} that expands to Figure 1...
\begin{figure}
\centering
\begin{tikzpicture}
\draw[fill=gray](0,0)rectangle(0.3\textwidth,0.3\textwidth)node[midway, anchor=center,font=\Huge]{A};
\end{tikzpicture}
\caption{Blababal}\label{fig:Test}
\end{figure}
\Cref{fig:Test} shows a square with a uppercase letter A.
\end{document}
So something based on \cref{fig:Test} has to be entered as an argument to \tikzsetnextfilename to result automatically in having the PDF file names 'Figure 1.pdf'. In the MWE I put it manually, but how to automatize with \cref? If there is a way without \cref that would off also be fine.
mogrify. – Matthias Arras Aug 08 '17 at 19:30\crefis not expandable, I think this won't work in order to generate the file name as you desire – Aug 08 '17 at 21:48Figureas text, as that won't change. But don't include spaces (or other weird characters) in filenames. – cfr Aug 08 '17 at 21:53\tikzsetnextfilename{Figure\the\numexpr\value{figure}+1}in order to use the 'increased' counter value (which is increased by\captionlater on in reality) – Aug 08 '17 at 21:57