# Multiple standalone documents [closed]

I have to create many figures(100s) with the same template.

Here is what I do now:

\documentclass[multi,crop,border=2]{standalone}
\usepackage{amsmath,pgfplotstable}

\standaloneenv{my}

\begin{document}

\foreach \n in {1,...,5} {
\begin{my}
\begin{tikzpicture}
\begin{axis}[xmin=-10,xmax=10,ymin=-10,ymax=10,samples=50]
% Usually, at this point, I read the data from a file named 'data\n.dat'
%\addplot [red, very thick]table [x index=0, y index =1] {data\n.dat};
\end{axis}
\end{tikzpicture}
\end{my}
}

\end{document}


Then I split the output pdf into individual pages using some tool.

Is there any way I can make standalone class output individual pdf files?

## closed as off-topic by Bobyandbob, TeXnician, Stefan Pinnow, Zarko, MenschDec 17 '17 at 21:01

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• So you use 1,...,5 in your example code, but actually you have more like 1,...,100? – Werner Dec 6 '17 at 7:15
• Not within TeX without an external program. You are better of to use a PDF split program yourself. There are several open source tools for that. Also note that you can use page on \includegraphics or \includestandalone to import specific pages. – Martin Scharrer Dec 6 '17 at 7:15
• @Werner: Yes, that's right. – Rhinocerotidae Dec 6 '17 at 7:20
• @SaravanaKumar: To answer your question: No. You can write a batch script to process each of the figures separately and write them to a new file upon completion, or process everything as a whole and then split them into separate files. – Werner Dec 6 '17 at 7:32
• I'm voting to close this question because it was solved in the comments. – Bobyandbob Dec 17 '17 at 11:09

As a workaround, you could externalize the tikz picture. This will not split the standalone into multiple pages, but will create an individual document for each iteration of the tikzpicture.

\documentclass[multi,crop,border=2]{standalone}
\usepackage{amsmath,pgfplotstable}

\usetikzlibrary{external}
\tikzexternalize

\standaloneenv{my}

\begin{document}

\foreach \n in {1,...,5} {
\begin{my}
\begin{tikzpicture}
\begin{axis}[xmin=-10,xmax=10,ymin=-10,ymax=10,samples=50]