summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ncctools/nccthm.sty
blob: bc4df31831eb6a786395dc290a5785bbb4751f2d (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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
%%
%% This is file `nccthm.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% nccthm.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% This file is a generated file from the sources of the `ncctools'
%% bundle.
%% 
%% You are not allowed to modify this file.
%% 
%% You are allowed to distribute this file if and only if
%% it is distributed with the corresponding source files in
%% the `ncctools' bundle.
%% 
%% For the copying and distribution conditions of the source files,
%% see the README file distributed with the ncctools bundle.
%%
%% File: nccthm.dtx Copyright (C) 2002--2004 by Alexander I. Rozhenko
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{nccthm}
         [2004/12/16 v1.1 NCC Extention to Theorems (NCC)]
\@ifpackageloaded{nccsect}{}{%
  \def\NCC@secskip#1{%
    \if@noskipsec \leavevmode \fi \par
    \if@nobreak \everypar{}\else
      \addpenalty\@secpenalty
      \addvspace{#1}%
    \fi
  }
  \def\NCC@runskip{2.75ex \@plus 1ex \@minus .2ex}
}
\DeclareRobustCommand{\NCC@qedsymbol}{%
  \mbox{\normalsize\normalfont\thinlines \@tempdima 1.5ex
    \advance\@tempdima-2\@wholewidth
    \edef\@tempa{\the\@tempdima}%
    \kern \@wholewidth
    \raisebox\@wholewidth[1.5ex]{%
      \frame{\rule\z@\@tempa\rule\@tempa\z@}}%
    \kern \@wholewidth
  }%
}
\let\qedsymbol\NCC@qedsymbol
\newcommand{\qed}{\NCC@qed{\qedsymbol}}
\def\NCC@qed#1{\unskip\allowbreak%
  \hspace*{1em plus 1fill minus .2em}#1\@ifstar{}{\qef}%
}
\newcommand{\qef}{\NCC@secskip{\NCC@runskip}\@nobreakfalse\normalfont}
\DeclareOption{whiteqed}{%
  \let\whiteqedsymbol\NCC@qedsymbol
  \newcommand{\whiteqed}{\NCC@qed{\whiteqedsymbol}}
  \let\qedsymbol\whiteqedsymbol
}
\DeclareOption{blackqed}{%
  \DeclareRobustCommand{\blackqedsymbol}{%
    \begingroup\normalsize\normalfont\thinlines
      \rule{1.5ex}{1.5ex}\endgroup
  }
  \newcommand{\blackqed}{\NCC@qed{\blackqedsymbol}}
  \let\qedsymbol\blackqedsymbol
}
\newif\ifNCC@thmindent
\newif\ifNCC@thmmargin
\DeclareOption{noindent}{\NCC@thmindentfalse}
\DeclareOption{indent}{\NCC@thmindenttrue}
\DeclareOption{nomargin}{\NCC@thmmarginfalse}
\DeclareOption{margin}{\NCC@thmmargintrue}
\ExecuteOptions{noindent,nomargin}
\ProcessOptions*
\RequirePackage{amsgen}
\RequirePackage{dcounter}[1998/12/19]
\let\NCC@thmbrmode\relax
\newif\ifNCC@thmbr
\newcommand\breakafterheader{%
  \ifx\NCC@thmbrmode\relax \global\chardef\NCC@thmbrmode\z@\fi
}
\newcommand\nobreakafterheader{%
  \ifx\NCC@thmbrmode\relax \global\chardef\NCC@thmbrmode\@ne\fi
}
\newcommand{\TheoremBreakStyle}{\NCC@thmbrtrue}
\newcommand{\TheoremNoBreakStyle}{\NCC@thmbrfalse}
\newcommand*{\TheoremCommentDelimiters}[2]{%
  \def\NCC@thmcmt@##1{#1\ignorespaces##1\unskip#2}%
}
\newcommand*{\AfterTheoremHeaderChar}[1]{\def\NCC@thmchar{#1}}
\newcommand*{\AfterTheoremHeaderSkip}[1]{\def\NCC@thmskip{#1}}
\@onlypreamble\TheoremBreakStyle
\@onlypreamble\TheoremNoBreakStyle
\@onlypreamble\TheoremCommentDelimiters
\@onlypreamble\AfterTheoremHeaderChar
\@onlypreamble\AfterTheoremHeaderSkip
\def\NCC@thmhdr#1#2{%
  \qef
  \addpenalty{-\@lowpenalty}%
  \begingroup
    #1%
    \ifx\NCC@thmbrmode\relax
      \ifNCC@thmbr \chardef\NCC@thmbrmode\z@
      \else \chardef\NCC@thmbrmode\@ne
      \fi
    \fi
    \ifnum\NCC@thmbrmode=\z@
      \@tempdima\parindent
      \hbox{\vbox{\hsize\linewidth\@parboxrestore
        \ifNCC@thmindent\parindent\@tempdima\fi
        \leavevmode\strut#2\strut
      }}\nobreak\noindent
    \else
      \ifNCC@thmindent\else\noindent\fi
      \leavevmode{#2\normalfont\NCC@thmskip}\nobreak
    \fi
  \endgroup
  \global\let\NCC@thmbrmode\relax
}
\def\NCC@thmcmt#1#2{%
  \@ifempty{#2}{}{\/\space\normalfont#1\NCC@thmcmt@{#2}}%
}
\def\NCC@lthm#1#2#3#4#5{%
  \@ifnextchar[{\NCC@lthm@{#1}{#2}{#3}{#4}{#5}}%
               {\NCC@lthm@{#1}{#2}{#3}{#4}{#5}[]}%
}
\def\NCC@lthm@#1#2#3#4#5[#6]{%
  \NCC@thmhdr{}{%
    #1#4\@ifempty{#5}{}{\space#5}%
    \NCC@thmcmt{#2}{#6}\NCC@thmchar
  }%
  #3\hskip 0.001\p@ \ignorespaces
}
\def\NCC@thxhdr#1#2{%
  \refstepcounter{apar}%
  \NCC@thmhdr{%
    \ifNCC@thmmargin \NCC@thmindentfalse \fi
    #1%
  }{%
    \ifNCC@thmmargin \llap{\NCC@thmapar}\else \hbox{\NCC@thmapar}\fi
    #2%
  }%
}
\def\NCC@lthx#1#2#3#4{%
  \@ifnextchar[{\NCC@lthx@{#1}{#2}{#3}{#4}}%
               {\NCC@lthx@{#1}{#2}{#3}{#4}[]}%
}
\def\NCC@lthx@#1#2#3#4[#5]{%
  \NCC@thxhdr{}{%
    \normalfont#1#4\NCC@thmcmt{#2}{#5}\NCC@thmchar
  }%
  #3\hskip 0.001\p@ \ignorespaces
}
\def\NCC@likethm#1#2#3{%
  \@ifstar{\NCC@lthx{#1}{#2}{#3}}{\NCC@lthm{#1}{#2}{#3}}%
}
\DeclareDynamicCounter{apar}
\newcommand*{\AparStyleParameters}[3]{%
  \def\NCC@thmaparstyle{#1}%
  \def\NCC@thmapar{#2\theapar#3}%
}
\@onlypreamble\AparStyleParameters
\newcommand*{\apar}[1][]{%
  \NCC@thxhdr{\NCC@thmaparstyle}
    {\@ifempty{#1}{\let\NCC@thmskip\@empty}{\ignorespaces#1\unskip}}%
  \hskip 0.001\p@ \ignorespaces
}
\newcommand*{\ProofStyleParameters}[2]{%
  \def\NCC@thmproofstyle{#1}%
  \def\NCC@thmproof{#2}%
}
\@onlypreamble\ProofStyleParameters
\newcommand*{\proof}[1][]{%
  \NCC@thmhdr{\NCC@thmproofstyle}{%
    \NCC@thmproof
    \@ifempty{#1}{}{\space\ignorespaces#1\unskip}%
    \NCC@thmchar
  }%
  \hskip 0.001\p@ \ignorespaces
}
\newcommand*{\newtheoremtype}[1]{%
  \edef\@tempa{\noexpand\newcommand*{\expandafter\noexpand
    \csname like#1\endcsname}}\NCC@nthmtype
}
\newcommand*{\renewtheoremtype}[1]{%
  \edef\@tempa{\noexpand\renewcommand*{\expandafter\noexpand
    \csname like#1\endcsname}}\NCC@nthmtype
}
\def\NCC@nthmtype#1#2#3{\@tempa{\NCC@likethm{#1}{#2}{#3}}}
\@onlypreamble\newtheoremtype
\@onlypreamble\renewtheoremtype
\@onlypreamble\NCC@nthmtype
\def\NCC@thmdef#1#2#3{%
  \@ifnextchar[{\NCC@thmdef@{#1}{#2}{#3}}%
               {\NCC@thmdef@{#1}{#2}{#3}[theorem]}%
}
\def\NCC@thmdef@#1#2#3[#4]{%
  \@ifundefined{like#4}{%
    \PackageError{nccthm}{Unknown theorem type `#4'}{}%
  }%
  \edef\@tempa##1##2{%
    \@tempa{#1}{##1\expandafter\noexpand\csname like#4\endcsname##2}%
  }%
  \ifNCC@thmbr
    \@tempa{#2\breakafterheader}{#3}{\qef\ignorespacesafterend}%
  \else
    \@tempa{#2\nobreakafterheader}{#3}{\qef\ignorespacesafterend}%
  \fi
}
\@onlypreamble\NCC@thmdef
\@onlypreamble\NCC@thmdef@
\renewcommand*{\newtheorem}{\def\@tempa{\noexpand\newenvironment}%
  \@ifstar{\NCC@nthx}{\NCC@nthm}}
\newcommand*{\renewtheorem}{\def\@tempa{\noexpand\renewenvironment}%
  \@ifstar{\NCC@nthx}{\NCC@nthm}}
\def\NCC@nthx#1#2{\NCC@thmdef{#1}{}{*{#2}}}
\def\NCC@nthm#1{\@ifnextchar[{\NCC@nthm@{#1}}{\NCC@nthm@{#1}[#1]}}
\def\NCC@nthm@#1[#2]#3{%
  \DeclareDynamicCounter{#2}%
  \NCC@thmdef{#1}{\refstepcounter{#2}}{{#3}{\csname the#2\endcsname}}%
}
\@onlypreamble\newtheorem
\@onlypreamble\renewtheorem
\@onlypreamble\NCC@nthx
\@onlypreamble\NCC@nthm
\@onlypreamble\NCC@nthm@
\newtheoremtype{theorem}{\bfseries}{}{\itshape}
\newtheoremtype{remark}{\itshape}{}{}
\TheoremNoBreakStyle
\TheoremCommentDelimiters{(}{)}
\AfterTheoremHeaderChar{}
\AfterTheoremHeaderSkip{\hskip 1em \@plus .2em \@minus .2em}
\AparStyleParameters{\bfseries}{\bfseries}{\enskip}
\ProofStyleParameters{\bfseries}{Proof}
\endinput
%%
%% End of file `nccthm.sty'.