PierreSenellart / apxproof

LaTeX package for automatically putting proof environments in appendix
LaTeX Project Public License v1.3c
23 stars 8 forks source link

Constantly changing labels for amsart/acmart: #43

Closed JoeyEremondi closed 3 years ago

JoeyEremondi commented 3 years ago

If I try to use apxproof with the amsart or acmart document classes, each time the file is compiled, a label is changed, causing LaTeX to issue the "Label(s) may have changed" warning. This is a problem, because some editors use this to determine whether they should run latex again, and will either infinitely loop, or exit with a "too many runs" error.

The issue seems to be the tocindent1 label, but I have no idea what this is or why it's changed.

MWE:

\documentclass{amsart}

\usepackage{apxproof}
\newtheoremrep{theorem}{Theorem}

% detect what changed, see https://tex.stackexchange.com/questions/154594/how-to-diagnose-a-permanent-labels-may-have-changed-warning
\makeatletter
\def\@testdef #1#2#3{%
\def\reserved@a{#3}\expandafter \ifx \csname #1@#2\endcsname
\reserved@a  \else
\typeout{^^Jlabel #2 changed:^^J%
\meaning\reserved@a^^J%
\expandafter\meaning\csname #1@#2\endcsname^^J}%
\@tempswatrue \fi}

\begin{document}

\section{One}
Content

\begin{theoremrep}[Some theorem]
  The  statement
\end{theoremrep}
\begin{proof}
  The proof
\end{proof}

\appendix

\end{document}
\endinput

Each run, this gives:

label tocindent1 changed:
macro:->4.185pt
macro:->6.25499pt
...
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
PierreSenellart commented 3 years ago

Thanks for the detailed bug report! This was due to amsart setting the tocindent counters at the end of the document using \AtEndDocument, which was executed before the appendix was processed by apxproof. The appendix is now (in 956dcd7) processed before any pre-existing code in the \@enddocumenthook, which fixes the issue (also for acmart, which is just based on amsart).

Please confirm the new version in the develop branch at https://raw.githubusercontent.com/PierreSenellart/apxproof/develop/apxproof.sty fixes your issue. If so, I will do a new release.

PierreSenellart commented 3 years ago

Closing this issue as the problem seems to be resolved. A new release (1.2.2) integrating the fix should be published soon.