summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/thmtools/thm-amsthm.sty
blob: be13a3cadfe29b4e243b53dfecfb791e85c4c67f (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
%%
%% This is file `thm-amsthm.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% thm-amsthm.dtx  (with options: `amsthm')
%% This is a generated file.
%% 
%% This file is part of the `thmtools' package.
%% The `thmtools' package has the LPPL maintenance status: maintained.
%% Current Maintainer is Yukai Chou, muzimuzhi@gmail.com
%% 
%% Copyright (C) 2008-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.
%% This version is obtainable at
%% http://www.latex-project.org/lppl/lppl-1-3c.txt
%% 
%% 
\NeedsTeXFormat {LaTeX2e}
\ProvidesPackage {thm-amsthm}[2022/06/01 v0.73]
\providecommand\thmt@space{ }

\define@key{thmstyle}{spaceabove}{%
  \def\thmt@style@spaceabove{#1}%
}
\define@key{thmstyle}{spacebelow}{%
  \def\thmt@style@spacebelow{#1}%
}
\define@key{thmstyle}{headfont}{%
  \def\thmt@style@headfont{#1}%
}
\define@key{thmstyle}{bodyfont}{%
  \def\thmt@style@bodyfont{#1}%
}
\define@key{thmstyle}{notefont}{%
  \def\thmt@style@notefont{#1}%
}
\define@key{thmstyle}{headpunct}{%
  \def\thmt@style@headpunct{#1}%
}
\define@key{thmstyle}{notebraces}{%
  \def\thmt@style@notebraces{\thmt@embrace#1}%
}
\define@key{thmstyle}{break}[]{%
  \def\thmt@style@postheadspace{\newline}%
}
\define@key{thmstyle}{postheadspace}{%
  \def\thmt@style@postheadspace{#1}%
}
\define@key{thmstyle}{headindent}{%
  \def\thmt@style@headindent{#1}%
}

\newtoks\thmt@style@headstyle
\define@key{thmstyle}{headformat}[]{%
  \thmt@setheadstyle{#1}%
}
\define@key{thmstyle}{headstyle}[]{%
  \thmt@setheadstyle{#1}%
}
\def\thmt@setheadstyle#1{%
  \thmt@style@headstyle{%
    \def\NAME{\the\thm@headfont ##1}%
    \def\NUMBER{\bgroup\@upn{##2}\egroup}%
    \def\NOTE{\if=##3=\else\bgroup\thmt@space\the\thm@notefont(##3)\egroup\fi}%
  }%
  \def\thmt@tmp{#1}%
  \@onelevel@sanitize\thmt@tmp
  %\tracingall
  \ifcsname thmt@headstyle@\thmt@tmp\endcsname
    \thmt@style@headstyle\@xa{%
      \the\thmt@style@headstyle
      \csname thmt@headstyle@#1\endcsname
    }%
  \else
    \thmt@style@headstyle\@xa{%
      \the\thmt@style@headstyle
      #1%
    }%
  \fi
  %\showthe\thmt@style@headstyle
}
\def\thmt@headstyle@margin{%
  \makebox[0pt][r]{\NUMBER\ }\NAME\NOTE
}
\def\thmt@headstyle@swapnumber{%
  \NUMBER\ \NAME\NOTE
}

\def\thmt@embrace#1#2(#3){#1#3#2}

\def\thmt@declaretheoremstyle@setup{%
  \let\thmt@style@notebraces\@empty%
  \thmt@style@headstyle{}%
  \kvsetkeys{thmstyle}{%
    spaceabove=3pt,
    spacebelow=3pt,
    headfont=\bfseries,
    bodyfont=\normalfont,
    headpunct={.},
    postheadspace={ },
    headindent={},
    notefont={\fontseries\mddefault\upshape}
  }%
}
\def\thmt@declaretheoremstyle#1{%
  %\show\thmt@style@spaceabove
  \thmt@toks{\newtheoremstyle{#1}}%
  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@spaceabove}}%
  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@spacebelow}}%
  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@bodyfont}}%
  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@headindent}}% indent1 FIXME
  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@headfont}}%
  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@headpunct}}%
  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\thmt@style@postheadspace}}%
  \thmt@toks\@xa\@xa\@xa{\@xa\the\@xa\thmt@toks\@xa{\the\thmt@style@headstyle}}% headspec FIXME
  \the\thmt@toks
  %1 Indent amount: empty = no indent, \parindent = normal paragraph indent
  %2 Space after theorem head: { } = normal interword space; \newline = linebreak
  %% BUGFIX: amsthm ignores notefont setting altogether:
  \thmt@toks\@xa\@xa\@xa{\csname th@#1\endcsname}%
  \thmt@toks
  \@xa\@xa\@xa\@xa\@xa\@xa\@xa{%
  \@xa\@xa\@xa\@xa\@xa\@xa\@xa\thm@notefont
  \@xa\@xa\@xa\@xa\@xa\@xa\@xa{%
  \@xa\@xa\@xa\thmt@style@notefont
  \@xa\thmt@style@notebraces
  \@xa}\the\thmt@toks}%
  \@xa\def\csname th@#1\@xa\endcsname\@xa{\the\thmt@toks}%
}

\define@key{thmdef}{qed}[\qedsymbol]{%
  \thmt@trytwice{}{%
    \addtotheorempostheadhook[\thmt@envname]{%
      \protected@edef\qedsymbol{#1}%
      \pushQED{\qed}%
    }%
    \addtotheoremprefoothook[\thmt@envname]{%
      \protected@edef\qedsymbol{#1}%
      \popQED
    }%
  }%
}

\def\thmt@amsthmlistbreakhack{%
  \leavevmode
  \vspace{-\baselineskip}%
  \par
  \everypar{\setbox\z@\lastbox\everypar{}}%
}

\define@key{thmuse}{listhack}[\relax]{%
  \addtotheorempostheadhook[local]{%
    \thmt@amsthmlistbreakhack
  }%
}

\endinput
%%
%% End of file `thm-amsthm.sty'.