# How can I export pdf files with tikz/pgfplots? [closed]

I am writing a long thesis and would like to source out some graphics, so that I do not have to in every run I am compiling the tex file. Here is a simple example:

\documentclass[a4paper]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage[latin9]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{bibgerm}
\usepackage{paralist}
\usepackage{lmodern}

\usepackage{pgfplots}
\pgfplotsset{compat=1.3}
\usepackage{tikz}
\usepgfplotslibrary{external}
\tikzexternalize[shell escape=-enable-write18]

\begin{document}

long text ...

\begin{figure}[h]
\centering
\begin{tikzpicture}
\begin{axis}
\end{axis}
\end{tikzpicture}
\caption{Test}
\end{figure}

long text ...

\end{document}


I get the error message:

! Package tikz Error: Sorry, the system call 'pdflatex -halt-on-error -interact ion=batchmode -jobname "diss-figure0" "\def\tikzexternalrealjob{diss}\input{dis s}"' did NOT result in a usable output file 'diss-figure0' (expected one of .pd f:.jpg:.jpeg:.png:). Please verify that you have enabled system calls. For pdfl atex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' o r something like that. Or maybe the command simply failed? Error messages can b e found in 'diss-figure0.log'. If you continue now, I'll try to typeset the pic ture.

I read several manuals and tried many modifications, but nothing worked. I am using TexnicCenter 1.0, MikTex 2.8 and Windows XP SP3.

-

## closed as too localized by lockstep, Joseph Wright♦Dec 3 '11 at 22:39

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

I wrote the standalone class just for that. See Compile a LaTeX document into a PNG image that's as short as possible which also works for PDF output and Insert a TikZ picture from an external file. Note that you must copy the source code with the required preamble to an extra file, which is however anyway good practice IMHO. –  Martin Scharrer Oct 5 '11 at 9:59
thank you for your fast answer, but isn't it possible to use the "external"-tool of pgfplots? I don't want to use the single pdf files, I just want to reduce to time my CPU needs for compiling my document. –  Alex Alves Oct 5 '11 at 10:06
I can't help you with the external library, I never used it. However, it basically create PDF files as well and uses these. I'm planning to support this as well within standalone. –  Martin Scharrer Oct 5 '11 at 10:09
If you don't need the pictures, you could find inspiration here: How to replace all pictures by white rectangles?. Then, at a later time, when you have the final document, you could revert to the original and compile it that way in one session. –  Count Zero Oct 5 '11 at 10:47
--shell-escape should work with miktex too. @Alex: 1. Make sure that the plot works in itself (without the externalize library). 2. Remove old auxiliary files (.aux etc) (or move your document to a new empty folder). Perhaps you get errors from there. If it still not works: Put the document, the text.txt and the log-file somewhere on the net for inspection. –  Ulrike Fischer Oct 5 '11 at 11:40