summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/thmtools/source/thmdef-thmbox.dtx
blob: 59409fd79e0bb43f8a96958036520bf994abb08b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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