4

This is not an MWE per se, but it is the code I boiled the problem down to. Note: it does not produce an error.

The issue is that once I somehow managed to get an error for any TikZ or pgfplots graphic (due to any sort of mishap: missing bracket, semicolon or any other thing I suppose), the error message "--shell-escape -halt- on-error -interaction=batchmode -jobname" (and so forth...) comes up. Yet all graphics and edits to them get produced properly as far as I can tell. But the message won't go away.

I'm at a point where I'm totally clueless about it all. Is there a catch in connection to externalized TikZ/pgfplots-graphics? Any help or hints would be greatly appreciated. :)

Notes

The error message only goes away if I remove/comment out

  • the footnotetext- and \addtocounter-commands after each figure with a tikzpicture in it or

  • \tikzexternalize

Does the editor (TeXstudio) make a difference?

  • No, the problem appears in the same manner, whether I hit F1 in TeXstudio or run pdflatex from the command line.

Log for running pdflatex from Windows' cmd

http://pastebin.com/vHqE5isd

Log for running pdflatex --shell-escape from Windows' cmd

http://pastebin.com/0JZCij4T

MWE

\documentclass[
a4paper
]{scrartcl}

\usepackage{
    newtxtext,
    amsmath,
    subcaption,
    biblatex
}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{tikz}
\usetikzlibrary{
    external,
}
\tikzexternalize

\listfiles

\begin{document}
\begin{figure}[tp]
    \begin{minipage}[b]{0.48\linewidth}
        \centering
        a\\
        \begin{tikzpicture}
        \draw (0,0) rectangle (1,1);
        \end{tikzpicture}
        \subcaption[Something short.]{Something longer. So there is some text.\footnotemark\footnotemark}
    \end{minipage}
    \hfill
    \begin{minipage}[b]{0.48\linewidth}
        \centering
        b\\
        \begin{tikzpicture}
        \draw (0,0) rectangle (1,1);
        \end{tikzpicture}
        \subcaption[Text.]{Some longer text and a few words}
    \end{minipage}
\end{figure}
\addtocounter{footnote}{-2}
\footnotetext{\cite[Cp.][12]{Smith}}
\addtocounter{footnote}{1}
\footnotetext{\cite[Cp.][23]{Jones}}



\end{document}

Preamble relating to TikZ and pgfplots with style definitions

%% TikZ

\usetikzlibrary{
    external,
    plotmarks,
    math,
    calc,trees,shadows,positioning,arrows,chains,
    decorations.pathreplacing,
    decorations.pathmorphing,
    decorations.shapes,
    decorations.text,
    shapes,
    shapes.geometric,
    shapes.symbols,
    matrix,
    patterns,
    intersections,
    fit
}
\tikzexternalize

\pgfdeclarelayer{background layer}
\pgfdeclarelayer{foreground layer}
\pgfsetlayers{background layer,main,foreground layer}

%% pgfplots

\usepgfplotslibrary{
    groupplots,
    external
    }

\pgfplotsset{
every axis/.append style={
%%
%tick label style = {font=\sffamily\small\sansmath},
%every axis label = {font=\sffamily\small\sansmath},
%legend style = {font=\sffamily\small\sansmath},
%label style = {font=\sffamily\small\sansmath},
%
xmajorgrids={true},
ymajorgrids={true},
xminorgrids={true},
yminorgrids={true},
%
%line width=1pt,
%thick,
%
minor tick num=1,
%axis lines=middle,
%tick align=center,
compat=1.10,
},
every tick/.append style={
black,
thick
},
/pgf/number format/.cd,
use comma,
1000 sep={\,},
}

\tikzexternalize

File list

*File List*
scrartcl.cls    2013/12/19 v3.12 KOMA-Script document class (article)
scrkbase.sty    2013/12/19 v3.12 KOMA-Script package (KOMA-Script-dependent bas
ics and keyval usage)
 scrbase.sty    2013/12/19 v3.12 KOMA-Script package (KOMA-Script-independent b
asics and keyval usage)
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
scrlfile.sty    2013/12/19 v3.12 KOMA-Script package (loading files)
tocbasic.sty    2013/12/19 v3.12 KOMA-Script package (handling toc-files)
scrsize11pt.clo    2013/12/19 v3.12 KOMA-Script font size class option (11pt)
typearea.sty    2013/12/19 v3.12 KOMA-Script package (type area)
newtxtext.sty    2014/04/07 v1.25
fontaxes.sty    2014/03/23 v1.0d Font selection axes
 xkeyval.sty    2012/10/14 v2.6b package option processing (HA)
 xkeyval.tex    2012/10/14 v2.6b key=value parser (HA)
etoolbox.sty    2011/01/03 v2.1 e-TeX tools for LaTeX
    etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
textcomp.sty    2005/09/27 v1.99g Standard LaTeX package
  ts1enc.def    2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
 amsmath.sty    2013/01/14 v2.14 AMS math features
 amstext.sty    2000/06/29 v2.01
  amsgen.sty    1999/11/30 v2.0
  amsbsy.sty    1999/11/29 v1.2d
  amsopn.sty    1999/12/14 v2.01 operator names
subcaption.sty    2013/02/03 v1.1-62 Sub-captions (AR)
 caption.sty    2013/05/02 v3.3-89 Customizing captions (AR)
caption3.sty    2013/05/02 v1.6-88 caption3 kernel (AR)
biblatex.sty    2013/11/25 v2.8a programmable bibliographies (PK/JW/AB)
biblatex2.sty    2013/11/25 v2.8a programmable bibliographies (biber) (PK/JW/AB
)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
  logreq.sty    2010/08/04 v1.0 xml request logger
  logreq.def    2010/08/04 v1.0 logreq spec v1.0
  ifthen.sty    2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
  blx-dm.def
biblatex-dm.cfg
blx-compat.def    2013/11/25 v2.8a biblatex compatibility (PK/JW/AB)
biblatex.def    
standard.bbx    2013/11/25 v2.8a biblatex bibliography style (PK/JW/AB)
 numeric.bbx    2013/11/25 v2.8a biblatex bibliography style (PK/JW/AB)
 numeric.cbx    2013/11/25 v2.8a biblatex citation style (PK/JW/AB)
biblatex.cfg    
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
inputenc.sty    2008/03/30 v1.1d Input encoding file
    utf8.def    2008/04/05 v1.1m UTF-8 support for inputenc
   t1enc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  ot1enc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  omsenc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  ts1enc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
    tikz.sty    2013/12/13 v3.0.0 (rcs-revision 1.142)
     pgf.sty    2013/12/18 v3.0.0 (rcs-revision 1.14)
  pgfrcs.sty    2013/12/20 v3.0.0 (rcs-revision 1.28)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
  pgfrcs.code.tex
 pgfcore.sty    2010/04/11 v3.0.0 (rcs-revision 1.7)
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
  pgfsys.sty    2013/11/30 v3.0.0 (rcs-revision 1.47)
  pgfsys.code.tex
pgfsyssoftpath.code.tex    2013/09/09  (rcs-revision 1.9)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
 pgfcore.code.tex
pgfcomp-version-0-65.sty    2007/07/03 v3.0.0 (rcs-revision 1.7)
pgfcomp-version-1-18.sty    2007/07/23 v3.0.0 (rcs-revision 1.1)
  pgffor.sty    2013/12/13 v3.0.0 (rcs-revision 1.25)
 pgfkeys.sty    
 pgfkeys.code.tex
 pgfmath.sty    
 pgfmath.code.tex
  pgffor.code.tex
    tikz.code.tex
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
 english.lbx    2013/11/25 v2.8a biblatex localization (PK/JW/AB)
  ts1cmr.fd    1999/05/25 v2.5h Standard LaTeX font definitions
 t1ntxrx.fd    2012/12/25 v1.0
supp-pdf.mkii
epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf
  grfext.sty    2010/08/19 v1.1 Manage graphics extensions (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
 ***********
  • It worked fine for me with MikTeX 2.9 and TeXnic Center with LaTeX->PDF. There were supposedly 3 Bibtex errors. Why is Bibtex running? – John Kormylo Apr 26 '14 at 3:52
  • Huh, what exactly do you mean by "supposedly"? :) Bibtex shouldn't be called. – henry Apr 26 '14 at 8:55
  • That's what the log said. There were 3 Bibtex erros. No details were given. BTW, would you like a copy of the picture? – John Kormylo Apr 26 '14 at 14:23
  • @JohnKormylo Thanks, this isn't necessary since I get it to work from time to time. – henry Apr 27 '14 at 15:16
  • 2
    Your .log file for the case pdflatex --shell-escape requests you to look into K04/Bilder/K04_0.log. This log file contains the error which aborted the externalization. Could you also provide this log file? Or summarize its error messages? – Christian Feuersänger May 3 '14 at 18:20
3

You found an incompatibility: the external library and biblatex's \cite[][] syntax are incompatible.


The bug has been fixed; will become part of the next stable PGF.


According to the additional information provided in K04_4.log , TeX expected a $ sign when processing \cite[Vgl.][421]{PuenteLeon_2012_Messtechnik}. I guessed that this could be related to the underscore: it is a reserved token in math mode and requires $ if it is present within the normal text. Clearly, yours is not a normal text - but what if it becomes one during externalization?

Anyway, you can turn your example into a "real" minimal (non)working example if you write \cite[Cp.][23]{Jones_a} instead of \cite[Cp.][23]{Jones} (I introduced an underscore).

The bug is that the external library redefines \cite in order to catch all undefined symbols and communicate them as warnings into the log file of your original .tex file. This feature which collects warnings expects at most one set of square brackets after \cite and fails to process yours. This needs to be fixed; I will take care of it (no need to submit an extra bug report).

A workaround for now is to disable this feature which communicates unresolved \cite commands. Risk of this work-around: you may not realize that externalized images contain \cite which could not be resolved. In your minimal example, no tikzpicture environment even contains \cite, so it is entirely harmless.

Here is the example with the workaround:

\documentclass[
a4paper
]{scrartcl}

\usepackage{
    amsmath,
    subcaption,
    biblatex
}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{tikz}
\usetikzlibrary{
    external,
}
\tikzexternalize[
    failed ref warnings for={%
        \ref,%
        %\cite,% DISABLE THIS
        \pageref},
]

\listfiles

\begin{document}
\begin{figure}[tp]
    \begin{minipage}[b]{0.48\linewidth}
        \centering
        a\\
        \begin{tikzpicture}
        \draw (0,0) rectangle (1,1);
        \end{tikzpicture}
        \subcaption[Something short.]{Something longer. So there is some text.\footnotemark\footnotemark}
    \end{minipage}
    \hfill
    \begin{minipage}[b]{0.48\linewidth}
        \centering
        b\\
        \begin{tikzpicture}
        \draw (0,0) rectangle (1,1);
        \end{tikzpicture}
        \subcaption[Text.]{Some longer text and a few words}
    \end{minipage}
\end{figure}
\addtocounter{footnote}{-2}
\footnotetext{\cite[Cp.][12]{Smith}}
\addtocounter{footnote}{1}
\footnotetext{\cite[Cp.][23]{Jones_a}}



\end{document}
  • After weeks of confusion, this is such a relief to read. – henry May 17 '14 at 10:59
  • ... man. Silly me, I must have totally overlooked your comment roughly two weeks ago. :/ To make it all maybe a bit clearer if anyone else is curious: Christian is right in his "assumption", I neither have \ref, \cite nor \pageref in a tikzpicture environment. I might very well at some point in the following weeks but then it is going to be different. – henry May 17 '14 at 11:05
  • Would you happen to have any ETA of your fix? If so, a short note about it would be great. Also, maybe you could include this information in the post above? :) – henry Jul 5 '14 at 14:04
  • 1
    PGF has very very long release cycles, so: no ETA. I will see if I can ship a copy of the external lib with the next pgfplots release (in which case you would need to use \usepgfplotslibrary{external}). – Christian Feuersänger Jul 5 '14 at 15:06
  • Good to know, thank you for your quick reply. (I use the external library already btw.) – henry Jul 5 '14 at 15:20
3

Sorry but I dont have enough reps for a comment. I am using TeXlipse and MikTeX and the following error occured after copying and pasting your code from above:

Package tikz Error: Sorry, the system call 'pdflatex -halt-on-error -interaction=batchmode -jobname "document-figure0" "\def\tikzexternalrealjob{document}\input{document}"' did NOT result in a usable output file 'document-figure0' (expected one of .pdf:.jpg:.jpeg:.png:). Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or something like that. Or maybe the command simply failed? Error messages can be found in 'document-figure0.log'. If you continue now, I'll try to typeset the picture. \end{tikzpicture} (followed by: )

It says document-figure0 could't be created, so I did it myself by hand and created an document-figure0.pdf (other extensions are also given in the error message) after that both errors for both tikzpicture regions have gone away because no pdf file can be created

document-figure0.pdf: xpdf: reading PDF image failed
pdflatex.exe>  ==> Fatal error occurred, no output PDF file produced!

Hope this helps to come a step forward.

Update 1

I will eloborate my answer with a few images! But in short adding --shell-escape as a command line switch for pdflatex.exe did the job.

Error

enter image description here

Edit command line

enter image description here

Solved

I actually changed the height of the second rectangle (to 2) so to force two different MD5 sums but this will of course work with you initial example, too enter image description here

There are other threads here on tex.se which I'd like to link against. So please see 1, 2, 3 and 4.

Update 2

I missed to say what henry termed Preamble relating to TikZ and pgfplots with style definitions is in the external.tex file and his MWE part is in the document.tex file. Which I am using in the preamble (please correct me if something different was intended).

\usepackage{pgfplots}
\input{external.tex}

I had to realize henry even knows all this: 5

  • Thank you for your effort. It's worth asking (to rule it out): are you successful in running any code to produce and include an externalized TikZ figure? If not, unfortunately there is no merit in testing this on your end. – henry May 3 '14 at 8:51
  • @henry Yes I could produce the final pdf WITH externalization. Please see my updated answer. – dkeck May 3 '14 at 15:03
  • The binary folder of MikTeX is part of my path variable since I do a lot of thing manually via console and TeXlipse will require it I believe. So make this sure when using the above setup. – dkeck May 3 '14 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.