latex3 / latex3/hyperref

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

Open
#223 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
205
Forks
41
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the MWE in test.tex and reproduce it using the provided TeX Live Docker command. Compare compilation with bookmarks enabled and with PassOptionsToPackage disabling bookmarks, then investigate the hyperref and tikzexternalize interaction. Done means the reference resolves while bookmarks remain enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex
Domain
tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.