TikZ (tikzexternalize) + subcaptionbox 錯誤

TikZ (tikzexternalize) + subcaptionbox 錯誤

更新

只有當我更改圖片本身或插入/刪除文件中出現在圖片之前的圖片時,才會出現該錯誤。作為一種骯髒的解決方法,我定義了一個\newcommand{\subcaptionfix}[1]{#1}圍繞 subcaptionbox 命令(包括第一個參數)的命令。如果我需要更改任何內容,我只需刪除 ,#1以便 LaTeX 忽略該命令。之後我就可以把它放回去了。

問題的正確解決方案會更好,但我仍然很難以某種方式重現錯誤最小的例子。也許幾週後當我有更多時間時我會這樣做。


我在圖中使用了兩次subcaption's 指令。\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>]

usingsubcaptionsubfigure環境不會導致類似的問題,但由於標題長度不同,影像沒有水平對齊。另外,如果我刪除該\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}}

以前有人發生過這樣的事情嗎?

相關內容