TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have started using the tikz externalization library for my current project. From here I learned to use
\pgfplotsset{invoke before crossref tikzpicture={\tikzexternaldisable},invoke after crossref tikzpicture={\tikzexternalenable}}
to have correct referencing of my pictures. This works for 15 out of 18 figures. For some reason, it does not for the last 3. Does anyone have an idea about why?

I'm not sure how to produce an MWE here, so here is my log file.

All my figures come from Matlab. I used matlab2tikz to produce .tikz files that I include in my .tex document. I have done 2 kinds of simulations with various parameters and for some reason, only the figures to my second experiment are affected. Maybe because the files are bigger?

There are no errors, only the warnings about undefined references. Of course, I tried recompiling several times - without success. I deleted the externalized figures and had them recreated - nothing.

I know about mode=list and make, but this produced rotated plots, see here, so this is only an option once I know what causes this behavior.

Any suggestions?

share|improve this question

Sometimes I feel really stupid...
Turns out it was the cleveref package. Usually, you can use \cref{fig1,fig1} to get "figure 1 and 2". Somehow it cannot deal with externalization, so I have to use \cref{fig1} and \cfref{fig1}.
I wish I understood why this does not work, but at least I found it and a workaround.

share|improve this answer

Your Answer


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.