mathtools, amsart, appendix, autoref fails (fix of issue 311 does not work)
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 205
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
Hi
A year ago a fix (isseu 311) solved the problem concerning the interaction between autoref and mathtools,
However the fix fails for amsart together with appendix style as the following MWE shows
\documentclass[12pt,reqno]{amsart}
\usepackage{appendix}
\usepackage{amsmath,amsthm}
\usepackage{mathtools}
\mathtoolsset{showonlyrefs}
\usepackage[colorlinks]{hyperref}
\makeatletter
\AddToHook{package/mathtools/after}{%
\def\HyRef@autoref#1#2{%
\begingroup
\Hy@safe@activestrue
\@nameuse{MH_if_boolean:nT}{show_only_refs}{%
% excerpted from \noeqref in mathtools.sty
\edef\@tempa{#2}%
%% will be done in \HyRef@autosetref
% \@ifundefined{r@\@tempa}{%
% \protect\G@refundefinedtrue%
% \@latex@warning{Reference `\@tempa' on page \thepage \space
% undefined (\string\noeqref)}%
% }{}%
\if@filesw
\protected@write\@auxout{}{\string\MT@newlabel{\@tempa}}%
\fi
}%
\expandafter\HyRef@autosetref\csname r@#2\endcsname{#2}{#1}%
\endgroup
}
}
\makeatother
\newcommand\autoeqref[1]{\noeqref{#1}\autoref{#1}}
\begin{document}
\section{title}\label{sec:a}
\begin{appendices}
\begin{gather}
\int f dx = 0\label{eq:1} \\
\int f_2 dx = 0\label{eq:2} \\
\int f_3 dx = 0 \label{eq:3}
\end{gather}
% the most recent label before using \label{eq:1} is referenced
See \autoref{eq:1} does work
% this makes equation labeled "eq:2" numbered
See \eqref{eq:2} woks
\end{appendices}
\end{document}
Any idea how fix this problem?
Thanks
Uwe Brauer
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided minimal working example and compare it with issue 311. Inspect the interaction between mathtools.sty, the package/mathtools/after hook, \HyRef@autoref, and \HyRef@autosetref, including the \noeqref excerpt. Done means the example works with amsart, appendix, mathtools showonlyrefs, and autoref for the cited equations.
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