更新
只有当我更改图片本身或在文档中插入/删除出现在图片之前的图片时,才会出现错误。作为一个肮脏的解决方法,我定义了一个命令\newcommand{\subcaptionfix}[1]{#1}
,我将其包装在 subcaptionbox 命令(包括第一个参数)周围。如果我需要更改任何内容,我只需删除,#1
以便 LaTeX 忽略该命令。之后,我可以将其放回原处。
这个问题有一个合适的解决办法会更好,但我仍然很难在某种程度上重现这个错误。最小例如。也许几周后当我有更多时间时我会做这件事。
我在图中两次使用了subcaption
的命令。每次我都放置一张图片。只要我不更改其中一张图片,这就可以正常工作。一旦我更改它,就会出现以下错误:\subcaptionbox
subcaptionbox
TikZ
! Package tikz Error: Sorry, the system call 'pdflatex -shell-escape -halt-on-e
rror -interaction=batchmode -jobname "msc-preliminary-figure0" "\def\tikzextern
alrealjob{msc-preliminary}\input{msc-preliminary}"' did NOT result in a usable
output file 'msc-preliminary-figure0' (expected one of .pdf:.jpg:.jpeg:.png:).
Please verify that you have enabled system calls. For pdflatex, this is 'pdflat
ex -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 'msc-preli
minary-figure0.log'. If you continue now, I'll try to typeset the picture.
See the tikz package documentation for explanation.
Type H <return> for immediate help.
...
l.59 \end{tikzpicture}}
This error message was generated by an \errmessage
command, so I can't give any explicit help.
Pretend that you're Hercule Poirot: Examine all clues,
and deduce the truth by order and method.
LaTeX Font Info: Font shape `FMX/futm/m/n' will be
(Font) scaled to size 6.99199pt on input line 1.
LaTeX Font Info: Font shape `U/futm/m/n' will be
(Font) scaled to size 6.99199pt on input line 1.
LaTeX Font Info: Font shape `T1/futs/bx/n' in size <10> not available
(Font) Font shape `T1/futs/b/n' tried instead on input line 59.
===== Image 'msc-preliminary-figure1' is up-to-date. ======
) [5]pdfTeX warning (ext4): destination with the same identifier (name{equation
.2.1}) has been already used, duplicate ignored
<to be read again>
\relax
l.45 \end{align}
[6pdfTeX warning (ext4): destination with the same identifier
(name{equation.2.2}) has been already used, duplicate ignored
\AtBegShi@Output ...ipout \box \AtBeginShipoutBox
\fi \fi
l.59 \end{align}
<./msc-preliminary-figure1.pdf>]
使用subcaption
的subfigure
环境不会导致类似的问题,但由于标题长度不同,图像未水平对齐。此外,如果我删除命令\subcaptionbox
,进行更改并再次插入它们,它会很好地工作。
我尝试制作一个最小示例,但问题是我无法重现错误。如果这相关:我使用\usepgfplotslibrary{external}
和\tikzexternalize
。我的文件结构如下所示:
主要文件
\input{preamble.tex}
%... title and so on
\input{chapter1.tex}
\input{chapter2.tex}
%...
\input{chapterN.tex}
\input{appendix.tex}
第 2 章:chapter2.tex
%...text
\begin{figure}
\input{figurefile.tikz}
\caption[short]{long}
\label{fig:foobar}
\end{figure}
%...text
图:figurefile.tikz
\subcaptionbox{first subcaption\label{fig:foo}}{
\begin{tikzpicture}
%...picture
\end{tikzpicture}}
\hfill
\subcaptionbox{second subcaption\label{fig:bar}}{
\begin{tikzpicture}
%...picture
\end{tikzpicture}}
以前有人遇到过类似的事情吗?