Debian Codegraph @

texmf-dist/source/latex/thmtools/thmdef-thmbox.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2010-2014 by Ulrich M. Schwarz
4 % Copyright (C) 2019 by Frank Mittelbach
5 % Copyright (C) 2020- by Yukai Chou
6 %
7 % This file may be distributed and/or modified under the conditions of
8 % the LaTeX Project Public License, version 1.3c.
9 % The license can be obtained from
10 % http://www.latex-project.org/lppl/lppl-1-3c.txt
11 %
12 %\fi
13 %
14 %\iffalse (hide this from DocInput)
15 %<*thmbox>
16 %\fi
17 % The \pkg{thmbox} package does something else: instead of having a separate
18 % environment, we have to use a command different from
19 % |\newtheorem| to get the boxed style. Fortunately,
20 % \thmtools stores the command as |\thmt@theoremdefiner|, so we
21 % can modify it. (One of the perks if extension writer and framework writer
22 % are the same person.) So, in contrast to the previous example, this time
23 % we need to do something before the actual |\newtheorem| is
24 % called.
25 % \begin{macrocode}
26 \define@key{thmdef}{thmbox}[L]{%
27 \thmt@trytwice{%
28 \let\oldproof=\proof
29 % backup \\proof, gh32
30 \expandafter\let\csname old\@backslashchar proof\expandafter\endcsname
31 \csname \@backslashchar proof\endcsname
32 \let\oldendproof=\endproof
33 \let\oldexample=\example
34 \let\oldendexample=\endexample
35 \RequirePackage[nothm]{thmbox}
36 \let\proof=\oldproof
37 % restore thmbox's change to \\proof, gh32
38 \expandafter\let\csname \@backslashchar proof\expandafter\endcsname
39 \csname old\@backslashchar proof\endcsname
40 \let\endproof=\oldendproof
41 \let\example=\oldexample
42 \let\endexample=\oldendexample
43 \def\thmt@theoremdefiner{\newboxtheorem[#1]}%
44 }{}%
45 }%
46 % \end{macrocode}
47 %\iffalse (hide this from DocInput)
48 %</thmbox>
49 %\fi