Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mathtools, amsart, appendix, autoref fails (fix of issue 311 does not work) #372

Open
ouboub opened this issue Dec 23, 2024 · 0 comments
Open

Comments

@ouboub
Copy link

ouboub commented Dec 23, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant