texlive[72017] Master/texmf-dist: reptheorem (12aug24)
commits+karl at tug.org
commits+karl at tug.org
Mon Aug 12 22:05:08 CEST 2024
Revision: 72017
https://tug.org/svn/texlive?view=revision&revision=72017
Author: karl
Date: 2024-08-12 22:05:08 +0200 (Mon, 12 Aug 2024)
Log Message:
-----------
reptheorem (12aug24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/reptheorem/reptheorem.pdf
trunk/Master/texmf-dist/source/latex/reptheorem/reptheorem.dtx
trunk/Master/texmf-dist/source/latex/reptheorem/reptheorem.ins
trunk/Master/texmf-dist/tex/latex/reptheorem/reptheorem.sty
Modified: trunk/Master/texmf-dist/doc/latex/reptheorem/reptheorem.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/reptheorem/reptheorem.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/reptheorem/reptheorem.dtx 2024-08-12 20:04:59 UTC (rev 72016)
+++ trunk/Master/texmf-dist/source/latex/reptheorem/reptheorem.dtx 2024-08-12 20:05:08 UTC (rev 72017)
@@ -12,7 +12,7 @@
%
% This work has the LPPL maintenance status `maintained'.
%
-% The Current Maintainer of this work is Jesse Sraat.
+% The Current Maintainer of this work is Jesse Straat.
%
% This work consists of the main file reptheorem.dtx
% and the derived files
@@ -89,7 +89,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: reptheorem 2024-03-27 v1.0}
+\Msg{* Package: reptheorem 2024-08-12 v1.1}
\Msg{************************************************************************}
\keepsilent
@@ -109,7 +109,7 @@
This work has the LPPL maintenance status `maintained'.
-The Current Maintainer of this work is Jesse Sraat.
+The Current Maintainer of this work is Jesse Straat.
This work consists of the main file reptheorem.dtx
and the derived files
@@ -246,9 +246,9 @@
% environment \DescribeEnv{makethm} |makethm| is
% used for.
% \begin{verbatim}
-% \begin{makethm}{theorem}{thm:Yoneda}[Yoneda Lemma]{
+% \begin{makethm}{theorem}{thm:Yoneda}[Yoneda Lemma]
% For \(F\colon \mathcal{C}\to \mathbf{Set}\) a functor,
-% \([\mathcal{C}^\mathrm{op},\mathbf{Set}](YA, F) \cong F(A)\)%
+% \([\mathcal{C}^\mathrm{op},\mathbf{Set}](YA, F) \cong F(A)\)
% for all objects \(A\) in \(\mathcal{C}\).
% \end{makethm}
% \end{verbatim}
@@ -271,12 +271,12 @@
% the theorem is proven at a later point, or we want to
% ``tease'' the reader with a powerful theorem that will be
% proven later in the chapter. To do this, we use the
-% \DescribeMacro{repthm} command, as follows.
+% \DescribeMacro{\repthm} command, as follows.
% \begin{verbatim}
-% \repthm{theorem}{thm:Yoneda}
+% \repthm{thm:Yoneda}
% \end{verbatim}
% This outputs the theorem again.
-% \repthm{theorem}{thm:Yoneda}
+% \repthm{thm:Yoneda}
% The label of this theorem is a |\ref|, and automatically
% links to the original theorem statement.\par
% If the original theorem statement exists in a different
@@ -283,21 +283,21 @@
% file, or has not been created yet, we can add a placeholder
% alt text to the |\repthm| as an optional argument, which
% only displays if the theorem is undefined. For example,
-% |\repthm{theorem}{thm:foo}[bar]| returns
-% \repthm{theorem}{thm:foo}[bar]
+% |\repthm{thm:foo}[bar]| returns
+% \repthm{thm:foo}[bar]
% If we do the same without providing an alt text, we get
-% \repthm{theorem}{thm:foo}
+% \repthm{thm:foo}
% together with a warning.\par
% Since we're using the |.aux| file, it is possible
% to replicate a theorem before it is stated. For example,
% \begin{verbatim}
-% \repthm{theorem}{thm:later}
+% \repthm{thm:later}
% \begin{makethm}{theorem}{thm:later}[Later]
% Alligator!
% \end{makethm}
% \end{verbatim}
% returns
-% \repthm{theorem}{thm:later}
+% \repthm{thm:later}
% \begin{makethm}{theorem}{thm:later}[Later]
% Alligator
% \end{makethm}
@@ -352,7 +352,7 @@
% \section{Source code}
% \begin{macrocode}
%<*package>
-\ProvidesPackage{reptheorem}[2024-03-27 v1.0 Reptheorem package]
+\ProvidesPackage{reptheorem}[2024-08-12 v1.1 Reptheorem package]
% \end{macrocode}
%
% \begin{macro}{\theoremfile}
@@ -387,6 +387,7 @@
% \end{macro}
%
% \begin{environment}{makethm}
+% \changes{v1.1}{2024/05/03}{Now saves theorem environment type, breaking backwards compatibility}
% On to defining the actual theorems to be saved.
% \begin{macrocode}
\NewDocumentEnvironment{makethm}{ m m o +b }
@@ -403,15 +404,19 @@
}
#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}%
% Saving parameters to aux file
\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 at theoremfile\relax
@@ -426,46 +431,53 @@
% \end{environment}
%
% \begin{macro}{\repthm}
+% \changes{v1.1}{2024/05/03}{Now saves theorem environment type, breaking backwards compatibility}
% To repeat a theorem, use the |\repthm| command.
% The type of theorem is not saved, so it is necessary to
% respecify it each time a theorem is repeated.
% \begin{macrocode}
\newcounter{old at counter}
-\NewDocumentCommand{\repthm}{ m m +o }{
- % m: the type of theorem environment
+\NewDocumentCommand{\repthm}{ m +o }{
% m: the name of the theorem
% o: alt text
\begingroup
- \setcounter{old at counter}{\value{#1}}
+ % Check if thmtype is given
+ \ifcsname thmtype@#1\endcsname%
+ \expandafter\let\expandafter\@@thmtype\csname thmtype@#1\endcsname%
+ \else%
+ \def\@@thmtype{theorem}%
+ \fi%
+ %
% Save theorem counter so we don't increase it
- \def\thetheorem{\ref{#2}}
+ \setcounter{old at counter}{\value{\@@thmtype}}
+ \def\thetheorem{\ref{#1}}
\let\@@theoremnotdefined\relax
%
- \ifcsname thm@#2\endcsname% Check if theorem is even defined
+ \ifcsname thm@#1\endcsname% Check if theorem is even defined
% Theorem is defined
- \expandafter\edef\expandafter\@@thmdesc{\csname thmdesc@#2\endcsname}%
- \expandafter\let\expandafter\@@thm\csname thm@#2\endcsname
+ \expandafter\edef\expandafter\@@thmdesc{\csname thmdesc@#1\endcsname}%
+ \expandafter\let\expandafter\@@thm\csname thm@#1\endcsname
% Output theorem
\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
% Theorem undefined
- \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%
@@ -472,7 +484,7 @@
}
}
\fi
- \setcounter{#1}{\value{old at counter}}
+ \setcounter{\@@thmtype}{\value{old at counter}}
% Reset theorem counter back to original
\endgroup
}
@@ -483,4 +495,4 @@
% \begin{macrocode}
%</package>
% \end{macrocode}
-%\Finale
+%\Finale
\ No newline at end of file
Modified: trunk/Master/texmf-dist/source/latex/reptheorem/reptheorem.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/reptheorem/reptheorem.ins 2024-08-12 20:04:59 UTC (rev 72016)
+++ trunk/Master/texmf-dist/source/latex/reptheorem/reptheorem.ins 2024-08-12 20:05:08 UTC (rev 72017)
@@ -27,7 +27,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: reptheorem 2024-03-27 v1.0}
+\Msg{* Package: reptheorem 2024-08-12 v1.1}
\Msg{************************************************************************}
\keepsilent
Modified: trunk/Master/texmf-dist/tex/latex/reptheorem/reptheorem.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/reptheorem/reptheorem.sty 2024-08-12 20:04:59 UTC (rev 72016)
+++ trunk/Master/texmf-dist/tex/latex/reptheorem/reptheorem.sty 2024-08-12 20:05:08 UTC (rev 72017)
@@ -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 at theoremfile{\relax}
\NewDocumentCommand{\theoremfile}{ O{\jobname.thm} }{
\def\reptheorem at theoremfile{#1}
@@ -50,14 +50,18 @@
}
#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 at theoremfile\relax
@@ -66,33 +70,38 @@
\fi
}{}
\newcounter{old at counter}
-\NewDocumentCommand{\repthm}{ m m +o }{
+\NewDocumentCommand{\repthm}{ m +o }{
\begingroup
-\setcounter{old at 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 at 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%
@@ -99,7 +108,7 @@
}
}
\fi
-\setcounter{#1}{\value{old at counter}}
+\setcounter{\@@thmtype}{\value{old at counter}}
\endgroup
}
More information about the tex-live-commits
mailing list.