diff options
author | Karl Berry <karl@freefriends.org> | 2024-08-12 20:05:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-08-12 20:05:08 +0000 |
commit | 3813d3125c5806f80c3c784d6d5c6dbf962f29ea (patch) | |
tree | 831d99f8c0388286bafbc955f780abd1a526ce3b /Master/texmf-dist/tex/latex/reptheorem | |
parent | 455d9a89b7f9390a32880fab2d4072ed0150c2cc (diff) |
reptheorem (12aug24)
git-svn-id: svn://tug.org/texlive/trunk@72017 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/reptheorem')
-rw-r--r-- | Master/texmf-dist/tex/latex/reptheorem/reptheorem.sty | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/Master/texmf-dist/tex/latex/reptheorem/reptheorem.sty b/Master/texmf-dist/tex/latex/reptheorem/reptheorem.sty index 2d12f462221..8faae5eb735 100644 --- a/Master/texmf-dist/tex/latex/reptheorem/reptheorem.sty +++ b/Master/texmf-dist/tex/latex/reptheorem/reptheorem.sty @@ -25,7 +25,7 @@ %% reptheorem.sty, reptheorem.pdf, reptheorem.ins %% -\ProvidesPackage{reptheorem}[2024-03-27 v1.0 Reptheorem package] +\ProvidesPackage{reptheorem}[2024-08-12 v1.1 Reptheorem package] \def\reptheorem@theoremfile{\relax} \NewDocumentCommand{\theoremfile}{ O{\jobname.thm} }{ \def\reptheorem@theoremfile{#1} @@ -50,14 +50,18 @@ File #1 not found. I will not import any theorems.% } #4 \end{#1} +\expandafter\gdef\csname thmtype@#2\endcsname{#1} \expandafter\long\expandafter\gdef\csname thm@#2\endcsname{#4}% \expandafter\gdef\csname thmdesc@#2\endcsname{#3}% \long\gdef\@thmoutput{% +\string\expandafter\string\gdef\noexpand% +\csname thmtype@#2\string\endcsname{#1}% +^^J% \string\expandafter\string\long\string\expandafter% \string\gdef\noexpand\csname thm@#2\string\endcsname{#4}% ^^J% -\string\expandafter\string\expandafter% -\string\gdef\noexpand\csname thmdesc@#2\string\endcsname{#3}% +\string\expandafter\string\gdef\noexpand% +\csname thmdesc@#2\string\endcsname{#3}% } \write\@auxout{\@thmoutput} \if\reptheorem@theoremfile\relax @@ -66,40 +70,45 @@ File #1 not found. I will not import any theorems.% \fi }{} \newcounter{old@counter} -\NewDocumentCommand{\repthm}{ m m +o }{ +\NewDocumentCommand{\repthm}{ m +o }{ \begingroup -\setcounter{old@counter}{\value{#1}} - \def\thetheorem{\ref{#2}} +\ifcsname thmtype@#1\endcsname% +\expandafter\let\expandafter\@@thmtype\csname thmtype@#1\endcsname% +\else% +\def\@@thmtype{theorem}% +\fi% +\setcounter{old@counter}{\value{\@@thmtype}} + \def\thetheorem{\ref{#1}} \let\@@theoremnotdefined\relax -\ifcsname thm@#2\endcsname% Check if theorem is even defined -\expandafter\edef\expandafter\@@thmdesc{\csname thmdesc@#2\endcsname}% -\expandafter\let\expandafter\@@thm\csname thm@#2\endcsname +\ifcsname thm@#1\endcsname% Check if theorem is even defined +\expandafter\edef\expandafter\@@thmdesc{\csname thmdesc@#1\endcsname}% +\expandafter\let\expandafter\@@thm\csname thm@#1\endcsname \IfValueTF{\@@thmdesc}{% Check if theorem has name -\begin{#1}[\@@thmdesc] +\begin{\@@thmtype}[\@@thmdesc] \@@thm -\end{#1} +\end{\@@thmtype} }{% No optionals -\begin{#1} +\begin{\@@thmtype} \@@thm -\end{#1} +\end{\@@thmtype} } \else -\IfValueTF{#3}{ -\begin{#1} -#3 -\end{#1} +\IfValueTF{#2}{ +\begin{\@@thmtype} +#2 +\end{\@@thmtype} }{% No theorem or alt text provided: throw warning -\begin{#1} -\end{#1} +\begin{\@@thmtype} +\end{\@@thmtype} \PackageWarning{reptheorem}{% -Theorem #2 not defined; rebuild your project. +Theorem #1 not defined; rebuild your project. If the issue persists, create the theorem using \begin{makethm} or consider adding alt text to \repthm using the optional parameter% } } \fi -\setcounter{#1}{\value{old@counter}} +\setcounter{\@@thmtype}{\value{old@counter}} \endgroup } |