latex3 / latex2e

The LaTeX2e kernel
https://www.latex-project.org/
LaTeX Project Public License v1.3c
1.82k stars 251 forks source link

theorem and cleveref #1393

Open bdtc opened 1 week ago

bdtc commented 1 week ago

Brief outline of the bug

For a LaTeX \newtheorem ( not amsthm etc. ) cleveref used to print the reference as the theorem type and number (TeXLive 2023). Now it prints the section type and number instead.

This could be an issue with LaTeX \newtheorem or with the cleveref firstaid.

Minimal example showing the bug

\documentclass{article}

%\usepackage{amsthm}%   Works correctly with amsthm.

\usepackage{cleveref}

\newtheorem{defn}{Definition}[section]

\begin{document}

\section{First section}

\label{sec:first}

\begin{defn}
A definition.
\label{thm_defn}
\end{defn}

The reference is \cref{thm_defn}.

% With TeXLive 2023 this says "The reference is definition 1.1".
% With TeXLive 2024 this says "The reference is section 1".

\end{document}

Log file (required) and possibly PDF file

Attached (?)

bdtc commented 1 week ago

Well I don't see an attachment so here is the log:

This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024) (preloaded format=pdflatex 2024.6.16)  25 JUN 2024 05:35
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**crtest.tex
(./crtest.tex
LaTeX2e <2024-06-01> patch level 1
L3 programming layer <2024-05-27>
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls
Document Class: article 2024/02/08 v1.4n Standard LaTeX document class
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2024/02/08 v1.4n Standard LaTeX file (size option)
)
\c@part=\count194
\c@section=\count195
\c@subsection=\count196
\c@subsubsection=\count197
\c@paragraph=\count198
\c@subparagraph=\count199
\c@figure=\count266
\c@table=\count267
\abovecaptionskip=\skip49
\belowcaptionskip=\skip50
\bibindent=\dimen141
)
(/usr/local/texlive/2024/texmf-dist/tex/latex/cleveref/cleveref.sty
Package: cleveref 2018/03/27 v0.21.4 Intelligent cross-referencing
)
\c@defn=\count268

(/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def
File: l3backend-pdftex.def 2024-05-08 L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count269
\l__pdf_internal_box=\box52
)
(./crtest.aux)
\openout1 = `crtest.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 12.
LaTeX Font Info:    ... okay on input line 12.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 12.
LaTeX Font Info:    ... okay on input line 12.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 12.
LaTeX Font Info:    ... okay on input line 12.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 12.
LaTeX Font Info:    ... okay on input line 12.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 12.
LaTeX Font Info:    ... okay on input line 12.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 12.
LaTeX Font Info:    ... okay on input line 12.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 12.
LaTeX Font Info:    ... okay on input line 12.

[1

{/usr/local/texlive/2024/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./crtest.aux)
 ***********
LaTeX2e <2024-06-01> patch level 1
L3 programming layer <2024-05-27>
 ***********
 ) 
Here is how much of TeX's memory you used:
 2202 strings out of 473600
 47353 string characters out of 5728702
 1926905 words of memory out of 5000000
 25151 multiletter control sequences out of 15000+600000
 559328 words of font info for 40 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 44i,5n,50p,135b,159s stack positions out of 10000i,1000n,20000p,200000b,200000s
</usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb
></usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb>
</usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></
usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmti10.pfb>
Output written on crtest.pdf (1 page, 44736 bytes).
PDF statistics:
 28 PDF objects out of 1000 (max. 8388607)
 16 compressed objects within 1 object stream
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)
u-fischer commented 1 week ago

no it is not the firstaid. \@thm has been changed to improve support with hyperlinks and anchors. For this it no longer issues a \refstepcounter. And as cleveref patches \refstepcounter to inject its code, it can no longer update its data there. I will discuss if we can and should extend the firstaid to cover this. But please try to contact the author too.