我正在使用@egreg 几年前提出的练习表解决方案环境:https://tex.stackexchange.com/a/39566/4011。但是,如果我将它与 tikz externalize 库结合使用,它就会以错误消息结束。
以下是一个例子:
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[prefix=tikz/]
\usepackage{etoolbox}
\usepackage{environ}
\newtheorem{pr}{Problem}
\newtheorem{solinn}{ad Problem}
\newtoks\prsoltoks
\NewEnviron{Solution}{%
\global\prsoltoks=\expandafter{\the\prsoltoks\begin{solinn}}%
\global\prsoltoks=\expandafter{\the\expandafter\prsoltoks\BODY\end{solinn}}%
}
\usepackage{multicol}
\AtEndDocument{\clearpage\begin{center}\Large Solutions \end{center}
\setcounter{pr}{0}
\begin{multicols}{2}
\the\prsoltoks
\end{multicols}
}
\begin{document}
\begin{pr}~
\begin{tikzpicture}
\draw (0,0) circle (1cm);
\end{tikzpicture}
\end{pr}
\begin{Solution}~
\begin{tikzpicture}
\draw[red] (0,0) circle (1cm);
\end{tikzpicture}
\end{Solution}
\begin{tikzpicture}
\draw[green] (0,0) circle (1cm);
\end{tikzpicture}
\end{document}
编译此结果会出现以下错误消息:
ERROR: Package tikz Error: Sorry, the system call 'pdflatex -halt-on-error -interaction=batchmode -jobname "tikz/externalize_test-figure2" "\def\tikzexternalrealjob{externalize_test}\input{externalize_test}"' did NOT result in a usable output file 'tikz/externalize_test-figure2' (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 'tikz/externalize_test-figure2.log'. If you continue now, I'll try to typeset the picture.
错误信息如下tikz/externalize_test-figure2.log
:
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex 2015.10.18) 18 OCT 2015 16:15
entering extended mode
\write18 enabled.
%&-line parsing enabled.
**\def\tikzexternalrealjob{externalize_test}\input{externalize_test}
(./externalize_test.tex (/usr/local/texlive/2015/texmf-dist/tex/latex/base/arti
cle.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/size12.clo
File: size12.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
) (/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty (/us
r/local/texlive/2015/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty (/usr/local/te
xlive/2015/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
x
\pgfutil@everybye=\toks14
\pgfutil@tempdima=\dimen103
\pgfutil@tempdimb=\dimen104
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-li
sts.tex))
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
\pgfutil@abb=\box26
(/usr/local/texlive/2015/texmf-dist/tex/latex/ms/everyshi.sty
Package: everyshi 2001/05/15 v3.00 EveryShipout Package (MS)
)) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.te
x
Package: pgfrcs 2015/08/07 v3.0.1a (rcs-revision 1.31)
))
Package: pgf 2015/08/07 v3.0.1a (rcs-revision 1.15)
(/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty (/usr/
local/texlive/2015/texmf-dist/tex/latex/graphics/graphicx.sty
Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
(/usr/local/texlive/2015/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks15
) (/usr/local/texlive/2015/texmf-dist/tex/latex/graphics/graphics.sty
Package: graphics 2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)
(/usr/local/texlive/2015/texmf-dist/tex/latex/graphics/trig.sty
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
) (/usr/local/texlive/2015/texmf-dist/tex/latex/latexconfig/graphics.cfg
File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
)
Package graphics Info: Driver file: pdftex.def on input line 94.
(/usr/local/texlive/2015/texmf-dist/tex/latex/pdftex-def/pdftex.def
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/infwarerr.sty
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO)
) (/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/ltxcmds.sty
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
)
\Gread@gobject=\count87
))
\Gin@req@height=\dimen105
\Gin@req@width=\dimen106
) (/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex
Package: pgfsys 2014/07/09 v3.0.1a (rcs-revision 1.48)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
\pgfkeys@pathtoks=\toks16
\pgfkeys@temptoks=\toks17
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex
\pgfkeys@tmptoks=\toks18
))
\pgf@x=\dimen107
\pgf@y=\dimen108
\pgf@xa=\dimen109
\pgf@ya=\dimen110
\pgf@xb=\dimen111
\pgf@yb=\dimen112
\pgf@xc=\dimen113
\pgf@yc=\dimen114
\w@pgf@writea=\write3
\r@pgf@reada=\read1
\c@pgf@counta=\count88
\c@pgf@countb=\count89
\c@pgf@countc=\count90
\c@pgf@countd=\count91
\t@pgf@toka=\toks19
\t@pgf@tokb=\toks20
\t@pgf@tokc=\toks21
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg
File: pgf.cfg 2008/05/14 (rcs-revision 1.7)
)
Driver file for pgf: pgfsys-pdftex.def
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.d
ef
File: pgfsys-pdftex.def 2014/10/11 (rcs-revision 1.35)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-p
df.def
File: pgfsys-common-pdf.def 2013/10/10 (rcs-revision 1.13)
)))
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.
code.tex
File: pgfsyssoftpath.code.tex 2013/09/09 (rcs-revision 1.9)
\pgfsyssoftpath@smallbuffer@items=\count92
\pgfsyssoftpath@bigbuffer@items=\count93
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.
code.tex
File: pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
)) (/usr/local/texlive/2015/texmf-dist/tex/latex/xcolor/xcolor.sty
Package: xcolor 2007/01/21 v2.11 LaTeX color extensions (UK)
(/usr/local/texlive/2015/texmf-dist/tex/latex/latexconfig/color.cfg
File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
)
Package xcolor Info: Driver file: pdftex.def on input line 225.
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1337.
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1341.
Package xcolor Info: Model `RGB' extended on input line 1353.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1355.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1356.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1357.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1358.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1359.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1360.
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex
Package: pgfcore 2010/04/11 v3.0.1a (rcs-revision 1.7)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex (/usr
/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex (/usr/
local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
\pgfmath@dimen=\dimen115
\pgfmath@count=\count94
\pgfmath@box=\box27
\pgfmath@toks=\toks22
\pgfmath@stack@operand=\toks23
\pgfmath@stack@operation=\toks24
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
tex
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
.code.tex)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
nometric.code.tex)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
m.code.tex)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
rison.code.tex)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
code.tex)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
.code.tex)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
code.tex)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integ
erarithmetics.code.tex))) (/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/m
ath/pgfmathfloat.code.tex
\c@pgfmathroundto@lastzeros=\count95
))
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.co
de.tex
File: pgfcorepoints.code.tex 2013/10/07 (rcs-revision 1.27)
\pgf@picminx=\dimen116
\pgf@picmaxx=\dimen117
\pgf@picminy=\dimen118
\pgf@picmaxy=\dimen119
\pgf@pathminx=\dimen120
\pgf@pathmaxx=\dimen121
\pgf@pathminy=\dimen122
\pgf@pathmaxy=\dimen123
\pgf@xx=\dimen124
\pgf@xy=\dimen125
\pgf@yx=\dimen126
\pgf@yy=\dimen127
\pgf@zx=\dimen128
\pgf@zy=\dimen129
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconst
ruct.code.tex
File: pgfcorepathconstruct.code.tex 2013/10/07 (rcs-revision 1.29)
\pgf@path@lastx=\dimen130
\pgf@path@lasty=\dimen131
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage
.code.tex
File: pgfcorepathusage.code.tex 2014/11/02 (rcs-revision 1.24)
\pgf@shorten@end@additional=\dimen132
\pgf@shorten@start@additional=\dimen133
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.co
de.tex
File: pgfcorescopes.code.tex 2015/05/08 (rcs-revision 1.46)
\pgfpic=\box28
\pgf@hbox=\box29
\pgf@layerbox@main=\box30
\pgf@picture@serial@count=\count96
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicst
ate.code.tex
File: pgfcoregraphicstate.code.tex 2014/11/02 (rcs-revision 1.12)
\pgflinewidth=\dimen134
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransform
ations.code.tex
File: pgfcoretransformations.code.tex 2015/08/07 (rcs-revision 1.20)
\pgf@pt@x=\dimen135
\pgf@pt@y=\dimen136
\pgf@pt@temp=\dimen137
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.cod
e.tex
File: pgfcorequick.code.tex 2008/10/09 (rcs-revision 1.3)
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.c
ode.tex
File: pgfcoreobjects.code.tex 2006/10/11 (rcs-revision 1.2)
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathproce
ssing.code.tex
File: pgfcorepathprocessing.code.tex 2013/09/09 (rcs-revision 1.9)
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.co
de.tex
File: pgfcorearrows.code.tex 2015/05/14 (rcs-revision 1.43)
\pgfarrowsep=\dimen138
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.cod
e.tex
File: pgfcoreshade.code.tex 2013/07/15 (rcs-revision 1.15)
\pgf@max=\dimen139
\pgf@sys@shading@range@num=\count97
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.cod
e.tex
File: pgfcoreimage.code.tex 2013/07/15 (rcs-revision 1.18)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.
code.tex
File: pgfcoreexternal.code.tex 2014/07/09 (rcs-revision 1.21)
\pgfexternal@startupbox=\box31
))
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.co
de.tex
File: pgfcorelayers.code.tex 2013/07/18 (rcs-revision 1.7)
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretranspare
ncy.code.tex
File: pgfcoretransparency.code.tex 2013/09/30 (rcs-revision 1.5)
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.
code.tex
File: pgfcorepatterns.code.tex 2013/11/07 (rcs-revision 1.5)
)))
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.cod
e.tex
File: pgfmoduleshapes.code.tex 2014/03/21 (rcs-revision 1.35)
\pgfnodeparttextbox=\box32
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.
tex
File: pgfmoduleplot.code.tex 2015/08/03 (rcs-revision 1.13)
)
(/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version
-0-65.sty
Package: pgfcomp-version-0-65 2007/07/03 v3.0.1a (rcs-revision 1.7)
\pgf@nodesepstart=\dimen140
\pgf@nodesepend=\dimen141
)
(/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version
-1-18.sty
Package: pgfcomp-version-1-18 2007/07/23 v3.0.1a (rcs-revision 1.1)
)) (/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/utilities/pgffor.sty (/usr
/local/texlive/2015/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty (/usr/local/
texlive/2015/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex)) (/usr/loca
l/texlive/2015/texmf-dist/tex/latex/pgf/math/pgfmath.sty (/usr/local/texlive/20
15/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)) (/usr/local/texlive/2015/
texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
Package: pgffor 2013/12/13 v3.0.1a (rcs-revision 1.25)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex)
\pgffor@iter=\dimen142
\pgffor@skip=\dimen143
\pgffor@stack=\toks25
\pgffor@toks=\toks26
))
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.cod
e.tex
Package: tikz 2015/08/07 v3.0.1a (rcs-revision 1.151)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothan
dlers.code.tex
File: pgflibraryplothandlers.code.tex 2013/08/31 v3.0.1a (rcs-revision 1.20)
\pgf@plot@mark@count=\count98
\pgfplotmarksize=\dimen144
)
\tikz@lastx=\dimen145
\tikz@lasty=\dimen146
\tikz@lastxsaved=\dimen147
\tikz@lastysaved=\dimen148
\tikzleveldistance=\dimen149
\tikzsiblingdistance=\dimen150
\tikz@figbox=\box33
\tikz@figbox@bg=\box34
\tikz@tempbox=\box35
\tikz@tempbox@bg=\box36
\tikztreelevel=\count99
\tikznumberofchildren=\count100
\tikznumberofcurrentchild=\count101
\tikz@fig@count=\count102
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.cod
e.tex
File: pgfmodulematrix.code.tex 2013/09/17 (rcs-revision 1.8)
\pgfmatrixcurrentrow=\count103
\pgfmatrixcurrentcolumn=\count104
\pgf@matrix@numberofcolumns=\count105
)
\tikz@expandcount=\count106
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/frontendlayer/tikz/librarie
s/tikzlibrarytopaths.code.tex
File: tikzlibrarytopaths.code.tex 2008/06/17 v3.0.1a (rcs-revision 1.2)
)))
(/usr/local/texlive/2015/texmf-dist/tex/latex/pgf/frontendlayer/libraries/tikzl
ibraryexternal.code.tex (/usr/local/texlive/2015/texmf-dist/tex/generic/oberdie
k/pdftexcmds.sty
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/ifluatex.sty
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
) (/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/ifpdf.sty
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO)
Package ifpdf Info: pdfTeX in PDF mode is detected.
)
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
)
(/usr/local/texlive/2015/texmf-dist/tex/generic/pgf/frontendlayer/tikz/librarie
s/tikzexternalshared.code.tex))
No auxiliary output files.
\w@pgfexternal@auxout=\write4
(/usr/local/texlive/2015/texmf-dist/tex/latex/etoolbox/etoolbox.sty
Package: etoolbox 2015/08/02 v2.2a e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count107
) (/usr/local/texlive/2015/texmf-dist/tex/latex/environ/environ.sty
Package: environ 2014/05/04 v0.3 A new way to define environments
(/usr/local/texlive/2015/texmf-dist/tex/latex/trimspaces/trimspaces.sty
Package: trimspaces 2009/09/17 v1.1 Trim spaces around a token list
)
\@envbody=\toks27
)
\c@pr=\count108
\c@solinn=\count109
\prsoltoks=\toks28
(/usr/local/texlive/2015/texmf-dist/tex/latex/tools/multicol.sty
Package: multicol 2015/08/19 v1.8n multicolumn formatting (FMi)
\c@tracingmulticols=\count110
\mult@box=\box37
\multicol@leftmargin=\dimen151
\c@unbalance=\count111
\c@collectmore=\count112
\doublecol@number=\count113
\multicoltolerance=\count114
\multicolpretolerance=\count115
\full@width=\dimen152
\page@free=\dimen153
\premulticols=\dimen154
\postmulticols=\dimen155
\multicolsep=\skip43
\multicolbaselineskip=\skip44
\partial@page=\box38
\last@line=\box39
\maxbalancingoverflow=\dimen156
\mult@rightbox=\box40
\mult@grightbox=\box41
\mult@gfirstbox=\box42
\mult@firstbox=\box43
\@tempa=\box44
\@tempa=\box45
\@tempa=\box46
\@tempa=\box47
\@tempa=\box48
\@tempa=\box49
\@tempa=\box50
\@tempa=\box51
\@tempa=\box52
\@tempa=\box53
\@tempa=\box54
\@tempa=\box55
\@tempa=\box56
\@tempa=\box57
\@tempa=\box58
\@tempa=\box59
\@tempa=\box60
\c@columnbadness=\count116
\c@finalcolumnbadness=\count117
\last@try=\dimen157
\multicolovershoot=\dimen158
\multicolundershoot=\dimen159
\mult@nat@firstbox=\box61
\colbreak@box=\box62
\mc@col@check@num=\count118
)
No file tikz/externalize_test-figure2.aux.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 30.
LaTeX Font Info: ... okay on input line 30.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 30.
LaTeX Font Info: ... okay on input line 30.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 30.
LaTeX Font Info: ... okay on input line 30.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 30.
LaTeX Font Info: ... okay on input line 30.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 30.
LaTeX Font Info: ... okay on input line 30.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 30.
LaTeX Font Info: ... okay on input line 30.
ABD: EveryShipout initializing macros (/usr/local/texlive/2015/texmf-dist/tex/c
ontext/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count119
\scratchdimen=\dimen160
\scratchbox=\box63
\nofMPsegments=\count120
\nofMParguments=\count121
\everyMPshowfont=\toks29
\MPscratchCnt=\count122
\MPscratchDim=\dimen161
\MPnumerator=\count123
\makeMPintoPDFobject=\count124
\everyMPtoPDFconversion=\toks30
) (/usr/local/texlive/2015/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf
(/usr/local/texlive/2015/texmf-dist/tex/latex/oberdiek/grfext.sty
Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO)
(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty
Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO)
)) (/usr/local/texlive/2015/texmf-dist/tex/latex/oberdiek/kvoptions.sty
Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO)
(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO)
(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/etexcmds.sty
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
Package etexcmds Info: Could not find \expanded.
(etexcmds) That can mean that you are not using pdfTeX 1.50 or
(etexcmds) that some package has redefined \expanded.
(etexcmds) In the latter case, load this package earlier.
)))
Package grfext Info: Graphics extension search list:
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE
G,.JBIG2,.JB2,.eps]
(grfext) \AppendGraphicsExtensions on input line 452.
(/usr/local/texlive/2015/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
))
A tikzpicture has been optimized away. Use '/tikz/external/optimize=false' to d
isable this.
A tikzpicture has been optimized away. Use '/tikz/external/optimize=false' to d
isable this.
! Package tikz Error: Sorry, image externalization failed: the resulting image
was EMPTY. I tried to externalize 'tikz/externalize_test-figure2', but it seems
there is no such image in the document!?
You are currently using 'mode=convert with system call'. This problem can ha
ppen if the image (or one of the images preceeding it) was declared inside of a
\label{} (i.e. in the .aux file): 'convert with system call' has no access to
the main aux file.
Possible solutions in this case:
(a) Try using 'mode=list and make',
(b) Issue the externalization command 'pdflatex -shell-escape -halt-on-error
-interaction=batchmode -jobname "tikz/externalize_test-figure2" "\def\tikzexte
rnalrealjob{externalize_test}\input{externalize_test}"' *manually* (also check
the preceeding externalized images, perhaps the file name sequence is not corre
ct).
Repeat: the resulting image was EMPTY, your attention is required .
See the tikz package documentation for explanation.
Type H <return> for immediate help.
...
l.50 \end{document}
Here is how much of TeX's memory you used:
12114 strings out of 494236
250445 string characters out of 6165751
282228 words of memory out of 5000000
15223 multiletter control sequences out of 15000+600000
4893 words of font info for 18 fonts, out of 8000000 for 9000
517 hyphenation exceptions out of 8191
56i,1n,58p,847b,101s stack positions out of 5000i,500n,10000p,200000b,80000s
! ==> Fatal error occurred, no output PDF file produced!
知道这里出了什么问题以及如何修复它吗?
编辑从评论和答案中,我发现问题并不完全在于组合“自动解决方案代码”和外部库的结合。没有这个“自动解决方案代码”的外部库工作得很好。
答案1
问题是第二幅图像的内容最终会覆盖第三幅图像的内容,而 TikZ 认为是第二幅图像但实际上是第三幅图像的内容不可用。也就是说,您会在问题中看到一个绿色圆圈,如果您让 TikZ 继续排版有问题的图像(尽管存在错误),那么您也会在解决方案中看到一个绿色圆圈。
本质上,TikZ 会非常、非常困惑,分不清哪张图像是哪张。即使你给每张图像指定了名称,这种情况也会发生。
以下代码编译时没有错误。问题中的图像是外部化的。解决方案中的图像没有外部化。相反,这些图像像往常一样排版。
显然,这只是一种变通方法,而不是解决方案,但至少它保留了部分外部化,这比完全放弃它要好。
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[prefix=ffigurau/]
\usepackage{etoolbox}
\usepackage{environ}
\usepackage{multicol}
\newtheorem{pr}{Problem}
\newtheorem{solinn}{ad Problem}
\newtoks\prsoltoks
\NewEnviron{Solution}{%
\global\prsoltoks=\expandafter{\the\prsoltoks\begin{solinn}}%
\global\prsoltoks=\expandafter{\the\expandafter\prsoltoks\BODY\end{solinn}}%
}
\AtEndDocument{%
\clearpage
\tikzset{external/export=false}%
\begin{center}
\Large Solutions
\end{center}
\setcounter{pr}{0}%
\begin{multicols}{2}
\the\prsoltoks
\end{multicols}%
}
\begin{document}
\begin{pr}~
\begin{tikzpicture}
\draw (0,0) circle (1cm);
\end{tikzpicture}
\end{pr}
\begin{Solution}~
\begin{tikzpicture}
\draw[red] (0,0) circle (1cm);
\end{tikzpicture}
\end{Solution}
\begin{tikzpicture}
\draw[green] (0,0) circle (1cm);
\end{tikzpicture}
\end{document}
答案2
当我清理你的代码时,只剩下:
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[prefix=tikz/]
\begin{document}
\begin{tikzpicture}
\draw (0,0) circle (1cm);
\end{tikzpicture}
\begin{tikzpicture}
\draw[red] (0,0) circle (1cm);
\end{tikzpicture}
\begin{tikzpicture}
\draw[green] (0,0) circle (1cm);
\end{tikzpicture}
\end{document}
然后它就开始工作了,我得到了这个输出加上三个外部文件:
我使用如下所示的批处理文件对其进行了编译:
pdflatex -shell-escape lala.tex
因此我认为问题出在您的附加代码上。
我知道这不是一个答案,但是评论太多了。