summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/atendofenv
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-02-25 03:00:58 +0000
committerNorbert Preining <norbert@preining.info>2022-02-25 03:00:58 +0000
commit157cc9e776520d0b7d488317a69a10d4ae4d493b (patch)
treec12e70126efbe1e6c930d2e26223a004b075306e /macros/latex/contrib/atendofenv
parentdc88afec77f198ebb8774f9c87146f2985e8f156 (diff)
CTAN sync 202202250300
Diffstat (limited to 'macros/latex/contrib/atendofenv')
-rw-r--r--macros/latex/contrib/atendofenv/atendofenv.dtx25
-rw-r--r--macros/latex/contrib/atendofenv/atendofenv.pdfbin0 -> 90063 bytes
2 files changed, 22 insertions, 3 deletions
diff --git a/macros/latex/contrib/atendofenv/atendofenv.dtx b/macros/latex/contrib/atendofenv/atendofenv.dtx
index 161db37603..f01d321214 100644
--- a/macros/latex/contrib/atendofenv/atendofenv.dtx
+++ b/macros/latex/contrib/atendofenv/atendofenv.dtx
@@ -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@old#1\endcsname\relax
+ \else
\expandafter\LetLtxMacro\csname aeoe@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@oldend#1\endcsname\relax
+ \else
\expandafter\LetLtxMacro\csname aeoe@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}
diff --git a/macros/latex/contrib/atendofenv/atendofenv.pdf b/macros/latex/contrib/atendofenv/atendofenv.pdf
new file mode 100644
index 0000000000..0ed7cecd1d
--- /dev/null
+++ b/macros/latex/contrib/atendofenv/atendofenv.pdf
Binary files differ