summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/lwarp/lwarp-amsthm.sty
blob: d3ff22fc664ce17111a5b5f10781f4bc62cebcc5 (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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
%%
%% This is file `lwarp-amsthm.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% lwarp.dtx  (with options: `amsthm')
%% This is a generated file.
%% Copyright 2016-2020 Brian Dunn
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.


\IfPackageLoadedTF{mdframed}{
    \PackageError{lwarp}
    {%
        Package mdframed must be loaded after package amsthm.\MessageBreak
        Enter 'H' for solutions%
    }
    {%
        Move ``\protect\usepackage{amsthm}'' before
        ``\protect\usepackage{mdframed}''.\MessageBreak
        Package amsthm may be loaded by something else,\MessageBreak
        which must also be moved before mdframed.%
    }
}
{\relax}
\RequirePackage{amsmath}
\LWR@ProvidesPackagePass{amsthm}[2017/10/31]
\newcommand{\LWR@newtheoremstyle}{plain}

\renewcommand{\theoremstyle}[1]{%
  \@ifundefined{th@#1}{%
    \PackageWarning{amsthm}{Unknown theoremstyle `#1'}%
    \thm@style{plain}%
    \renewcommand{\LWR@newtheoremstyle}{plain}% lwarp
  }{%
    \thm@style{#1}%
    \renewcommand{\LWR@newtheoremstyle}{#1}% lwarp
  }%
}

\def\@xnthm#1#2{%
  \csedef{LWR@thmstyle#2}{\LWR@newtheoremstyle}% lwarp
  \let\@tempa\relax
  \@xp\@ifdefinable\csname #2\endcsname{%
    \global\@xp\let\csname end#2\endcsname\@endtheorem
    \ifx *#1% unnumbered, need to get one more mandatory arg
      \edef\@tempa##1{%
        \gdef\@xp\@nx\csname#2\endcsname{%
          \@nx\@thm{\@xp\@nx\csname th@\the\thm@style\endcsname}%
            {}{##1}}}%
    \else % numbered theorem, need to check for optional arg
      \def\@tempa{\@oparg{\@ynthm{#2}}[]}%
    \fi
    \AtBeginEnvironment{#2}{%                               lwarp
        \edef\LWR@thisthmstyle{\@nameuse{LWR@thmstyle#2}}%  lwarp
    }%                                                      lwarp
  }%
  \@tempa%
}

\newcommand{\LWR@haveamsthmname}{
    \renewcommand{\thmname}[1]{%
        \InlineClass{amsthmname\LWR@thisthmstyle}{##1}%
    }
}

\newcommand{\LWR@haveamsthmnumber}{
    \renewcommand{\thmnumber}[1]{%
        \InlineClass{amsthmnumber\LWR@thisthmstyle}{##1}%
    }
}

\newcommand{\LWR@haveamsthmnote}{
    \renewcommand{\thmnote}[1]{%
        \InlineClass{amsthmnote\LWR@thisthmstyle}{##1}%
    }
}

\LWR@haveamsthmname
\LWR@haveamsthmnumber
\LWR@haveamsthmnote
\def\@begintheorem#1#2[#3]{%
    \GetTitleString{#3}%                                lwarp
    \let\@currentlabelname\GetTitleStringResult%        lwarp
    \item[%
    \LWR@newautopagelabel{page}\LWR@orignewline%
    \@ifempty{#1}{\let\thmname\@gobble}{\LWR@haveamsthmname}%       lwarp
    \@ifempty{#2}{\let\thmnumber\@gobble}{\LWR@haveamsthmnumber}%   lwarp
    \@ifempty{#3}{\let\thmnote\@gobble}{\LWR@haveamsthmnote}%       lwarp
    \thm@swap\swappedhead\thmhead{#1}{#2}{#3}%
    \the\thm@headpunct % space
    \thmheadnl % possibly a newline.
    \hskip\thm@headsep
    ]%
  \ignorespaces}
\def\@thm#1#2#3{%
  \ifhmode\unskip\unskip\par\fi
  \normalfont
  \LWR@forcenewpage%                            lwarp
  \LWR@printpendingfootnotes%                   lwarp
  \BlockClass{amsthmbody\LWR@thisthmstyle}%     lwarp
  \trivlist
  \let\thmheadnl\relax
  \let\thm@swap\@gobble
  \thm@notefont{\fontseries\mddefault\upshape}%
  \thm@headpunct{.}% add period after heading
  \thm@headsep 5\p@ plus\p@ minus\p@\relax
  \thm@space@setup
  #1% style overrides
  \@topsep \thm@preskip               % used by thm head
  \@topsepadd \thm@postskip           % used by \@endparenv
  \def\@tempa{#2}\ifx\@empty\@tempa
    \def\@tempa{\@oparg{\@begintheorem{#3}{}}[]}%
  \else
    \refstepcounter{#2}%
    \def\@tempa{\@oparg{\@begintheorem{#3}{\csname the#2\endcsname}}[]}%
  \fi
  \@tempa%
}
\AtBeginDocument{%
\def\cref@thmoptarg[#1]#2#3#4{%
    \ifhmode\unskip\unskip\par\fi%
    \normalfont%
    \LWR@forcenewpage%                          lwarp
    \LWR@printpendingfootnotes%                   lwarp
    \BlockClass{amsthmbody\LWR@thisthmstyle}%   lwarp
    \trivlist%
    \let\thmheadnl\relax%
    \let\thm@swap\@gobble%
    \thm@notefont{\fontseries\mddefault\upshape}%
    \thm@headpunct{.}% add period after heading
    \thm@headsep 5\p@ plus\p@ minus\p@\relax%
    \thm@space@setup%
    #2% style overrides
    \@topsep \thm@preskip               % used by thm head
    \@topsepadd \thm@postskip           % used by \@endparenv
    \def\@tempa{#3}\ifx\@empty\@tempa%
        \def\@tempa{\@oparg{\@begintheorem{#4}{}}[]}%
    \else%
        \refstepcounter[#1]{#3}%  <<< cleveref modification
        \def\@tempa{\@oparg{\@begintheorem{#4}{\csname the#3\endcsname}}[]}%
    \fi%
    \@tempa
}%
}% AtBeginDocument

\def\@endtheorem{%
    \endtrivlist%
  \LWR@printpendingfootnotes%                   lwarp
    \endBlockClass%
    \@endpefalse%
}
\AtBeginDocument{
\@ifundefined{LWR@orig@openbox}{
\LetLtxMacro\LWR@orig@openbox\openbox
\LetLtxMacro\LWR@orig@blacksquare\blacksquare
\LetLtxMacro\LWR@orig@Box\Box

\def\openbox{\text{\HTMLunicode{25A1}}}% UTF-8 white box
\def\blacksquare{\text{\HTMLunicode{220E}}}% UTF-8 end-of-proof
\def\Box{\text{\HTMLunicode{25A1}}}% UTF-8 white box

\appto\LWR@restoreorigformatting{%
    \LetLtxMacro\openbox\LWR@orig@openbox%
    \LetLtxMacro\blacksquare\LWR@orig@blacksquare%
    \LetLtxMacro\Box\LWR@orig@Box%
}% appto
}{}% @ifundefined
}% AtBeginDocument
\DeclareRobustCommand{\qed}{%
  \ifmmode \mathqed
  \else
        \InlineClass{theoremendmark}{\qedsymbol}%   lwarp
  \fi
}
\renewenvironment{proof}[1][\proofname]{\par
  \LWR@forcenewpage% lwarp
  \LWR@printpendingfootnotes%                   lwarp
    \BlockClass{amsthmproof}% lwarp
    \LWR@newautopagelabel{page}%
  \pushQED{\qed}%
  \normalfont \topsep6\p@\@plus6\p@\relax
  \trivlist
  \item[
        \InlineClass{amsthmproofname}{#1\@addpunct{.}}]\ignorespaces% changes
}{%
  \popQED\endtrivlist%
  \LWR@printpendingfootnotes%                   lwarp
  \endBlockClass% lwarp
  \@endpefalse
}


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