Theorem patch with cleveref and amsthm loaded
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 205
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
The theorem patch does the following:
https://github.com/latex3/hyperref/blob/d2eb2fae09eee648f81659613a37e3e45566e479/hyperref.dtx#L11129-L11135
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 https://github.com/latex3/latex2e/issues/1779. And perhaps amsthm should just be improved like https://github.com/latex3/latex2e/pull/1301, instead of piling more patches on top of each other for this package combination.
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 refstepcounter patch in hyperref.dtx at lines 11129-11135, then trace how cleveref with amsthm redefines @thm through cref@thmnoarg and cref@thmoptarg. Determine how both paths should receive the theorem patch, including the optional-argument case, and verify behavior for this package combination against the concerns in issues #336 and latex2e #1779.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- latex
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 44/100