The theorem patch does the following:
|
\@ifpackageloaded{cleveref} |
|
{\AddToHook{cmd/@thm/before}{\ifhmode\unskip\fi}} |
|
{% |
|
\ifpatchable\@thm{\refstepcounter} |
|
{\patchcmd\@thm{\refstepcounter}{\Hy@theorem@refstepcounter}{}{}} |
|
{}% |
|
}}}{} |
If cleveref is loaded, it hooks some spacing stuff in there. I guess it's because cleveref with amsthm loaded redefines things with
\let\cref@thmnoarg\@thm%
\def\@thm{\@ifnextchar[{\cref@thmoptarg}{\cref@thmnoarg}}%]
Or maybe there's another reason I don't understand.
Anyway, what I'm confused about is the \refstepcounter patch in \@thm. If cleveref is loaded, then this patch isn't being done at all, but why not?
Patching \@thm no longer works, but patching \cref@thmnoarg seems like it does.
For completeness, \cref@thmoptarg should probably also be patched then, but that would probably also require a variant of \Hy@theorem@refstepcounter with an optional argument, like \cref@thmoptarg wants to use it.
I guess this might be related to #336 and latex3/latex2e#1779. And perhaps amsthm should just be improved like latex3/latex2e#1301, instead of piling more patches on top of each other for this package combination.
The theorem patch does the following:
hyperref/hyperref.dtx
Lines 11129 to 11135 in d2eb2fa
If cleveref is loaded, it hooks some spacing stuff in there. I guess it's because cleveref with amsthm loaded redefines things with
Or maybe there's another reason I don't understand.
Anyway, what I'm confused about is the
\refstepcounterpatch in\@thm. If cleveref is loaded, then this patch isn't being done at all, but why not?Patching
\@thmno longer works, but patching\cref@thmnoargseems like it does.For completeness,
\cref@thmoptargshould probably also be patched then, but that would probably also require a variant of\Hy@theorem@refstepcounterwith an optional argument, like\cref@thmoptargwants to use it.I guess this might be related to #336 and latex3/latex2e#1779. And perhaps amsthm should just be improved like latex3/latex2e#1301, instead of piling more patches on top of each other for this package combination.