summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-09-23 21:20:44 +0000
committerKarl Berry <karl@freefriends.org>2024-09-23 21:20:44 +0000
commit2c8ef1a7e988d2d3f86b1dcc03a0e06537d2c50c (patch)
tree293471edcfcc4a6334ba534462906a5e93844e5a /Master/texmf-dist/source/latex
parent5cbee2b8c9a2ee8756e2127adb0715640ab518a9 (diff)
reptheorem (23sep24)
git-svn-id: svn://tug.org/texlive/trunk@72364 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/reptheorem/reptheorem.dtx130
-rw-r--r--Master/texmf-dist/source/latex/reptheorem/reptheorem.ins6
2 files changed, 68 insertions, 68 deletions
diff --git a/Master/texmf-dist/source/latex/reptheorem/reptheorem.dtx b/Master/texmf-dist/source/latex/reptheorem/reptheorem.dtx
index b0f537af972..e26daf2f5a6 100644
--- a/Master/texmf-dist/source/latex/reptheorem/reptheorem.dtx
+++ b/Master/texmf-dist/source/latex/reptheorem/reptheorem.dtx
@@ -89,7 +89,7 @@ License: [LPPL1.3c](https://www.latex-project.org/lppl.txt)
\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 @@ colorlinks,
% \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 @@ colorlinks,
% 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 @@ colorlinks,
% 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,27 +282,30 @@ colorlinks,
% 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
% 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 @@ colorlinks,
% 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 @@ colorlinks,
% |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 @@ colorlinks,
}
% \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 @@ colorlinks,
}
% \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 @@ colorlinks,
}{
\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@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@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@counter}
\NewDocumentCommand{\repthm}{ m +o }{
@@ -455,18 +458,17 @@ colorlinks,
%
\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 @@ colorlinks,
}
% \end{macrocode}
% \end{macro}
-
-
% \begin{macrocode}
%</package>
% \end{macrocode}
diff --git a/Master/texmf-dist/source/latex/reptheorem/reptheorem.ins b/Master/texmf-dist/source/latex/reptheorem/reptheorem.ins
index be179b4d9a1..cf6d514b274 100644
--- a/Master/texmf-dist/source/latex/reptheorem/reptheorem.ins
+++ b/Master/texmf-dist/source/latex/reptheorem/reptheorem.ins
@@ -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 @@ version 2008 or later.
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