latex3 / latex3/hyperref

autoref sometimes fails, a fix

Open
#311 6 comments 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

Hi

The following MWE shows that (TL2023) autoref sometimes fails when used with mathtools and the showonlyrefs

\documentclass{article}
\usepackage{mathtools}
\mathtoolsset{showonlyrefs}
\usepackage[colorlinks]{hyperref}
\begin{document}
\section{Test}
\label{sec:test}
\begin{equation}
\label{eq:mathtools-autoref-solved:1}
  \int f dx =0
\end{equation}
\begin{equation}
\label{eq:mathtools-autoref-solved:2}
  a=b
\end{equation}
\subsection{Equation}
\label{sec:equation}
See  \autoref{eq:mathtools-autoref-solved:1} and \autoref{sec:test}
\subsection{Section}
\label{sec:section}
\autoref{sec:test}
\end{document}

a fix was proposed in fix

And consists in adding

\usepackage{xpatch}
\makeatletter
\xpretocmd\HyRef@autoref{\noeqref{#2}}{}{}% kleiner Hack
\makeatother

After \usepackage[colorlinks]{hyperref}

Could that this patch somehow be included in future releases of hyperref?

I will also open an issue on the mathtools github page.

Thanks

Uwe Brauer

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 by compiling the provided MWE with TL2023, mathtools, showonlyrefs, and hyperref, then inspect the \HyRef@autoref entry point. Compare the reported xpatch workaround against the failure and verify its compatibility. Done means a confirmed fix suitable for inclusion in a future hyperref release, with a regression case for the MWE.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex, tex
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.