
라이브러리를 사용해도 여러 피규어 중 하나만 재생성되는 문제가 있습니다 tikz/external
. 저는 두 개의 수치만으로 동일한 효과를 보여주는 MWE를 만들었습니다.
아래는 pdflatex -shell-escape file
.
\documentclass{article}
\usepackage{tikz,pgfplots,tikzscale}
\usetikzlibrary{external}
\tikzexternalize[prefix=figures/]
\pgfplotsset{compat=newest}
\graphicspath{ {./figures/}{./figures-tikz/} }
\newcommand{\figFilename}{}
\begin{document}
\begin{figure}[t!]
\renewcommand{\figFilename}{scalability-plot-all-sbb-2-optima}
\centering
\tikzpicturedependsonfile{\figFilename.tikz}
\tikzsetnextfilename{\figFilename}
\includegraphics[width=\textwidth,axisratio=1]{\figFilename.tikz}
\caption{Scalability plot for dDE, MPC, dDE$^-$ and a hill climber on the Scalable-Building-Block problem.}
\label{fig:\figFilename}
\end{figure}
\begin{figure}[t!]
\renewcommand{\figFilename}{scalability-plot-all-sbb-2-optima-log-y}
\centering
\tikzpicturedependsonfile{\figFilename.tikz}
\tikzsetnextfilename{\figFilename}
\includegraphics[width=\textwidth,axisratio=1]{\figFilename.tikz}
\caption{Same as in Figure~\ref{fig:scalability-plot-all-sbb-2-optima}, but y axis is in logscale.}
\label{fig:\figFilename}
\end{figure}
\end{document}
The first figure is re-created every time I run pdflatex
. I tried changing the ordering of the two, but it does not make a difference --- the figure with the filename scalability-plot-all-sbb-2-optima
is the one that's always re-created even though the other figure is identical but with a semilogyaxis
instead. The TikZ
files for both are merely five addplot
commands which load data from five different .dat files. Showing everything here would take up a lot of space, so here's a 링크및 파일 .tex
을 포함한 전체 디렉토리 구조에 적용됩니다 ..tikz
.dat
addplot을 하나만 유지하면 그림이 다시 생성되지 않는 것으로 나타났습니다. 이것이 버그인지, LaTeX
내 디렉토리 구조로 인해 혼동된 것인지, 아니면 단순히 내 실수인지 궁금합니다.
답변1
file.log
나의 매우 제한된 LaTeX 지식으로 나는 무엇이 잘못되었는지 확인하기 위해 로그 파일( )을 검사하기로 결정했습니다 . 그림을 다시 생성하는 변환 명령 직후에 다음과 같은 오류가 발생하는 것을 확인했습니다.
Overfull \hbox (17.03157pt too wide) in paragraph at lines 1--76
[][]
[]
tikzscale
이로 인해 내가 요청한 정확한 크기로 사진의 크기를 조정할 수 없다고 믿게 되었고 , 이로 인해 tikzscale
사진의 크기라고 생각했던 것과 실제 크기 가 일치하지 않게 되었습니다.실제로였다. 그래서 제가 한 일은 다음에 나열된 지침을 따르는 것이었습니다.이것x 및 y 레이블 주위의 공백을 제거하려면 대답하십시오 (기본적으로 도움을 받으십시오 tikzscale
).
이제 문제가 해결되었습니다. 경고 Overfull \hbox
가 더 이상 나타나지 않으며 사진이 매번 다시 생성되지 않습니다. 이것이 예상된 동작인지 아니면 버그인지는 알 수 없습니다.