hyperref icon indicating copy to clipboard operation
hyperref copied to clipboard

`hyperref` with `bookmarks=true` and `tikzexternalize` clashes in edge cases

Open ORippler opened this issue 3 years ago • 1 comments

Hey,

After having faced the same issue as https://github.com/borisveytsman/acmart/issues/436 when writing a paper with \documentclass{IEEEtran}, I decided to see which packages are related to the issue, and found that it's an interaction between hyperref's booktabs feature and tikzexternalize of tikz

MWE

Consider the following MWE (thanks @JasonGross for producing this).

%\PassOptionsToPackage{bookmarks=false}{hyperref} % This fixes the problem
\documentclass{acmart}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{external}
\tikzexternalize
\begin{document}
\title{}
\begin{abstract} \end{abstract}
\maketitle
\section{XXXXXXXXX}\subsection{X XXXXXXXXXX XXXXXXX}\subsection{XXXXXXXX XX XXXXXXXXXXXXXXXXX XXXX}\subsection{XXX XXXXXXXX}
\section{XXXXXX XXXXXXXXXX XXX XXXXXXXXX}\subsection{XXX XXXXXXXX XX XXXX XXXXX}
\section{XXX XXXXXXXXX XX X XXXXXXXX}\subsection{XXXXXXXXXXXXXXXX XXXXXXXXXXX XXX XXXXXXXXXX}
\subsection{XXXXXX XXXXXXXXXXXX XXXXXXXX}
\section{XXXXXXX XXXXXXXXXX}\subsection{XXXXXXXX XXXXXXXXXXXX XXXX XX XXXXX}\subsection{XXXXXXX XXXXXXX XX XXXXXXX}
\subsection{XXXXX XXXX XXXX XXXXXXXXXX}\subsection{XXXX XXXXXXXXXX XXXX XXXXXXXX XXXXXXXXXXXXXX}
\subsection{XXXXXXXXXXX XXX XXXXXXXXXXXXX}
\section{XXXXXXXXXX}\subsection{XXXXXXXXXXXXXXX}
\begin{equation}\label{eq:equation}
    x+x^2
\end{equation}
\begin{tikzpicture}
    \begin{axis}
        \addplot [color=black,solid,line width=1.0pt,domain=0:1,samples=11]{x+x^2};
        \addlegendentry{Eq. \ref{eq:equation}};
    \end{axis}
\end{tikzpicture}
\subsubsection{XXXXXXXXX XXXXX XXXXXXX}\subsubsection{XXXXXXXXXXX XXXXXXXXXXX XX XXXXXXXXXXXXXXX XXXXXXXXX}
\subsubsection{XXXXXXX XXX XXXXXXXXX XXXXXXXXX}\subsubsection{XXXX XXXXXXXXX}\subsection{XXXXXXXXXXXXXXX XXXX XXXXXXXXXXXX}
\section{XXXXXXX XXXX}
\section{XXXXXX XXXX}
\end{document}

Compiling the above document with docker run --rm -it --volume "`pwd`:/workdir" -w "/workdir" --user `id -u`:`id -g` registry.gitlab.com/islandoftex/images/texlive:TL2021-2022-01-09-04-05 pdflatex -shell-escape test.tex fails, and the ref used inside the tikzpicture is never resolved. However, when providing \PassOptionsToPackage{bookmarks=false}{hyperref}, and thereby disabling the bookmarks functionality, the code compiles just fine and the ref is resolved properly.

Note that I also found the same clash to happen with \documentclass{IEEEtran}, which is why I guess that it's an interaction related between tikz and hyperref, rather than a problem with \documentclass{acmart}. Related package versions are,

Package: hyperref 2021-06-07 v7.00m
Package: tikz 2021/05/15 v3.1.9a (3.1.9a)

and full reproducibility should be given by the docker image. Since I don't know the exact interactions which cause the issue and how to best resolve them, I have also crossposted the Issue to [tikz}(https://github.com/pgf-tikz/pgf/issues/1127).

Best, ORippler

ORippler avatar Jan 14 '22 10:01 ORippler

I commented on the parallel pgf issue https://github.com/pgf-tikz/pgf/issues/1127#issuecomment-1013186888

u-fischer avatar Jan 14 '22 14:01 u-fischer