我正在尝试使用\includegraphics
包auto-pst-pdf
来转换和导入 EPS 文件,但是当我启用 TikZ 的external
库时,\includegraphics
失败并显示错误消息:
Package tikz Error: Sorry, the system call 'pdflatex -shell-e
scape -halt-on-error -interaction=batchmode -jobname "images/exports/EPSMods-fi
gure0" "\def\tikzexternalrealjob{EPSMods}\input{EPSMods}"' did NOT result in a
usable output file 'images/exports/EPSMods-figure0' (expected one of .pdf:.jpg:
.jpeg:.png:). Please verify that you have enabled system calls. For pdflatex, t
his is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or somet
hing like that. Or maybe the command simply failed? Error messages can be found
in 'images/exports/EPSMods-figure0.log'. If you continue now, I'll try to type
set the picture.
当我尝试使用 来阻止有问题的图片外部化时tikzexternaldisable
,我得到了相同的结果。
有没有办法同时使用auto-pst-pdf
TikZ 的库(并且彼此独立)?external
\documentclass{article}
\usepackage{auto-pst-pdf}
\usepackage{graphicx}
\usepackage{psfrag}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[prefix=images/exports/]
%\tikzset{external/force remake} % Uncommenting this generates the error every time
\begin{document}
\begin{tikzpicture}
\node {root}
child {node {left}}
child {node {right}
child {node {child}}
child {node {child}}
};
\end{tikzpicture}
\bigskip{}
{\tikzexternaldisable % Removing this causes the third figure to appear in place of this one
\begin{tikzpicture} % Shouldn't this picture behave as it would in the absence of the `external` library?
\psfrag{Z}{$Q=\Sigma_X$}
%\psfragfig{GraphA} % GraphA is an EPS file being processed by `auto-pst-pdf`; this works
\includegraphics{GraphA} % This fails, even if wrapped in a node
\end{tikzpicture}
}
\bigskip{}
\begin{tikzpicture}
\node {A}
child {node {B}}
child {node {C}
child {node {D}}
child {node {X}}
};
\end{tikzpicture}
\end{document}
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
auto-pst-pdf.sty 2009/04/26 v0.6 Wrapper for pst-pdf
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
xkeyval.sty 2008/08/13 v2.6a package option processing (HA)
xkeyval.tex 2008/08/13 v2.6a key=value parser (HA)
ifplatform.sty 2010/10/22 v0.4 Testing for the operating system
pdftexcmds.sty 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
catchfile.sty 2011/03/01 v1.6 Catch the contents of a file (HO)
etexcmds.sty 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
EPSIncludeBug.w18
pst-pdf.sty 2008/10/09 v1.1v PS graphics for pdfLaTeX (RN,HjG)
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
pstricks.sty 2011/10/31 v0.52 LaTeX wrapper for `PSTricks' (RN,HV)
pstricks.tex 2012/03/11 v2.27 `PSTricks' (tvz,hv)
pst-xkey.tex 2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
pst-fp.tex 2012/03/11 v2.27 `PST-fp' (hv)
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
preview.sty 2010/02/14 11.86 (AUCTeX/preview-latex)
dvips.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
environ.sty 2008/06/18 v0.2 A new way to define environments
psfrag.sty 1998/04/11 v3.04 PSfrag (MCG)
tikz.sty 2010/10/13 v2.10 (rcs-revision 1.76)
pgf.sty 2008/01/15 v2.10 (rcs-revision 1.12)
pgfrcs.sty 2010/10/25 v2.10 (rcs-revision 1.24)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v2.10 (rcs-revision 1.7)
pgfsys.sty 2010/06/30 v2.10 (rcs-revision 1.37)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2008/07/18 (rcs-revision 1.7)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v2.10 (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v2.10 (rcs-revision 1.1)
pgffor.sty 2010/03/23 v2.10 (rcs-revision 1.18)
pgfkeys.sty
pgfkeys.code.tex
pgffor.code.tex
tikz.code.tex
supp-pdf.mkii
EPSIncludeBug-pics.pdf Graphic file (type pdf)
答案1
test-external.eps
由 gnuplot 构建的EPS 文件 ( ):
# 制作 EPS 文件 设置终端后记 设置输出“test-external.eps” 绘制 sin(x) 辞职
然后,生成一个带有TikZ 外部化的LaTeX 文件 ( tikz-externalize.tex
) :\includegraphics
\documentclass{standalone}
\usepackage{auto-pst-pdf}
\usepackage{graphicx}
\usepackage{psfrag}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzset{external/force remake}
\begin{document}
\begin{tikzpicture}
\node {root}
child {node {left}}
child {node {right}
child {node {child}}
child {node {child}}
};
\end{tikzpicture}
{
\tikzexternaldisable
\begin{tikzpicture}
\psfrag{sin(x)}{$y=sin(x)$}%
\node{\includegraphics[width=.5\linewidth]{test-external}};
\end{tikzpicture}
}
\begin{tikzpicture}
\node {A}
child {node {B}}
child {node {C}
child {node {D}}
child {node {X}}
};
\end{tikzpicture}
\end{document}
编译:
pdflatex -shell-escape tikz-externalize.tex
结果如下: