Skip to content

autoref sometimes fails, a fix #311

Open
@ouboub

Description

@ouboub

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions