1

The following code cannot correctly produce the external .pdf file of the tikzpicture. Removing any of \usepackage{amsthm}, \usepackage{lastpage}, \usepackage{hyperref} solves the issue: the auxiliary .pdf file is correctly produced. Removing \tikzexternalize also solves the problem, because no externalization process is involved.

\documentclass{article}
\usepackage{amsthm}
\usepackage{lastpage}
\usepackage{hyperref}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize

\begin{document}
        \begin{tikzpicture}
        \draw (0,0) --(1,1);
        \end{tikzpicture}
\end{document}

The .log file of the external compilation contains the following

! Argument of \Hy@temp has an extra }.
<inserted text> 
                \par 
l.62 \end{document}

I've also tried to swap the order of the packages, with no result. What can be causing this problem?

6
  • I put hyperref last and got no errors (other than never having gotten \tikzexternalize to work on my system). Nov 28, 2017 at 15:05
  • What's the exact order you used? I can't make it work :(
    – Rackbox
    Nov 28, 2017 at 15:09
  • I just moved hypperref after \tikzexternalize. BTW, of the packages used \Hy@temp only shows up in hyperref (of course) and lastpage. Nov 28, 2017 at 15:12
  • I can't make it work... Are you sure you deleted the previously created external .pdf? If a previous compilation successfully created the file, then the next compilations will re-use it without trying to generate it again.
    – Rackbox
    Nov 28, 2017 at 15:24
  • 1
    I use standalone and \includegraphics instead. Externalize will never be any faster, just more convenient. Nov 28, 2017 at 16:58

1 Answer 1

2

Some packages are just incompatible with externalization, see section 50.8.2 in the TikZ/PGF manual.

\documentclass{article}
\usepackage{amsthm}

\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize

\tikzifexternalizing{}{
  \usepackage{lastpage}
  \usepackage{hyperref}
}

\begin{document}

\begin{tikzpicture}
\draw (0,0) --(1,1);
\end{tikzpicture}

\end{document}
2
  • 1
    If you don't control whats included, you could issue \usepackage{cleveref} to fix it miraculously, as suggested here tex.stackexchange.com/questions/538748/…
    – hefe
    Apr 16, 2020 at 14:44
  • \usepackage{cleveref} --> I do not know why it works, but it works. May 27, 2021 at 19:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .