texlive[62164] Master/texmf-dist: atendofenv (24feb22)

commits+karl at tug.org commits+karl at tug.org
Thu Feb 24 21:52:33 CET 2022


Revision: 62164
          http://tug.org/svn/texlive?view=revision&revision=62164
Author:   karl
Date:     2022-02-24 21:52:33 +0100 (Thu, 24 Feb 2022)
Log Message:
-----------
atendofenv (24feb22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/source/latex/atendofenv/atendofenv.dtx
    trunk/Master/texmf-dist/tex/latex/atendofenv/atendofenv.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/atendofenv/atendofenv.pdf

Added: trunk/Master/texmf-dist/doc/latex/atendofenv/atendofenv.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/atendofenv/atendofenv.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/atendofenv/atendofenv.pdf	2022-02-24 20:52:12 UTC (rev 62163)
+++ trunk/Master/texmf-dist/doc/latex/atendofenv/atendofenv.pdf	2022-02-24 20:52:33 UTC (rev 62164)

Property changes on: trunk/Master/texmf-dist/doc/latex/atendofenv/atendofenv.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/source/latex/atendofenv/atendofenv.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/atendofenv/atendofenv.dtx	2022-02-24 20:52:12 UTC (rev 62163)
+++ trunk/Master/texmf-dist/source/latex/atendofenv/atendofenv.dtx	2022-02-24 20:52:33 UTC (rev 62164)
@@ -27,7 +27,7 @@
 
 % \iffalse
 %<package>\NeedsTeXFormat{LaTeX2e}
-%<package>\ProvidesPackage{atendofenv}[2022/02/23 v0.1 Initial Version]
+%<package>\ProvidesPackage{atendofenv}[2022/02/24 v0.2 Prevent an infinite loop]
 %<package>\RequirePackage{amsthm}
 %<package>\RequirePackage{letltxmacro}
 %<*driver>
@@ -39,6 +39,7 @@
 \usepackage[a4paper, margin=3cm]{geometry}
 \usepackage{indentfirst}
 \usepackage[hidelinks]{hyperref}
+\usepackage{amssymb}
 \usepackage{atendofenv}
 \EnableCrossrefs
 \CodelineIndex
@@ -111,6 +112,16 @@
 %   This is a long theorem that will be very long, and it will be helpful if I
 %   can add a symbol at the end of it to mark its end.
 % \end{theorem}
+% You can also change the symbol later.
+% \AtEndOfEnv{theorem}{$\lrcorner$}
+% \begin{verbatim}
+% \AtEndOfEnv{theorem}{$\lrcorner$}
+% \end{verbatim}
+% Now theorems look like this:
+% \begin{theorem}
+%   This is a long theorem that will be very long, and it will be helpful if I
+%   can add a symbol at the end of it to mark its end.
+% \end{theorem}
 % \noindent
 % \textbf{Q:} \emph{But, couldn't I change tweak the style of theorems when defining them?}
 %
@@ -123,22 +134,30 @@
 \newcommand{\AtEndOfEnv}[2]{
 %    \end{macrocode}
 % We first check whether the environment is defined. If so, save the original
-% macros; otherwise report an error.
+% macros (if not saved already); otherwise report an error.
+% \changes{0.2}{2022/02/24}{Fix an infinite loop when trying to change the
+% symbol for the same environment twice.}
 %    \begin{macrocode}
   \ifcsname #1\endcsname
+    \ifcsname aeoe at old#1\endcsname\relax
+    \else
     \expandafter\LetLtxMacro\csname aeoe at old#1\expandafter\endcsname\csname #1\endcsname
+    \fi
   \else
     \PackageError{atendofenv}{Environment #1 undefined}{Check the environment
     name passed to AtEndOfEnv}
   \fi
   \ifcsname end#1\endcsname
+    \ifcsname aeoe at oldend#1\endcsname\relax
+    \else
     \expandafter\LetLtxMacro\csname aeoe at oldend#1\expandafter\endcsname\csname end#1\endcsname
+    \fi
   \else
     \PackageError{atendofenv}{Environment #1 undefined}{Check the environment
     name passed to AtEndOfEnv}
   \fi
 %    \end{macrocode}
-% Then we redefined the environment, and use the QED stack of \texttt{amsthm}
+% Then we redefine the environment, and use the QED stack of \texttt{amsthm}
 % to get a symbol at the end.
 %    \begin{macrocode}
   \renewenvironment{#1}

Modified: trunk/Master/texmf-dist/tex/latex/atendofenv/atendofenv.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/atendofenv/atendofenv.sty	2022-02-24 20:52:12 UTC (rev 62163)
+++ trunk/Master/texmf-dist/tex/latex/atendofenv/atendofenv.sty	2022-02-24 20:52:33 UTC (rev 62164)
@@ -33,18 +33,24 @@
 %% For more information, please refer to <https://unlicense.org>
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{atendofenv}[2022/02/23 v0.1 Initial Version]
+\ProvidesPackage{atendofenv}[2022/02/24 v0.2 Prevent an infinite loop]
 \RequirePackage{amsthm}
 \RequirePackage{letltxmacro}
 \newcommand{\AtEndOfEnv}[2]{
   \ifcsname #1\endcsname
+    \ifcsname aeoe at old#1\endcsname\relax
+    \else
     \expandafter\LetLtxMacro\csname aeoe at old#1\expandafter\endcsname\csname #1\endcsname
+    \fi
   \else
     \PackageError{atendofenv}{Environment #1 undefined}{Check the environment
     name passed to AtEndOfEnv}
   \fi
   \ifcsname end#1\endcsname
+    \ifcsname aeoe at oldend#1\endcsname\relax
+    \else
     \expandafter\LetLtxMacro\csname aeoe at oldend#1\expandafter\endcsname\csname end#1\endcsname
+    \fi
   \else
     \PackageError{atendofenv}{Environment #1 undefined}{Check the environment
     name passed to AtEndOfEnv}



More information about the tex-live-commits mailing list.