Debian Codegraph @

texmf-dist/source/latex/thmtools/thm-ntheorem.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 %<*ntheorem>
16 %\fi
17 % \begin{macrocode}
18
19 \providecommand\thmt@space{ }
20
21 % actually, ntheorem's so-called style is nothing like a style at all...
22 \def\thmt@declaretheoremstyle@setup{}
23 \def\thmt@declaretheoremstyle#1{%
24 \ifcsname th@#1\endcsname\else
25 \@xa\let\csname th@#1\endcsname\th@plain
26 \fi
27 }
28
29 \def\thmt@notsupported#1#2{%
30 \PackageWarning{thmtools}{Key `#2' not supported by #1}{}%
31 }
32
33 \define@key{thmstyle}{spaceabove}{%
34 \setlength\theorempreskipamount{#1}%
35 }
36 \define@key{thmstyle}{spacebelow}{%
37 \setlength\theorempostskipamount{#1}%
38 }
39 \define@key{thmstyle}{headfont}{%
40 \theoremheaderfont{#1}%
41 }
42 \define@key{thmstyle}{bodyfont}{%
43 \theorembodyfont{#1}%
44 }
45 % not supported in ntheorem.
46 \define@key{thmstyle}{notefont}{%
47 \thmt@notsupported{ntheorem}{notefont}%
48 }
49 \define@key{thmstyle}{headpunct}{%
50 \theoremseparator{#1}%
51 }
52 % not supported in ntheorem.
53 \define@key{thmstyle}{notebraces}{%
54 \thmt@notsupported{ntheorem}{notebraces}%
55 }
56 \define@key{thmstyle}{break}{%
57 \theoremstyle{break}%
58 }
59 % not supported in ntheorem...
60 \define@key{thmstyle}{postheadspace}{%
61 %\def\thmt@style@postheadspace{#1}%
62 \@xa\g@addto@macro\csname thmt@style \thmt@style @defaultkeys\endcsname{%
63 postheadhook={\hspace{-\labelsep}\hspace*{#1}},%
64 }%
65 }
66
67 % not supported in ntheorem
68 \define@key{thmstyle}{headindent}{%
69 \thmt@notsupported{ntheorem}{headindent}%
70 }
71 % sorry, only style, not def with ntheorem.
72 \define@key{thmstyle}{qed}[\qedsymbol]{%
73 \@ifpackagewith{ntheorem}{thmmarks}{%
74 \theoremsymbol{#1}%
75 }{%
76 \thmt@notsupported
77 {ntheorem without thmmarks option}%
78 {headindent}%
79 }%
80 }
81
82 \let\@upn=\textup
83 \define@key{thmstyle}{headformat}[]{%
84 \def\thmt@tmp{#1}%
85 \@onelevel@sanitize\thmt@tmp
86 %\tracingall
87 \ifcsname thmt@headstyle@\thmt@tmp\endcsname
88 \newtheoremstyle{\thmt@style}{%
89 \item[\hskip\labelsep\theorem@headerfont%
90 \def\NAME{\theorem@headerfont ####1}%
91 \def\NUMBER{\bgroup\@upn{####2}\egroup}%
92 \def\NOTE{}%
93 \csname thmt@headstyle@#1\endcsname
94 \theorem@separator
95 ]
96 }{%
97 \item[\hskip\labelsep\theorem@headerfont%
98 \def\NAME{\theorem@headerfont ####1}%
99 \def\NUMBER{\bgroup\@upn{####2}\egroup}%
100 \def\NOTE{\if=####3=\else\bgroup\thmt@space(####3)\egroup\fi}%
101 \csname thmt@headstyle@#1\endcsname
102 \theorem@separator
103 ]
104 }
105 \else
106 \newtheoremstyle{\thmt@style}{%
107 \item[\hskip\labelsep\theorem@headerfont%
108 \def\NAME{\the\thm@headfont ####1}%
109 \def\NUMBER{\bgroup\@upn{####2}\egroup}%
110 \def\NOTE{}%
111 #1%
112 \theorem@separator
113 ]
114 }{%
115 \item[\hskip\labelsep\theorem@headerfont%
116 \def\NAME{\the\thm@headfont ####1}%
117 \def\NUMBER{\bgroup\@upn{####2}\egroup}%
118 \def\NOTE{\if=####3=\else\bgroup\thmt@space(####3)\egroup\fi}%
119 #1%
120 \theorem@separator
121 ]
122 }
123 \fi
124 }
125
126 \def\thmt@headstyle@margin{%
127 \makebox[0pt][r]{\NUMBER\ }\NAME\NOTE
128 }
129 \def\thmt@headstyle@swapnumber{%
130 \NUMBER\ \NAME\NOTE
131 }
132
133
134
135 % \end{macrocode}
136 %\iffalse (hide this from DocInput)
137 %</ntheorem>
138 %\fi