4

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}
\addplot[color=black, mark=] table[x=Tag,y=Dax] {test.txt};
\addlegendentry{DAX}
\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.

N.N.
  • 36,163
Alex Alves
  • 41
  • 1
  • 2
  • 2
    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 05 '11 at 09: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 05 '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 05 '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 05 '11 at 10:47
  • I think your code should work it worked for me in miktex 2.9. (not tested exactly as you didn't provide the test.txt). I don't think that the option to \tikzexternalize is needed. You naturally must use --shell-escape on the main pdflatex call. – Ulrike Fischer Oct 05 '11 at 10:49
  • First step in debugging this is to check that you are calling TeX with shell escape enabled. I don't know how TexnicCenter calls TeX so can't say how to check this, maybe someone else knows. Can you see the log of the tex run? If so, look at the top and see if it says \write18 enabled somewhere there. – Andrew Stacey Oct 05 '11 at 10:52
  • Thank you for your comments! @ ulrike: where do i have the place the "--shell-escape"? I treid it at several places but it is not working ... – Alex Alves Oct 05 '11 at 10:53
  • @ andrew: I cannot find \write18 enabled in the log file. How can I enable this? – Alex Alves Oct 05 '11 at 10:56
  • I'm not using texniccenter. But it should be possible to add --shell-escape somewhere in the profile with which you call pdflatex. Or call once pdflatex simply on the command line. – Ulrike Fischer Oct 05 '11 at 10:56
  • I tried pdflatex --shell-escape test.tex on the command line as well as several places in the pdflatex profil inside texniccenter ... same error – Alex Alves Oct 05 '11 at 11:01
  • According to my friendly neighbourhood search engine, the option for MikTeX is --enable-write18. Try it on the commandline first. – Andrew Stacey Oct 05 '11 at 11:30
  • 1
    --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 05 '11 at 11:40
  • I tried it on an other PC and it works with --shell-enable in the TexnicCenter Output Profil. But it still doesnt work on my own PC ... the plot itself is working and I tried it from an empty folder. – Alex Alves Oct 05 '11 at 11:59
  • Then show the log-files of the working and the non-working compilations. – Ulrike Fischer Oct 05 '11 at 12:07
  • how can i upload log files? – Alex Alves Oct 05 '11 at 12:28
  • The internet is full of places where you can put files. (Check the log-file for personal informations before the upload). – Ulrike Fischer Oct 05 '11 at 14:46

0 Answers0