texlive[72364] Master/texmf-dist: reptheorem (23sep24)
commits+karl at tug.org
commits+karl at tug.org
Mon Sep 23 23:20:44 CEST 2024
Revision: 72364
https://tug.org/svn/texlive?view=revision&revision=72364
Author: karl
Date: 2024-09-23 23:20:44 +0200 (Mon, 23 Sep 2024)
Log Message:
-----------
reptheorem (23sep24)
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-09-23 21:20:32 UTC (rev 72363)
+++ trunk/Master/texmf-dist/source/latex/reptheorem/reptheorem.dtx 2024-09-23 21:20:44 UTC (rev 72364)
@@ -89,7 +89,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: reptheorem 2024-08-12 v1.1}
+\Msg{* Package: reptheorem 2024-09-22 v1.2}
\Msg{************************************************************************}
\keepsilent
@@ -199,7 +199,7 @@
% \date{\filedate}
%
% \maketitle
-%
+%^^A
% \begin{abstract}
% \noindent When writing a large manuscript, it is sometimes
% beneficial to repeat a theorem (or lemma or \dots) at
@@ -211,21 +211,21 @@
% of the |.aux| file, and also introduces its own file
% extension, |.thm|, to replicate theorems in other files.
% \end{abstract}
-%
+%^^A
% \tableofcontents
-%
+%^^A
%\changes{v1.0}{2024-03-27}{First public release}
-%
-%
-%
+%^^A
+%^^A
+%^^A
%\StopEventually{^^A
% \PrintChanges
% \PrintIndex
%}
-%
-%
-%
-%
+%^^A
+%^^A
+%^^A
+%^^A
% \section{Repeating theorems}
% Let's say we define a theorem as follows:
% \begin{verbatim}
@@ -257,24 +257,21 @@
% difference is that we have saved the theorem for later use.\par
% The |makethm| environment takes two mandatory arguments
% and one optional one. The first mandatory argument is the
-% type of theorem environment, like |theorem|, |lemma|,
+% type of theorem environment as defined in \textsf{amsthm}, like |theorem|, |lemma|,
% |definition|, etc. The second is the theorem's label.
-% The label is mandatory because to replicate the theorem,
+% The label is mandatory since, to replicate the theorem,
% we need to have a ``name'' attached to it. |makethm|
% automatically attaches a |\label|, as well, so |\ref{thm:Yoneda}|
% becomes \ref{thm:Yoneda}. The optional argument is passed
% right to the optional argument of the theorem environment,
-% giving the name of a theorem\par
-%
+% giving the theorem a name.\par
+%^^A
% Now let's say we want to replicate the theorem later
% or earlier in the text. This may be done if, for example,
% 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.
-% \begin{verbatim}
-% \repthm{thm:Yoneda}
-% \end{verbatim}
+% \DescribeMacro{\repthm} |\repthm| command: |\repthm{thm:Yoneda}|.
% This outputs the theorem again.
% \repthm{thm:Yoneda}
% The label of this theorem is a |\ref|, and automatically
@@ -285,20 +282,23 @@
% only displays if the theorem is undefined. For example,
% |\repthm{thm:foo}[bar]| returns
% \repthm{thm:foo}[bar]
-% If we do the same without providing an alt text, we get
+% \noindent If we do the same without providing an alt text, we get
% \repthm{thm:foo}
-% together with a warning.\par
+% \noindent together with a warning: ``Package \textsf{reptheorem}: Theorem |thm:foo|
+% 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.''\par
% Since we're using the |.aux| file, it is possible
% to replicate a theorem before it is stated. For example,
% \begin{verbatim}
% \repthm{thm:later}
-% \begin{makethm}{theorem}{thm:later}[Later]
+% \begin{makethm}{theorem}{thm:later}
% Alligator!
% \end{makethm}
% \end{verbatim}
% returns
% \repthm{thm:later}
-% \begin{makethm}{theorem}{thm:later}[Later]
+% \begin{makethm}{theorem}{thm:later}
% Alligator
% \end{makethm}
% Note that it is necessary to run a |.tex| file twice
@@ -305,7 +305,7 @@
% to replicate theorems ahead of time, similarly to
% how one has to run a file twice to make sure the
% references are correct.\par
-%
+%^^A
% \section{Replicating theorems between files}
% Let's say we have the following files for our project:
% \begin{verbatim}
@@ -328,7 +328,7 @@
% In our example, if we also defined a |thm:baz| in |foo.tex|,
% loading |bar.thm| into |foo.tex| will not overwrite the local
% |thm:baz|.
-%
+%^^A
% \subsection{Replicating theorems to subfiles}
% Replicating theorems to different files is particularly
% useful when working in big documents with multiple subfiles.
@@ -346,15 +346,14 @@
% |foo.tex| and |bar.tex|. This will allow us to
% use all theorems in the final |main.tex| in each of
% the subfiles.
-%
-%
-%
+%^^A
+%^^A
+%^^A
% \section{Source code}
% \begin{macrocode}
%<*package>
-\ProvidesPackage{reptheorem}[2024-08-12 v1.1 Reptheorem package]
+\ProvidesPackage{reptheorem}[2024-09-22 v1.2 Reptheorem package]
% \end{macrocode}
-%
% \begin{macro}{\theoremfile}
% Using |\theoremfile| will output all saved theorems into an output file.
% By default, if your \LaTeX file is |foo.tex|, the output file is |foo.thm|.
@@ -369,7 +368,6 @@
}
% \end{macrocode}
% \end{macro}
-%
% \begin{macro}{\loadtheorems}
% If you have exported saved theorems to a file, you can load them
% into another file using the macro |\loadtheorems|.
@@ -385,9 +383,11 @@
}
% \end{macrocode}
% \end{macro}
-%
% \begin{environment}{makethm}
% \changes{v1.1}{2024/05/03}{Now saves theorem environment type, breaking backwards compatibility}
+% \changes{v1.2}{2024/09/21}{Environment end moved to fix vertical spacing.}
+% \changes{v1.2}{2024/09/22}{Theorem name is only saved if it exists.}
+% \changes{v1.2}{2024/09/22}{Renamed theorem output variable to be unique for each theorem.}
% On to defining the actual theorems to be saved.
% \begin{macrocode}
\NewDocumentEnvironment{makethm}{ m m o +b }
@@ -402,39 +402,42 @@
}{
\begin{#1}\label{#2}
}
- #4
+ % \begin{theorem}
+ #4
+ \expandafter\gdef\csname thmtype@#2\endcsname{#1}%
+ \expandafter\long\expandafter\gdef\csname thm@#2\endcsname{#4}%
+ \IfValueT{#3}{% Only save theorem name if it exists
+ \expandafter\gdef\csname thmdesc@#2\endcsname{#3}%
+ }
+ % Saving parameters to aux file
+ \expandafter\long\expandafter\gdef\csname thmoutput@#2\endcsname{%
+ \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}%
+ \IfValueT{#3}{
+ ^^J%
+ \string\expandafter\string\gdef\noexpand%
+ \csname thmdesc@#2\string\endcsname{#3}%
+ }
+ }
+ \write\@auxout{\csname thmoutput@#2\endcsname}
+ \if\reptheorem at theoremfile\relax
+ % No file has been set
+ \else
+ % We have a theorem file
+ % Saving parameters to theorem file
+ \write\@thmlist{\csname thmoutput@#2\endcsname}
+ \fi
\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\gdef\noexpand%
- \csname thmdesc@#2\string\endcsname{#3}%
- }
- \write\@auxout{\@thmoutput}
- \if\reptheorem at theoremfile\relax
- % No file has been set
- \else
- % We have a theorem file
- % Saving parameters to theorem file
- \write\@thmlist{\@thmoutput}
- \fi
}{}
% \end{macrocode}
% \end{environment}
-%
% \begin{macro}{\repthm}
% \changes{v1.1}{2024/05/03}{Now saves theorem environment type, breaking backwards compatibility}
+% \changes{v1.2}{2024/09/22}{Fixed bug where theorems got a name even if undefined.}
% 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 +o }{
@@ -455,18 +458,17 @@
%
\ifcsname thm@#1\endcsname% Check if theorem is even defined
% Theorem is defined
- \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{\@@thmtype}[\@@thmdesc]
+ \ifcsname thmdesc@#1\endcsname % Check if theorem has name
+ \begin{\@@thmtype}[\csname thmdesc@#1\endcsname]
\@@thm
\end{\@@thmtype}
- }{% No optionals
+ \else % No optionals
\begin{\@@thmtype}
\@@thm
\end{\@@thmtype}
- }
+ \fi
\else
% Theorem undefined
\IfValueTF{#2}{
@@ -490,8 +492,6 @@
}
% \end{macrocode}
% \end{macro}
-
-
% \begin{macrocode}
%</package>
% \end{macrocode}
Modified: trunk/Master/texmf-dist/source/latex/reptheorem/reptheorem.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/reptheorem/reptheorem.ins 2024-09-23 21:20:32 UTC (rev 72363)
+++ trunk/Master/texmf-dist/source/latex/reptheorem/reptheorem.ins 2024-09-23 21:20:44 UTC (rev 72364)
@@ -18,7 +18,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
@@ -27,7 +27,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: reptheorem 2024-08-12 v1.1}
+\Msg{* Package: reptheorem 2024-09-22 v1.2}
\Msg{************************************************************************}
\keepsilent
@@ -47,7 +47,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
Modified: trunk/Master/texmf-dist/tex/latex/reptheorem/reptheorem.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/reptheorem/reptheorem.sty 2024-09-23 21:20:32 UTC (rev 72363)
+++ trunk/Master/texmf-dist/tex/latex/reptheorem/reptheorem.sty 2024-09-23 21:20:44 UTC (rev 72364)
@@ -18,7 +18,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
@@ -25,7 +25,7 @@
%% reptheorem.sty, reptheorem.pdf, reptheorem.ins
%%
-\ProvidesPackage{reptheorem}[2024-08-12 v1.1 Reptheorem package]
+\ProvidesPackage{reptheorem}[2024-09-22 v1.2 Reptheorem package]
\def\reptheorem at theoremfile{\relax}
\NewDocumentCommand{\theoremfile}{ O{\jobname.thm} }{
\def\reptheorem at theoremfile{#1}
@@ -49,25 +49,29 @@
\begin{#1}\label{#2}
}
#4
-\end{#1}
-\expandafter\gdef\csname thmtype@#2\endcsname{#1}
+\expandafter\gdef\csname thmtype@#2\endcsname{#1}%
\expandafter\long\expandafter\gdef\csname thm@#2\endcsname{#4}%
+\IfValueT{#3}{% Only save theorem name if it exists
\expandafter\gdef\csname thmdesc@#2\endcsname{#3}%
-\long\gdef\@thmoutput{%
+}
+\expandafter\long\expandafter\gdef\csname thmoutput@#2\endcsname{%
\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}%
+\IfValueT{#3}{
^^J%
\string\expandafter\string\gdef\noexpand%
\csname thmdesc@#2\string\endcsname{#3}%
}
-\write\@auxout{\@thmoutput}
+}
+\write\@auxout{\csname thmoutput@#2\endcsname}
\if\reptheorem at theoremfile\relax
\else
-\write\@thmlist{\@thmoutput}
+\write\@thmlist{\csname thmoutput@#2\endcsname}
\fi
+\end{#1}
}{}
\newcounter{old at counter}
\NewDocumentCommand{\repthm}{ m +o }{
@@ -81,17 +85,16 @@
\def\thetheorem{\ref{#1}}
\let\@@theoremnotdefined\relax
\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{\@@thmtype}[\@@thmdesc]
+\ifcsname thmdesc@#1\endcsname % Check if theorem has name
+\begin{\@@thmtype}[\csname thmdesc@#1\endcsname]
\@@thm
\end{\@@thmtype}
-}{% No optionals
+\else % No optionals
\begin{\@@thmtype}
\@@thm
\end{\@@thmtype}
-}
+\fi
\else
\IfValueTF{#2}{
\begin{\@@thmtype}
@@ -111,7 +114,6 @@
\setcounter{\@@thmtype}{\value{old at counter}}
\endgroup
}
-
\endinput
%%
%% End of file `reptheorem.sty'.
More information about the tex-live-commits
mailing list.