summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/thmtools/source/thmdef-thmbox.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/thmtools/source/thmdef-thmbox.dtx')
-rw-r--r--macros/latex/contrib/thmtools/source/thmdef-thmbox.dtx43
1 files changed, 43 insertions, 0 deletions
diff --git a/macros/latex/contrib/thmtools/source/thmdef-thmbox.dtx b/macros/latex/contrib/thmtools/source/thmdef-thmbox.dtx
new file mode 100644
index 0000000000..59409fd79e
--- /dev/null
+++ b/macros/latex/contrib/thmtools/source/thmdef-thmbox.dtx
@@ -0,0 +1,43 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2010-2014 by Ulrich M. Schwarz
+% Copyright (C) 2019 by Frank Mittelbach
+% Copyright (C) 2020- by Yukai Chou
+%
+% This file may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, version 1.3c.
+% The license can be obtained from
+% http://www.latex-project.org/lppl/lppl-1-3c.txt
+%
+%\fi
+%
+%\iffalse (hide this from DocInput)
+%<*thmbox>
+%\fi
+% The \pkg{thmbox} package does something else: instead of having a separate
+% environment, we have to use a command different from
+% |\newtheorem| to get the boxed style. Fortunately,
+% \thmtools stores the command as |\thmt@theoremdefiner|, so we
+% can modify it. (One of the perks if extension writer and framework writer
+% are the same person.) So, in contrast to the previous example, this time
+% we need to do something before the actual |\newtheorem| is
+% called.
+% \begin{macrocode}
+\define@key{thmdef}{thmbox}[L]{%
+ \thmt@trytwice{%
+ \let\oldproof=\proof
+ \let\oldendproof=\endproof
+ \let\oldexample=\example
+ \let\oldendexample=\endexample
+ \RequirePackage[nothm]{thmbox}
+ \let\proof=\oldproof
+ \let\endproof=\oldendproof
+ \let\example=\oldexample
+ \let\endexample=\oldendexample
+ \def\thmt@theoremdefiner{\newboxtheorem[#1]}%
+ }{}%
+}%
+% \end{macrocode}
+%\iffalse (hide this from DocInput)
+%</thmbox>
+%\fi