summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/thmtools/aliasctr.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/thmtools/aliasctr.dtx')
-rw-r--r--Master/texmf-dist/source/latex/thmtools/aliasctr.dtx20
1 files changed, 17 insertions, 3 deletions
diff --git a/Master/texmf-dist/source/latex/thmtools/aliasctr.dtx b/Master/texmf-dist/source/latex/thmtools/aliasctr.dtx
index 3c75e11c98e..2d88038c083 100644
--- a/Master/texmf-dist/source/latex/thmtools/aliasctr.dtx
+++ b/Master/texmf-dist/source/latex/thmtools/aliasctr.dtx
@@ -79,7 +79,7 @@
\csname ##2\endcsname
}%
\@ifundefined{c@#2}{\@nocounterr{#2}}{%
- \@ifdefinable{c@#1}{%
+ \expandafter\@ifdefinable\csname c@#1\endcsname{%
% \end{macrocode}
% Four values make a counter foo:
% \begin{itemize}
@@ -93,10 +93,24 @@
\@@gletover{c@#1}{c@#2}%
\@@gletover{the#1}{the#2}%
% \end{macrocode}
-% I don't see \@counteralias being called hundreds of times,
-% let's just unconditionally create |\theHctr|-macros for hyperref.
+% I don't see |\@counteralias| being called hundreds of times,
+% let's just unconditionally create |\theHctr|-macros for \pkg{hyperref}.
% \begin{macrocode}
\@@gletover{theH#1}{theH#2}%
+% \end{macrocode}
+% YkC: Compatibility with \pkg{cleveref}, copied from \pkg{cleveref}'s
+% support for \pkg{aliascnt}.
+% Here |\cref@resetby| requires its first argument to be the actual counter
+% name, not a macro storing the name. Thanks to Willie Wong.
+% \begin{macrocode}
+ \@ifpackageloaded{cleveref}{%
+ \edef\aliasctr@temp{%
+ \noexpand\cref@resetby{#2}{\noexpand\cref@result}}%
+ \aliasctr@temp
+ \ifx\cref@result\relax\else%
+ \cref@addtoreset{#1}{\cref@result}%
+ \fi
+ }{}%
\@@gletover{p@#1}{p@#2}%
\expandafter\global
\expandafter\def\csname cl@#1\expandafter\endcsname