# Converting pgfplots usage to includegraphics (cannot use -shell-escape)

I am uploading a paper to arxiv, which does not allow the use of shell-escape.

Currently my paper uses pgfplots as in the following MWE:

temp.tex
----------------------------
\documentclass{article}
\usepackage{tikz,pgfplots}

\begin{document}

\begin{figure}
\begin{tikzpicture}[domain=-2:2]
\draw plot function{x*x};
\end{tikzpicture}
\end{figure}

\begin{figure}
\begin{tikzpicture}[domain=0:4]
\draw plot function{sqrt(x)};
\end{tikzpicture}
\end{figure}

\end{document}


When I compile with the following, everything works fine:

pdflatex --shell-escape temp.tex


How can I create the figures and include them in my document without using shell-escape? Ideally, I would run some script to produce fig1.pdf and fig2.pdf, then replace the MWE above with:

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\includegraphics{fig1}
\end{figure}
\begin{figure}
\includegraphics{fig2}
\end{figure}
\end{document}

• You could externalize the tikzpictures on your own computer (tex.stackexchange.com/questions/1460/…) and you'll get the images as pdfs which you can upload to arxiv – samcarter_is_at_topanswers.xyz Sep 28 '17 at 16:42
• Can you modify temp.tex to have \documentclass[tikz]{standalone} and remove the figure environments, and then have a different .tex file with e.g. \includegraphics[page=1]{temp}? – Torbjørn T. Sep 28 '17 at 16:44
• @samcarter, thanks, that looks like it should be what I want -- I'll try it. – usul Sep 28 '17 at 16:52
• @TorbjørnT., I'm not sure exactly what these instructions do, but I can try to look into that next. – usul Sep 28 '17 at 16:53
• \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \draw (0,0) -- (1,1); \end{tikzpicture} \begin{tikzpicture} \draw (0,2) -- (2,0); \end{tikzpicture} \end{document} will produce a 2 page PDF, one page per tikzpicture, where each page is exactly the size of the tikzpicture. The page option for includegraphics does exactly what you think: it determines which page of a multi-page PDF is included. – Torbjørn T. Sep 28 '17 at 17:10