Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm having an issue where only one out of multiple figures is recreated despite the use of the tikz/external library. I've created a MWE which shows the same effect with only two figures.

Below is my main file which is compiled with 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 link to the whole directory structure, including the .tex, .tikz and .dat files.

I've found that if I keep only one addplot, the figure is not re-created. I was wondering whether this is a bug, whether LaTeX is confused by my directory structure, or whether it's simply a mistake on my part.

share|improve this question
2  
Welcome to TeX.SX. –  Papiro Jul 14 '13 at 16:53
2  
Is this really a MWE, do you need all those packages to reproduce the problem? –  Miguel de Val-Borro Jul 14 '13 at 18:35
    
I left it this way in case there was a package incompatibility issue. –  sudosensei Jul 14 '13 at 19:29

1 Answer 1

up vote 1 down vote accepted

With my very limited LaTeX knowledge, I decided to inspect the log file (file.log) to try to identify what went wrong. I noticed that right after the convert command that causes the picture to be re-generated, there was an error of this sort:

Overfull \hbox (17.03157pt too wide) in paragraph at lines 1--76
 [][] 
 []

This led me to believe that tikzscale was not capable of scaling the picture to the exact size I requested, and this caused a mismatch between what tikzscale thought the size of the picture was and what it actually was. So what I did was follow the instructions listed in this answer to remove the whitespace from around the x and y labels (basically try to help tikzscale).

The problem is now fixed. The Overfull \hbox warning no longer appears and the picture is not re-generated every time. I do not know whether this is the expected behaviour or whether this is a bug though.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.