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?


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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