3

After updating MiKTeX to solve another problem, I broke something because the following MWE is not generating an externalized pdf anymore.

\documentclass{report}

\usepackage{filecontents}
\usepackage{graphicx}
\usepackage{pgfplots}
\usepackage{tikzscale}
\usepackage{hyperref}

\graphicspath{{Figures/}}
\usepgfplotslibrary{external}
\tikzexternalize[prefix=Figures/]

\begin{document}

\begin{filecontents}{test.tikz}
  \begin{tikzpicture}
    \draw[very thick] (0,0) -- (1,0);
  \end{tikzpicture}
\end{filecontents}

\tikzsetnextfilename{test}
\includegraphics{test}

\end{document}

Compiling this MWE gives:

    The command '\includegraphics []{\tikzscale@fileName }' has been optimized away
. Use '/tikz/external/optimize=false' to disable this.

! Package tikz Error: Sorry, image externalization failed: the resulting image 
was EMPTY. I tried to externalize 'Figures/test', but it seems there is no such
image in the document!?  
   You are currently using 'mode=convert with system call'. This problem can ha
ppen if the image (or one of the images preceeding it) was declared inside of a
 \label{} (i.e. in the .aux file): 'convert with system call' has no access to 
the main aux file.
   Possible solutions in this case:
   (a) Try using 'mode=list and make',
   (b) Issue the externalization command 'pdflatex -shell-escape -halt-on-error
 -interaction=batchmode -jobname "Figures/test" "\def\tikzexternalrealjob{Thesi
s}\input{Thesis}"' *manually* (also check the preceeding externalized images, p
erhaps the file name sequence is not correct).
   Repeat: the resulting image was EMPTY, your attention is required .

When I leave out \usepackage{hyperref}, \graphicspath{..}, or [prefix=Figures/], it compiles normally. What could be the problem?

Bobyandbob
  • 4,899
Frsh
  • 31
  • Welcome! What are you trying to do exactly? This seems a tad confused, to be honest. You really shouldn't be using the filecontents environment in the middle of a document like that: if required, this should be place before \documentclass, in fact, with \RequirePackage{filecontents} as the first line if you are sure you want to use it. – cfr Aug 13 '15 at 00:31
  • Any updates here? Could you clearify your question? – Bobyandbob Dec 17 '17 at 19:42

0 Answers0