| 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 |
%<*amsthm> |
| 16 |
%\fi |
| 17 |
% \begin{macrocode} |
| 18 |
\providecommand\thmt@space{ } |
| 19 |
|
| 20 |
\define@key{thmstyle}{spaceabove}{% |
| 21 |
\def\thmt@style@spaceabove{#1}% |
| 22 |
} |
| 23 |
\define@key{thmstyle}{spacebelow}{% |
| 24 |
\def\thmt@style@spacebelow{#1}% |
| 25 |
} |
| 26 |
\define@key{thmstyle}{headfont}{% |
| 27 |
\def\thmt@style@headfont{#1}% |
| 28 |
} |
| 29 |
\define@key{thmstyle}{bodyfont}{% |
| 30 |
\def\thmt@style@bodyfont{#1}% |
| 31 |
} |
| 32 |
\define@key{thmstyle}{notefont}{% |
| 33 |
\def\thmt@style@notefont{#1}% |
| 34 |
} |
| 35 |
\define@key{thmstyle}{headpunct}{% |
| 36 |
\def\thmt@style@headpunct{#1}% |
| 37 |
} |
| 38 |
\define@key{thmstyle}{notebraces}{% |
| 39 |
\def\thmt@style@notebraces{\thmt@embrace#1}% |
| 40 |
} |
| 41 |
\define@key{thmstyle}{break}[]{% |
| 42 |
\def\thmt@style@postheadspace{\newline}% |
| 43 |
} |
| 44 |
\define@key{thmstyle}{postheadspace}{% |
| 45 |
\def\thmt@style@postheadspace{#1}% |
| 46 |
} |
| 47 |
\define@key{thmstyle}{headindent}{% |
| 48 |
\def\thmt@style@headindent{#1}% |
| 49 |
} |
| 50 |
|
| 51 |
\newtoks\thmt@style@headstyle |
| 52 |
\define@key{thmstyle}{headformat}[]{% |
| 53 |
\thmt@setheadstyle{#1}% |
| 54 |
} |
| 55 |
\define@key{thmstyle}{headstyle}[]{% |
| 56 |
\thmt@setheadstyle{#1}% |
| 57 |
} |
| 58 |
\def\thmt@setheadstyle#1{% |
| 59 |
\thmt@style@headstyle{% |
| 60 |
\def\NAME{\the\thm@headfont ##1}% |
| 61 |
\def\NUMBER{\bgroup\@upn{##2}\egroup}% |
| 62 |
\def\NOTE{\if=##3=\else\bgroup\thmt@space\the\thm@notefont(##3)\egroup\fi}% |
| 63 |
}% |
| 64 |
\def\thmt@tmp{#1}% |
| 65 |
\@onelevel@sanitize\thmt@tmp |
| 66 |
%\tracingall |
| 67 |
\ifcsname thmt@headstyle@\thmt@tmp\endcsname |
| 68 |
\thmt@style@headstyle\@xa{% |
| 69 |
\the\thmt@style@headstyle |
| 70 |
\csname thmt@headstyle@#1\endcsname |
| 71 |
}% |
| 72 |
\else |
| 73 |
\thmt@style@headstyle\@xa{% |
| 74 |
\the\thmt@style@headstyle |
| 75 |
#1% |
| 76 |
}% |
| 77 |
\fi |
| 78 |
%\showthe\thmt@style@headstyle |
| 79 |
} |
| 80 |
% examples: |
| 81 |
\def\thmt@headstyle@margin{% |
| 82 |
\makebox[0pt][r]{\NUMBER\ }\NAME\NOTE |
| 83 |
} |
| 84 |
\def\thmt@headstyle@swapnumber{% |
| 85 |
\NUMBER\ \NAME\NOTE |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
\def\thmt@embrace#1#2(#3){#1#3#2} |
| 91 |
|
| 92 |
\def\thmt@declaretheoremstyle@setup{% |
| 93 |
\let\thmt@style@notebraces\@empty% |
| 94 |
\thmt@style@headstyle{}% |
| 95 |
\kvsetkeys{thmstyle}{% |
| 96 |
spaceabove=3pt, |
| 97 |
spacebelow=3pt, |
| 98 |
headfont=\bfseries, |
| 99 |
bodyfont=\normalfont, |
| 100 |
headpunct={.}, |
| 101 |
postheadspace={ }, |
| 102 |
headindent={}, |
| 103 |
notefont={\fontseries\mddefault\upshape} |
| 104 |
}% |
| 105 |
} |
| 106 |
\def\thmt@declaretheoremstyle#1{% |
| 107 |
%\show\thmt@style@spaceabove |
| 108 |
\thmt@toks{\newtheoremstyle{#1}}% |
| 109 |
\thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@spaceabove}}% |
| 110 |
\thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@spacebelow}}% |
| 111 |
\thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@bodyfont}}% |
| 112 |
\thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@headindent}}% indent1 FIXME |
| 113 |
\thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@headfont}}% |
| 114 |
\thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@headpunct}}% |
| 115 |
\thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@postheadspace}}% |
| 116 |
\thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\the\thmt@style@headstyle}}% headspec FIXME |
| 117 |
\the\thmt@toks |
| 118 |
%1 Indent amount: empty = no indent, \parindent = normal paragraph indent |
| 119 |
%2 Space after theorem head: { } = normal interword space; \newline = linebreak |
| 120 |
%% BUGFIX: amsthm ignores notefont setting altogether: |
| 121 |
\thmt@toks\@xa\@xa\@xa{\csname th@#1\endcsname}% |
| 122 |
\thmt@toks |
| 123 |
\@xa\@xa\@xa\@xa\@xa\@xa\@xa{% |
| 124 |
\@xa\@xa\@xa\@xa\@xa\@xa\@xa\thm@notefont |
| 125 |
\@xa\@xa\@xa\@xa\@xa\@xa\@xa{% |
| 126 |
\@xa\@xa\@xa\thmt@style@notefont |
| 127 |
\@xa\thmt@style@notebraces |
| 128 |
\@xa}\the\thmt@toks}% |
| 129 |
\@xa\def\csname th@#1\@xa\endcsname\@xa{\the\thmt@toks}% |
| 130 |
% \@xa\def\csname th@#1\@xa\@xa\@xa\@xa\@xa\@xa\@xa\endcsname |
| 131 |
% \@xa\@xa\@xa\@xa\@xa\@xa\@xa{% |
| 132 |
% \@xa\@xa\@xa\@xa\@xa\@xa\@xa\thm@notefont |
| 133 |
% \@xa\@xa\@xa\@xa\@xa\@xa\@xa{% |
| 134 |
% \@xa\@xa\@xa\thmt@style@notefont |
| 135 |
% \@xa\@xa\@xa\thmt@style@notebraces |
| 136 |
% \@xa\@xa\@xa}\csname th@#1\endcsname |
| 137 |
% } |
| 138 |
} |
| 139 |
|
| 140 |
\define@key{thmdef}{qed}[\qedsymbol]{% |
| 141 |
\thmt@trytwice{}{% |
| 142 |
\addtotheorempostheadhook[\thmt@envname]{% |
| 143 |
\protected@edef\qedsymbol{#1}% |
| 144 |
\pushQED{\qed}% |
| 145 |
}% |
| 146 |
\addtotheoremprefoothook[\thmt@envname]{% |
| 147 |
\protected@edef\qedsymbol{#1}% |
| 148 |
\popQED |
| 149 |
}% |
| 150 |
}% |
| 151 |
} |
| 152 |
|
| 153 |
\def\thmt@amsthmlistbreakhack{% |
| 154 |
\leavevmode |
| 155 |
\vspace{-\baselineskip}% |
| 156 |
\par |
| 157 |
\everypar{\setbox\z@\lastbox\everypar{}}% |
| 158 |
} |
| 159 |
|
| 160 |
\define@key{thmuse}{listhack}[\relax]{% |
| 161 |
\addtotheorempostheadhook[local]{% |
| 162 |
\thmt@amsthmlistbreakhack |
| 163 |
}% |
| 164 |
} |
| 165 |
|
| 166 |
% \end{macrocode} |
| 167 |
%\iffalse (hide this from DocInput) |
| 168 |
%</amsthm> |
| 169 |
%\fi |