| 1 |
% \iffalse |
| 2 |
%% |
| 3 |
%% File: nccthm.dtx Copyright (C) 2002--2004 by Alexander I. Rozhenko |
| 4 |
%% |
| 5 |
%<package>\NeedsTeXFormat{LaTeX2e} |
| 6 |
%<package>\ProvidesPackage{nccthm} |
| 7 |
%<package> [2004/12/16 v1.1 NCC Extention to Theorems (NCC)] |
| 8 |
% |
| 9 |
% \changes{v1.02}{2002/01/31}{This version is uploaded to CTAN} |
| 10 |
% \changes{v1.03}{2002/02/17}{Break mode is turned off globally} |
| 11 |
% \changes{v1.04}{2002/05/19}{An extra group added in theorem headers |
| 12 |
% to scope font changes} |
| 13 |
% \changes{v1.05}{2002/06/07}{Bug in referencing in APAR mode fixed} |
| 14 |
% \changes{v1.06}{2003/01/13}{Spaces after label are ignored now} |
| 15 |
% \changes{v1.07}{2004/04/08}{Improvements in interpreting spaces after label} |
| 16 |
% \changes{v1.1}{2004/12/16}{In apar mode, ignore indent option if margin option used} |
| 17 |
% \changes{v1.1}{2004/12/16}{Documentation was prepared} |
| 18 |
% |
| 19 |
%<*driver> |
| 20 |
\let\makeindex\relax |
| 21 |
\documentclass{ltxdoc} |
| 22 |
\usepackage{desclist} |
| 23 |
\usepackage[blackqed,whiteqed]{nccthm} |
| 24 |
\countstyle[apar]{section} |
| 25 |
\newtheorem{theorem}{Theorem} |
| 26 |
\newtheorem*{atheorem}{Theorem} |
| 27 |
\TheoremBreakStyle |
| 28 |
\newtheorem{definition}{Definition}[remark] |
| 29 |
\TheoremNoBreakStyle |
| 30 |
\newtheorem{lemma}[theorem]{Lemma} |
| 31 |
\newcommand\Line{\qef\hrule height .4pt width \linewidth\nobreak |
| 32 |
\qef} |
| 33 |
\GetFileInfo{nccthm.sty} |
| 34 |
\begin{document} |
| 35 |
\title{The \textsf{nccthm} package\thanks{This file |
| 36 |
has version number \fileversion, last |
| 37 |
revised \filedate.}} |
| 38 |
\author{Alexander I. Rozhenko\\[email protected]} |
| 39 |
\date{\filedate} |
| 40 |
\maketitle |
| 41 |
\DocInput{nccthm.dtx} |
| 42 |
\end{document} |
| 43 |
%</driver> |
| 44 |
% \fi |
| 45 |
% |
| 46 |
% \tableofcontents |
| 47 |
% |
| 48 |
% \section{Overview} |
| 49 |
% |
| 50 |
% This is yet another extension of the \LaTeX\ theorem making |
| 51 |
% environment. Further, we'll call the \textit{theorem} |
| 52 |
% any mathematical statement consisting of one or more paragraphs, |
| 53 |
% and starting with a header containing an optional number. |
| 54 |
% A theorem is set off from the main text with an extra space. |
| 55 |
% Its title and body are often emphasized with a font change. |
| 56 |
% |
| 57 |
% In comparison with the |theorem| package by Frank Mittelbach and the |
| 58 |
% |amsthm| package by American Mathematical Society, the |
| 59 |
% |nccthm| package is distinct in the following: |
| 60 |
% |
| 61 |
% \paragraph{1} All new theorem environments generated with the |
| 62 |
% |nccthm| package use the \textit{dynamic counters} (see |dcounter| |
| 63 |
% package from this bungle for more details). As a result, this allows |
| 64 |
% a package writer to generate predefined theorems |
| 65 |
% and do not think on how they will be numbered, because the |
| 66 |
% decision is later made by a user. |
| 67 |
% For example, if you want all theorems to have enumeration |
| 68 |
% subordinated to sections, you need to write down the command |
| 69 |
% \begin{quote} |
| 70 |
% |\countstyle{section}| |
| 71 |
% \end{quote} |
| 72 |
% in the preamble. In this case, counters of all new theorems will be |
| 73 |
% set to zero at the beginning of every section and their enumeration |
| 74 |
% will be composed from the section number and the theorem counter number |
| 75 |
% itself. You can also change a enumeration style for concrete |
| 76 |
% counters (not only for dynamic counters) with the |\countstyle| |
| 77 |
% command specifying the list of counters in its optional parameter. |
| 78 |
% For example, if you prepare a book and want to subordinate |
| 79 |
% the equation and table counters to sections (they are subordinated to |
| 80 |
% chapters by default), write down in the preamble the following |
| 81 |
% \begin{quote} |
| 82 |
% |\countstyle[equation,table]{section}| |
| 83 |
% \end{quote} |
| 84 |
% The last example: to make a plain enumeration of sections |
| 85 |
% and reject their dependance on any other counter, write down |
| 86 |
% in the preamble |\countstyle[section]{}|. |
| 87 |
% |
| 88 |
% \paragraph{2} We have divided all theorem modification features into |
| 89 |
% three orthogonal groups. |
| 90 |
% |
| 91 |
% A \textit{type} defines font shapes used in the theorem. |
| 92 |
% Two types are predefined: \textit{theorem} and \textit{remark}. |
| 93 |
% You can define more types or redefine existing types. |
| 94 |
% |
| 95 |
% A \textit{mode} defines the precedence of number in the header. |
| 96 |
% In standard mode, a number goes after a theorem title. |
| 97 |
% The reverse mode (number starts header), named here the |
| 98 |
% \textit{APAR} mode, is special. All theorems using this mode |
| 99 |
% are counted with the same |apar| counter. To generate theorems |
| 100 |
% in the standard mode, the |\newtheorem| command is used. |
| 101 |
% The |\newtheorem*| command is used for generation \textit{apar} |
| 102 |
% theorems. |
| 103 |
% |
| 104 |
% A \textit{style} specifies the appearance of theorems. |
| 105 |
% It consists of three modifiers: \textit{breaking}, |
| 106 |
% \textit{indentation}, |
| 107 |
% and \textit{marginal numbering}. The breaking modifier determines |
| 108 |
% the separation of theorem header from theorem body (run-in header |
| 109 |
% or line break after header). The indentation modifier has two |
| 110 |
% values: \textit{noindent} and \textit{parindent}. It |
| 111 |
% defines an indentation style of a theorem header. |
| 112 |
% The marginal numbering modifier affects on apar theorems: |
| 113 |
% in \textit{margin} style, the number of an apar theorem |
| 114 |
% is typed on margins; in \textit{nomargin} |
| 115 |
% style, the number starts a paragraph. |
| 116 |
% |
| 117 |
% The breaking modifier is controlled with special commands but other |
| 118 |
% modifiers are specified with package options. |
| 119 |
% |
| 120 |
% \paragraph{3} We do not base the implementation of theorems |
| 121 |
% on the |trivlist| environment. This allows us to use two methods |
| 122 |
% of theorem markup: environment-like markup (|\begin{theorem}| \ldots\ |
| 123 |
% |\end{theorem}|) or command-like markup (|\theorem| \ldots |\qef|). |
| 124 |
% The |\qef| command is used as the end of any theorem. It resets the |
| 125 |
% font to the normal font and produces a vertical skip. |
| 126 |
% The command-like markup is useful in apar theorems. |
| 127 |
% |
| 128 |
% \paragraph{4} Service commands are introduced. Using package options |
| 129 |
% you can select a type of Q.E.D.\ symbol: black or white. You can use |
| 130 |
% both of them. The |\proof| command starts a proof of statement. |
| 131 |
% We have no |proof| environment, because the proof is prepared in |
| 132 |
% the normal font. To complete a proof, use |\qed| or |\qef| |
| 133 |
% (the first one additionally prints the right adjusted Q.E.D. symbol). |
| 134 |
% You can easy customize delimiters of theorem and proof headers. |
| 135 |
% |
| 136 |
% \section{Quod Erat Demonstrandum} |
| 137 |
% |
| 138 |
% The Q.E.D. symbol is usually used at the end of proof of a |
| 139 |
% math statement. Sometimes, another symbol finishes a math |
| 140 |
% statement itself. The package allows using two types of Q.E.D. |
| 141 |
% symbols: black (\blackqedsymbol) and white (\whiteqedsymbol). |
| 142 |
% |
| 143 |
% \DescribeMacro\qedsymbol |
| 144 |
% The default Q.E.D. symbol is white. It is printed with the |
| 145 |
% |\qedsymbol| command. |
| 146 |
% |
| 147 |
% \DescribeMacro\qed |
| 148 |
% \DescribeMacro\qef |
| 149 |
% The |\qed| command is used to finish a proof. It prints |
| 150 |
% right-adjusted Q.E.D. symbol and applies the |\qef| command |
| 151 |
% (it finishes this paragraph). |
| 152 |
% The |\qef| command finishes a paragraph, |
| 153 |
% changes the current font to the normal font, and skips |
| 154 |
% a |\paragraph|-like vertical space. |
| 155 |
% \qed |
| 156 |
% |
| 157 |
% \DescribeMacro{\qed*} |
| 158 |
% The star-form of |\qed| command prints the Q.E.D. symbol |
| 159 |
% but not applies the |\qef| command. |
| 160 |
% |
| 161 |
% The usage of the above mentioned commands at the end of |
| 162 |
% proof is the following: if the proof end with an ordinary |
| 163 |
% paragraph, use the |\qed| command at its end; if the |
| 164 |
% proof ends with a list, use the |\qed*| command at |
| 165 |
% the end of the last list item and the |\qef| |
| 166 |
% command after the end of list; and if the proof ends |
| 167 |
% with a display formula, use the |\qedsymbol| command |
| 168 |
% as its tag (|\tag*{\qedsymbol}| when use the |
| 169 |
% |amsmath| package). |
| 170 |
% |
| 171 |
% \DescribeMacro{\blackqed} |
| 172 |
% \DescribeMacro{\blackqedsymbol} |
| 173 |
% If you load the package with the `|blackqed|' option, two |
| 174 |
% additional commands are generated, |\blackqedsymbol| and |\blackqed|. |
| 175 |
% The default |\qedsymbol| and |\qed| commands are let to be |
| 176 |
% equal to their black versions. |
| 177 |
% |
| 178 |
% \DescribeMacro{\whiteqed} |
| 179 |
% \DescribeMacro{\whiteqedsymbol} |
| 180 |
% Analogously, the `|whiteqed|' option generates the |
| 181 |
% |\whiteqedsymbol| and\linebreak |\whiteqed| commands and lets |
| 182 |
% the default |\qedsymbol| and |\qed| commands to be |
| 183 |
% equal to their white versions. |
| 184 |
% |
| 185 |
% If both these options are used, the default |
| 186 |
% |\qedsymbol| and |\qed| commands are let to be equal |
| 187 |
% the version loaded last. For example, the following command |
| 188 |
% loads both versions of Q.E.D. and lets the white |
| 189 |
% version to be the default version: |
| 190 |
% \begin{quote} |
| 191 |
% |\usepackage[blackqed,whiteqed]{nccthm}| |
| 192 |
% \end{quote} |
| 193 |
% |
| 194 |
% \section{Other Package Options} |
| 195 |
% |
| 196 |
% The package loads options in the order they are written |
| 197 |
% in the options list. Along with the `|blackqed|' and `|whiteqed|' |
| 198 |
% options described above, the following options are available: |
| 199 |
% \begin{desclist}{\tt}{\hfill}[nomargin] |
| 200 |
% \item[noindent] theorems are typed without indentation; |
| 201 |
% \item[indent] theorems are typed with paragraph indentation; |
| 202 |
% \item[nomargin] numbers for theorems in apar mode are typed normally; |
| 203 |
% \item[margin] numbers for theorems in apar mode are typed on margin. |
| 204 |
% \end{desclist} |
| 205 |
% |
| 206 |
% The default options are |noindent| and |nomargin|. The following |
| 207 |
% examples show how the combinations of |(no)indent| and |(no)margin| |
| 208 |
% options interact. |
| 209 |
% |
| 210 |
% \liketheorem{Theorem}{1} The standard theorem in the |noindent + nomargin| style.\qef |
| 211 |
% \likeremark*{Remark} The apar theorem in the |noindent + nomargin| style.\qef |
| 212 |
% \makeatletter\NCC@thmindenttrue\NCC@thmmarginfalse\makeatother |
| 213 |
% \liketheorem{Theorem}{2} The standard theorem in the |indent + nomargin| style.\qef |
| 214 |
% \likeremark*{Remark} The apar remark in the |indent + nomargin| style.\qef |
| 215 |
% \makeatletter\NCC@thmindentfalse\NCC@thmmargintrue\makeatother |
| 216 |
% \liketheorem*{Theorem} The apar theorem in the |noindent + margin| style.\qef |
| 217 |
% \makeatletter\NCC@thmindenttrue\NCC@thmmargintrue\makeatother |
| 218 |
% \likeremark*{Remark} The apar remark in the |indent + margin| style.\qef |
| 219 |
% \makeatletter\NCC@thmindentfalse\NCC@thmmarginfalse\makeatother |
| 220 |
% |
| 221 |
% As you can see, mixing of all these styles in the same document |
| 222 |
% leads to bad results. This is the reason why these styles are |
| 223 |
% implemented using options. |
| 224 |
% |
| 225 |
% As you can also see from the last example, |
| 226 |
% the |indent| style is ignored for apar theorems typed in |
| 227 |
% the |margin| style. |
| 228 |
% |
| 229 |
% \section{Structure and Types of Theorems} |
| 230 |
% |
| 231 |
% The structure of a theorem is the following: |
| 232 |
% \begin{desclist}{}{\hfill}[\meta{normal-header}\quad] |
| 233 |
% \item[\meta{theorem}] \meta{header} \meta{space-or-break} \meta{body} |
| 234 |
% \item[\meta{header}] \meta{normal-header} \verb+|+ \meta{apar-header} |
| 235 |
% \item[\meta{normal-header}] \meta{title} \oarg{number} \oarg{comment} \meta{after-char} |
| 236 |
% \item[\meta{apar-header}] \meta{apar-tag} \meta{title} \oarg{comment} \meta{after-char} |
| 237 |
% \end{desclist} |
| 238 |
% A theorem type controls the appearance of the following elements |
| 239 |
% of theorems: \meta{title}, \meta{comment}, and \meta{body}. |
| 240 |
% The \meta{number} element inherits the style from \meta{title}. |
| 241 |
% The \meta{after-char} element inherits either the style of \meta{comment} |
| 242 |
% if it presents or the style of \meta{title} otherwise. The style of \meta{apar-tag} |
| 243 |
% is controlled with the special way and will be described later. |
| 244 |
% |
| 245 |
% \DescribeMacro{\newtheoremtype} |
| 246 |
% \DescribeMacro{\renewtheoremtype} |
| 247 |
% The package provides the following theorem type generation commands: |
| 248 |
% \begin{quote} |
| 249 |
% |\newtheoremtype|\marg{type}\marg{title-style}\marg{comment-style}\marg{body-style}\\ |
| 250 |
% |\renewtheoremtype|\marg{type}\marg{title-style}\marg{comment-style}\marg{body-style} |
| 251 |
% \end{quote} |
| 252 |
% The \meta{type} parameter is a type name. Other parameters |
| 253 |
% specify fonts to be used in the corresponding parts of a |
| 254 |
% theorem. |
| 255 |
% Font style parameters are considered to be used after the |
| 256 |
% |\normalfont| command. |
| 257 |
% |
| 258 |
% \DescribeMacro{\like...} |
| 259 |
% When a new theorem type is generated, the |\like|\meta{type} command |
| 260 |
% is created for it. It has two forms: normal and starred. The normal version |
| 261 |
% prints a theorem in the standard mode and the starred version prints |
| 262 |
% an apar theorem. The syntax: |
| 263 |
% \begin{quote} |
| 264 |
% |\like|\meta{type}\marg{title}\marg{number}\oarg{comment}\\ |
| 265 |
% |\like|\meta{type}*\marg{title}\oarg{comment} |
| 266 |
% \end{quote} |
| 267 |
% The starred version of this command has no \meta{number} argument, because |
| 268 |
% it is numbered using the |apar| counter. |
| 269 |
% If the \meta{number} argument in the non-starred version of this command |
| 270 |
% is empty, the number will be omitted in the theorem header. |
| 271 |
% If the \meta{comment} argument presents, the comment is typed enclosed |
| 272 |
% in round brackets. This behaviour can be changed with customization |
| 273 |
% commands. |
| 274 |
% |
| 275 |
% Two theorem types, `|theorem|' and `|remark|', are predefined as follows: |
| 276 |
% \begin{quote} |
| 277 |
% |\newtheoremtype{theorem}{\bfseries}{}{\itshape}|\\ |
| 278 |
% |\newtheoremtype{remark}{\itshape}{}{}| |
| 279 |
% \end{quote} |
| 280 |
% |
| 281 |
% \DescribeMacro\liketheorem |
| 282 |
% \DescribeMacro\likeremark |
| 283 |
% Using the |\liketheorem| and |\likeremark| commands, you can |
| 284 |
% produce a\linebreak theorem of the given type with arbitrary title without |
| 285 |
% generation a special environment for it. It is very useful |
| 286 |
% if a theorem with the given title appears in a document only once. |
| 287 |
% |
| 288 |
% \textbf{Note:} Type generation commands are available in the |
| 289 |
% preamble only. |
| 290 |
% |
| 291 |
% \section{Generate New Theorems} |
| 292 |
% |
| 293 |
% \DescribeMacro\newtheorem |
| 294 |
% A standard theorem environment is generated with the |
| 295 |
% |\newtheorem| command: |
| 296 |
% \begin{quote} |
| 297 |
% |\newtheorem|\marg{env-name}\oarg{counter}\marg{title}\oarg{type} |
| 298 |
% \end{quote} |
| 299 |
% In comparison with the standard \LaTeX\ version of this command, |
| 300 |
% the last optional |
| 301 |
% parameter has another meaning: it specifies a theorem type. |
| 302 |
% This is because its standard meaning (the base counter) |
| 303 |
% useless here. If the \meta{type} parameter is omitted, |
| 304 |
% the `|theorem|' type is used. The optional argument \meta{counter} |
| 305 |
% is a counter this environment will be counted with. If it is |
| 306 |
% omitted, the counter name equal to the \meta{env-name} is used. |
| 307 |
% We do not test the \meta{counter} on existence when |
| 308 |
% a new theorem environment is generated. The theorem counter is declared |
| 309 |
% to be the dynamic counter. It is defined at the first use and |
| 310 |
% inherits the style declared by the latest use of the command |
| 311 |
% \begin{quote} |
| 312 |
% |\countstyle|\marg{base-counter} |
| 313 |
% \end{quote} |
| 314 |
% Its argument contains a name of base-counter for all dynamically |
| 315 |
% created counters. Dynamically created counter is set to zero when the |
| 316 |
% base counter is stepped. Its |\the| command is the following: |
| 317 |
% \begin{quote} |
| 318 |
% |\the|\meta{base-counter}.|\arabic|\marg{dynamic-counter} |
| 319 |
% \end{quote} |
| 320 |
% If the \meta{base-counter} is empty, a dynamic counter will be |
| 321 |
% numbered in the plain style. |
| 322 |
% |
| 323 |
% \qef |
| 324 |
% \textbf{Note:} In contrast with the standard definition, |
| 325 |
% the described |\newtheorem| command may be used with all |
| 326 |
% four parameters. |
| 327 |
% |
| 328 |
% \qef |
| 329 |
% \DescribeMacro{\newtheorem*} |
| 330 |
% To generate a new apar theorem environment, the starred version of |
| 331 |
% the |\newtheorem| command is applied: |
| 332 |
% \begin{quote} |
| 333 |
% |\newtheorem*|\marg{env-name}\marg{title}\oarg{type} |
| 334 |
% \end{quote} |
| 335 |
% All apar theorems are counted with the `|apar|' counter. |
| 336 |
% |
| 337 |
% \DescribeMacro{\renewtheorem} |
| 338 |
% \DescribeMacro{\renewtheorem*} |
| 339 |
% You can also redefine already defined theorem environments |
| 340 |
% using the commands |
| 341 |
% \begin{quote} |
| 342 |
% |\renewtheorem|\marg{env-name}\oarg{counter}\marg{title}\oarg{type}\\ |
| 343 |
% |\renewtheorem*|\marg{env-name}\marg{title}\oarg{type} |
| 344 |
% \end{quote} |
| 345 |
% While redefinition a theorem environment, you can change values of |
| 346 |
% all other parameters after \meta{env-name}. |
| 347 |
% |
| 348 |
% \DescribeMacro\TheoremBreakStyle |
| 349 |
% \DescribeMacro\TheoremNoBreakStyle |
| 350 |
% When a theorem environment is defined or redefined, a decision |
| 351 |
% what must be inserted after the theorem header (space or break) |
| 352 |
% is made on the base of current break style. The |
| 353 |
% |\TheoremBreakStyle| and |\TheoremNoBreakStyle| commands change |
| 354 |
% this style to the `break' and `no-break' respectively. The default |
| 355 |
% style is `no-break'. |
| 356 |
% |
| 357 |
% \textbf{Note:} Theorem generation commands are available in the preamble only. |
| 358 |
% |
| 359 |
% \section{Using Theorems} |
| 360 |
% |
| 361 |
% The syntax of using theorem environments is the following: |
| 362 |
% \begin{quote} |
| 363 |
% |\begin|\marg{env-name}\oarg{comment} \meta{body} |
| 364 |
% |\end|\marg{env-name} |
| 365 |
% \end{quote} |
| 366 |
% You can also use the command-like syntax: |
| 367 |
% \begin{quote} |
| 368 |
% |\|\meta{env-name}\oarg{comment} \meta{body} |\qef| |
| 369 |
% \end{quote} |
| 370 |
% which is more likely for apar theorems. |
| 371 |
% |
| 372 |
% \DescribeMacro\breakafterheader |
| 373 |
% \DescribeMacro\nobreakafterheader |
| 374 |
% You can change a break style for a theorem applying |
| 375 |
% the |\breakafterheader| and |\nobreakafterheader| commands |
| 376 |
% just before using the theorem. |
| 377 |
% |
| 378 |
% Let us do the following in the preamble: |
| 379 |
% \begin{quote} |
| 380 |
% |\countstyle[apar]{section}|\\ |
| 381 |
% |\newtheorem{theorem}{Theorem}|\\ |
| 382 |
% |\newtheorem*{atheorem}{Theorem}|\\ |
| 383 |
% |\TheoremBreakStyle|\\ |
| 384 |
% |\newtheorem{definition}{Definition}[remark]|\\ |
| 385 |
% |\TheoremNoBreakStyle|\\ |
| 386 |
% |\newtheorem{lemma}[theorem]{Lemma}| |
| 387 |
% \end{quote} |
| 388 |
% This code generates 4 theorem environments: the `|theorem|' provides a |
| 389 |
% standard Theorem statement; |
| 390 |
% the `|atheorem|' provides a Theorem statement in the apar mode |
| 391 |
% with per-section numbering; |
| 392 |
% the `|definition|' provides a standard Definition statement |
| 393 |
% prepared as a remark; and the `|lemma|' provides a standard |
| 394 |
% Lemma statement counted with the |theorem| counter. Definitions |
| 395 |
% are printed in the break style. |
| 396 |
% |
| 397 |
% \begin{quote} |
| 398 |
% |\begin{theorem} A theorem. \end{theorem}|\\ |
| 399 |
% |\begin{lemma} A lemma. \end{lemma}|\\ |
| 400 |
% |\breakafterheader|\\ |
| 401 |
% |\begin{theorem}[A comment] A theorem with break.\end{theorem}|\\ |
| 402 |
% |\atheorem A theorem in apar mode. \qef|\\ |
| 403 |
% |\begin{definition} A definition. \end{definition}| |
| 404 |
% \end{quote} |
| 405 |
% This code produces the following: |
| 406 |
% \Line |
| 407 |
% \begin{theorem} A theorem. \end{theorem} |
| 408 |
% \begin{lemma} A lemma. \end{lemma} |
| 409 |
% \breakafterheader |
| 410 |
% \begin{theorem}[A comment] A theorem with break.\end{theorem} |
| 411 |
% \atheorem A theorem in apar mode. \qef |
| 412 |
% \begin{definition} A definition. \end{definition} |
| 413 |
% \Line |
| 414 |
% |
| 415 |
% To prepare a theorem without number or having a special number, |
| 416 |
% use the |\like|\meta{type} command. Examples: |
| 417 |
% \begin{quote} |
| 418 |
% |\liketheorem{Theorem}{A} Special theorem.\qef|\\ |
| 419 |
% |\liketheorem{Proposition}{}[Comment] It has no number.\qef|\\ |
| 420 |
% |\breakafterheader|\\ |
| 421 |
% |\likeremark{Example}{2.3.5} An example.\qef|\\ |
| 422 |
% |\likeremark*{Remark} An apar remark. \qef| |
| 423 |
% \end{quote} |
| 424 |
% This code produces the following: |
| 425 |
% \Line |
| 426 |
% \liketheorem{Theorem}{A} Special theorem.\qef |
| 427 |
% \liketheorem{Proposition}{}[Comment] It has no number.\qef |
| 428 |
% \breakafterheader |
| 429 |
% \likeremark{Example}{2.3.5} An example.\qef |
| 430 |
% \likeremark*{Remark} An apar remark. \qef |
| 431 |
% \Line |
| 432 |
% |
| 433 |
% \DescribeMacro\proof |
| 434 |
% The |\proof| command prints the proof of a math statement. Syntax: |
| 435 |
% \begin{quote} |
| 436 |
% |\proof|\oarg{of-theorem} \meta{body} |\qed| |
| 437 |
% \end{quote} |
| 438 |
% The optional parameter \meta{of-theorem} contains a |
| 439 |
% text appended to the title of proof. The break-style change |
| 440 |
% commands can be applied to this command. Examples: |
| 441 |
% \begin{quote} |
| 442 |
% |\proof An ordinary proof.\qed|\\ |
| 443 |
% |\proof[of Theorem A] A special proof.\qed|\\ |
| 444 |
% |\breakafterheader|\\ |
| 445 |
% |\proof[of the Pythagor Theorem] A proof.\qed| |
| 446 |
% \end{quote} |
| 447 |
% This code produces the following: |
| 448 |
% \Line |
| 449 |
% \proof An ordinary proof.\qed |
| 450 |
% \proof[of Theorem A] A special proof.\qed |
| 451 |
% \breakafterheader |
| 452 |
% \proof[of the Pythagor Theorem] A proof.\qed |
| 453 |
% \Line |
| 454 |
% |
| 455 |
% \section{Apar Sections} |
| 456 |
% |
| 457 |
% Header of an apar theorem is similar to the header printed |
| 458 |
% by the |\paragraph| or |\subparagraph| command (except |
| 459 |
% paragraph numbering that is usually omitted). |
| 460 |
% Moreover, from the logical point of view, the apar |
| 461 |
% theorems are specially designed enumerated paragraphs. |
| 462 |
% Therefore, it is a good idea to use apar markup |
| 463 |
% as some kind of special sectioning. |
| 464 |
% |
| 465 |
% \DescribeMacro\apar |
| 466 |
% The following command supports sectioning in the apar mode: |
| 467 |
% \begin{quote} |
| 468 |
% |\apar|\oarg{title} |
| 469 |
% \end{quote} |
| 470 |
% It produces a new paragraph starting with the \meta{apar-tag} |
| 471 |
% element and having the optional title. The indentation style and |
| 472 |
% marginal style of apar section is the same as for apar theorems. |
| 473 |
% The vertical skip before |
| 474 |
% the apar section is just the same as before theorems. |
| 475 |
% If the |nccsect| package is loaded, the apar skip is equal |
| 476 |
% to the skip produced with the |\paragraph| and |\subparagraph| |
| 477 |
% commands. |
| 478 |
% |
| 479 |
% These properties of apar sections are useful in design of |
| 480 |
% articles having short sections. For example, if an article |
| 481 |
% consists of many short sections prepared with the |\subsection| |
| 482 |
% command, it looks very loose, because subsections are produced |
| 483 |
% in the display style. It will be better to allow subsections |
| 484 |
% run-in paragraph. Using the |\apar| command, you can do this |
| 485 |
% very easy: add the following command to the preamble |
| 486 |
% \begin{quote} |
| 487 |
% |\countstyle[apar]{section}| |
| 488 |
% \end{quote} |
| 489 |
% and prepare subsections with the |\apar| command. Example: |
| 490 |
% \begin{quote} |
| 491 |
% |\apar[Subsection title] Subsection body ...|\\ |
| 492 |
% |\apar[Next title:] The body ...|\\ |
| 493 |
% |\atheorem In fact, this is a special apar section ...|\\ |
| 494 |
% |\apar Subsection without title ...|\\ |
| 495 |
% |\breakafterheader|\\ |
| 496 |
% |\apar[One more title] Break before its body| |
| 497 |
% \end{quote} |
| 498 |
% This code produces the following: |
| 499 |
% \Line |
| 500 |
% \apar[Subsection title] Subsection body ... |
| 501 |
% \apar[Next title:] The body ... |
| 502 |
% \atheorem In fact, this is a special apar section ... |
| 503 |
% \apar Subsection without title ... |
| 504 |
% \breakafterheader |
| 505 |
% \apar[One more title] Break before its body |
| 506 |
% \Line |
| 507 |
% |
| 508 |
% \section{Customization Commands} |
| 509 |
% |
| 510 |
% \DescribeMacro{\NCC@runskip} |
| 511 |
% The vertical skips before and after theorems are identic. They are |
| 512 |
% produced with the |\qef| command. The length of the skip is coded |
| 513 |
% in the inner command |\NCC@runskip|. This command is also used in |
| 514 |
% the |nccsect| package as a skip inserted before the |\paragraph| |
| 515 |
% and |\subparagraph| commands. Its default value |
| 516 |
% \begin{quote} |
| 517 |
% |2.75ex plus 1ex minus 0.2ex| |
| 518 |
% \end{quote} |
| 519 |
% |
| 520 |
% \DescribeMacro{\TheoremCommentDelimiters} |
| 521 |
% The |\TheoremCommentDelimiters|\marg{left}\marg{right} command |
| 522 |
% specifies delimiters inserted before and after a theorem comment. |
| 523 |
% The default setting is: |
| 524 |
% \begin{quote} |
| 525 |
% |\TheoremCommentDelimiters{(}{)}| |
| 526 |
% \end{quote} |
| 527 |
% |
| 528 |
% \DescribeMacro{\AfterTheoremHeaderChar} |
| 529 |
% The |\AfterTheoremHeaderChar|\marg{after-char} command |
| 530 |
% specifies an \meta{after-char} element that ends |
| 531 |
% header of theorem and header of proof. The default setting is |
| 532 |
% an empty element. |
| 533 |
% |
| 534 |
% \DescribeMacro{\AfterTheoremHeaderSkip} |
| 535 |
% The |\AfterTheoremHeaderSkip|\marg{skip-command} command |
| 536 |
% specifies a command inserted between theorem header and body. |
| 537 |
% In break style, this command is ignored. |
| 538 |
% The default setting is: |
| 539 |
% \begin{quote} |
| 540 |
% |\AfterTheoremHeaderSkip{\hskip 1em plus 0.2em minus 0.2em}| |
| 541 |
% \end{quote} |
| 542 |
% |
| 543 |
% \DescribeMacro\ProofStyleParameters |
| 544 |
% The |\ProofStyleParameters|\marg{style}\marg{title} command |
| 545 |
% specifies style parameters used in the |\proof| |
| 546 |
% command: the first one is a font style and the last one |
| 547 |
% is a proof title. The default setting is: |
| 548 |
% \begin{quote} |
| 549 |
% |\ProofStyleParameters{\bfseries}{Proof}| |
| 550 |
% \end{quote} |
| 551 |
% |
| 552 |
% \DescribeMacro\AparStyleParameters |
| 553 |
% The |\AparStyleParameters|\marg{style}\marg{prefix}\marg{suffix} |
| 554 |
% command specifies the style of apar sections: the \meta{style} |
| 555 |
% is a style of apar section title; the tag of apar theorems |
| 556 |
% and sections is prepared using \meta{prefix} and \meta{suffix} |
| 557 |
% specified with this command as follows |
| 558 |
% \meta{prefix}|\theapar|\meta{suffix}. The default setting is: |
| 559 |
% \begin{quote} |
| 560 |
% |\AparStyleParameters{\bfseries}{\bfseries}{\enskip}| |
| 561 |
% \end{quote} |
| 562 |
% |
| 563 |
% \qef |
| 564 |
% \textbf{Note:} All customization commands except the |
| 565 |
% |\NCC@runskip| are allowed in the preamble only. |
| 566 |
% \StopEventually{} |
| 567 |
% |
| 568 |
% \section{The Implementation} |
| 569 |
% |
| 570 |
% \begin{macro}{\NCC@secskip} |
| 571 |
% \begin{macro}{\NCC@runskip} |
| 572 |
% The package shares the following commands with the |
| 573 |
% |nccsect| package: |
| 574 |
% \begin{quote} |
| 575 |
% |\NCC@secskip|\marg{skip} adds the \meta{skip} before a section,\\ |
| 576 |
% |\NCC@runskip| is a skip inserted before run-in sections. |
| 577 |
% \end{quote} |
| 578 |
% We protect the definitions of these commands with testing |
| 579 |
% the |nccsect| package to be already loaded. |
| 580 |
% \begin{macrocode} |
| 581 |
%<*package> |
| 582 |
\@ifpackageloaded{nccsect}{}{% |
| 583 |
\def\NCC@secskip#1{% |
| 584 |
\if@noskipsec \leavevmode \fi \par |
| 585 |
\if@nobreak \everypar{}\else |
| 586 |
\addpenalty\@secpenalty |
| 587 |
\addvspace{#1}% |
| 588 |
\fi |
| 589 |
} |
| 590 |
\def\NCC@runskip{2.75ex \@plus 1ex \@minus .2ex} |
| 591 |
} |
| 592 |
% \end{macrocode} |
| 593 |
% \end{macro} |
| 594 |
% \end{macro} |
| 595 |
% |
| 596 |
% \subsection{Q.E.D. Support} |
| 597 |
% |
| 598 |
% \begin{macro}{\NCC@qedsymbol} |
| 599 |
% \begin{macro}{\qedsymbol} |
| 600 |
% The |\NCC@qedsymbol| command is the base implementation |
| 601 |
% of white Q.E.D. symbol. |
| 602 |
% If no Q.E.D. selection options used, the |
| 603 |
% |\qedsymbol| is equal to the base version. |
| 604 |
% \begin{macrocode} |
| 605 |
\DeclareRobustCommand{\NCC@qedsymbol}{% |
| 606 |
\mbox{\normalsize\normalfont\thinlines \@tempdima 1.5ex |
| 607 |
\advance\@tempdima-2\@wholewidth |
| 608 |
\edef\@tempa{\the\@tempdima}% |
| 609 |
\kern \@wholewidth |
| 610 |
\raisebox\@wholewidth[1.5ex]{% |
| 611 |
\frame{\rule\z@\@tempa\rule\@tempa\z@}}% |
| 612 |
\kern \@wholewidth |
| 613 |
}% |
| 614 |
} |
| 615 |
\let\qedsymbol\NCC@qedsymbol |
| 616 |
% \end{macrocode} |
| 617 |
% \end{macro} |
| 618 |
% \end{macro} |
| 619 |
% |
| 620 |
% \begin{macro}{\qed} |
| 621 |
% \begin{macro}{\qed*} |
| 622 |
% The |\qed| command produces the flush-right Q.E.D. symbol |
| 623 |
% and applies the |\qef| command in the non-starred case. |
| 624 |
% \begin{macrocode} |
| 625 |
\newcommand{\qed}{\NCC@qed{\qedsymbol}} |
| 626 |
\def\NCC@qed#1{\unskip\allowbreak% |
| 627 |
\hspace*{1em plus 1fill minus .2em}#1\@ifstar{}{\qef}% |
| 628 |
} |
| 629 |
% \end{macrocode} |
| 630 |
% \end{macro} |
| 631 |
% \end{macro} |
| 632 |
% |
| 633 |
% \begin{macro}{\qef} |
| 634 |
% The |\qef| finishes a paragraph, adds the |\@secpenalty|, |
| 635 |
% and produces the vertical skip of |\NCC@runskip| size. |
| 636 |
% If also sets the normal font and removes the no-break |
| 637 |
% condition suppressing indentation in the next |
| 638 |
% paragraph. |
| 639 |
% \begin{macrocode} |
| 640 |
\newcommand{\qef}{\NCC@secskip{\NCC@runskip}\@nobreakfalse\normalfont} |
| 641 |
% \end{macrocode} |
| 642 |
% \end{macro} |
| 643 |
% |
| 644 |
% \subsection{Package Options} |
| 645 |
% |
| 646 |
% \begin{macro}{\whiteqedsymbol} |
| 647 |
% \begin{macro}{\whiteqed} |
| 648 |
% The `|whiteqed|' option: |
| 649 |
% \begin{macrocode} |
| 650 |
\DeclareOption{whiteqed}{% |
| 651 |
\let\whiteqedsymbol\NCC@qedsymbol |
| 652 |
\newcommand{\whiteqed}{\NCC@qed{\whiteqedsymbol}} |
| 653 |
\let\qedsymbol\whiteqedsymbol |
| 654 |
} |
| 655 |
% \end{macrocode} |
| 656 |
% \end{macro} |
| 657 |
% \end{macro} |
| 658 |
% |
| 659 |
% \begin{macro}{\blackqedsymbol} |
| 660 |
% \begin{macro}{\blackqed} |
| 661 |
% The `|blackqed|' option: |
| 662 |
% \begin{macrocode} |
| 663 |
\DeclareOption{blackqed}{% |
| 664 |
\DeclareRobustCommand{\blackqedsymbol}{% |
| 665 |
\begingroup\normalsize\normalfont\thinlines |
| 666 |
\rule{1.5ex}{1.5ex}\endgroup |
| 667 |
} |
| 668 |
\newcommand{\blackqed}{\NCC@qed{\blackqedsymbol}} |
| 669 |
\let\qedsymbol\blackqedsymbol |
| 670 |
} |
| 671 |
% \end{macrocode} |
| 672 |
% \end{macro} |
| 673 |
% \end{macro} |
| 674 |
% |
| 675 |
% \begin{macro}{\ifNCC@thmindent} |
| 676 |
% \begin{macro}{\ifNCC@thmmargin} |
| 677 |
% Theorem indentation and marginal numbering options |
| 678 |
% are based on two if-macros: |
| 679 |
% the |NCC@thmindent| controls the indentation of headers and |
| 680 |
% the |NCC@thmmargin| controls the marginal numbering in |
| 681 |
% the apar mode. |
| 682 |
% \begin{macrocode} |
| 683 |
\newif\ifNCC@thmindent |
| 684 |
\newif\ifNCC@thmmargin |
| 685 |
\DeclareOption{noindent}{\NCC@thmindentfalse} |
| 686 |
\DeclareOption{indent}{\NCC@thmindenttrue} |
| 687 |
\DeclareOption{nomargin}{\NCC@thmmarginfalse} |
| 688 |
\DeclareOption{margin}{\NCC@thmmargintrue} |
| 689 |
% \end{macrocode} |
| 690 |
% \end{macro} |
| 691 |
% \end{macro} |
| 692 |
% |
| 693 |
% Set defaults and process all options in the order |
| 694 |
% they appear in the options list. |
| 695 |
% \begin{macrocode} |
| 696 |
\ExecuteOptions{noindent,nomargin} |
| 697 |
\ProcessOptions* |
| 698 |
% \end{macrocode} |
| 699 |
% |
| 700 |
% \subsection{The Kernel} |
| 701 |
% |
| 702 |
% We use the |\@ifempty| command from the |amsgen| package |
| 703 |
% and dynamic counters from the |dcounter| package. |
| 704 |
% \begin{macrocode} |
| 705 |
\RequirePackage{amsgen} |
| 706 |
\RequirePackage{dcounter}[1998/12/19] |
| 707 |
% \end{macrocode} |
| 708 |
% |
| 709 |
% \begin{macro}{\NCC@thmbrmode} |
| 710 |
% \begin{macro}{\ifNCC@thmbr} |
| 711 |
% A theorem break mode is controlled with the |\NCC@thmbrmode| |
| 712 |
% macro and the |\ifNCC@thmbr|. The |\NCC@thmbrmode| can have |
| 713 |
% three possible values: |
| 714 |
% \begin{desclist}{}{\hfill}[\cs{relax}\ ] |
| 715 |
% \item[\cs{relax}] undefined mode; |
| 716 |
% \item[\cs{z@}] break mode; |
| 717 |
% \item[\cs{@ne}] no-break mode. |
| 718 |
% \end{desclist} |
| 719 |
% If the break mode is undefined, the decision is made on the |
| 720 |
% analyzes of the |NCC@thmbr| value: true value means break, |
| 721 |
% false value means no-break. |
| 722 |
% \begin{macrocode} |
| 723 |
\let\NCC@thmbrmode\relax |
| 724 |
\newif\ifNCC@thmbr |
| 725 |
% \end{macrocode} |
| 726 |
% \end{macro} |
| 727 |
% \end{macro} |
| 728 |
% |
| 729 |
% \begin{macro}{\breakafterheader} |
| 730 |
% \begin{macro}{\nobreakafterheader} |
| 731 |
% The |\breakafterheader| and |\nobreakafterheader| |
| 732 |
% commands test the current break mode and set an |
| 733 |
% appropriate mode if it is undefined yet. As a result, |
| 734 |
% usage of these commands before a theorem leads to |
| 735 |
% overriding the default break mode specified in |
| 736 |
% theorem's macro. |
| 737 |
% \begin{macrocode} |
| 738 |
\newcommand\breakafterheader{% |
| 739 |
\ifx\NCC@thmbrmode\relax \global\chardef\NCC@thmbrmode\z@\fi |
| 740 |
} |
| 741 |
\newcommand\nobreakafterheader{% |
| 742 |
\ifx\NCC@thmbrmode\relax \global\chardef\NCC@thmbrmode\@ne\fi |
| 743 |
} |
| 744 |
% \end{macrocode} |
| 745 |
% \end{macro} |
| 746 |
% \end{macro} |
| 747 |
% |
| 748 |
% \begin{macro}{\TheoremBreakStyle} |
| 749 |
% \begin{macro}{\TheoremNoBreakStyle} |
| 750 |
% \begin{macro}{\TheoremCommentDelimiters} |
| 751 |
% \begin{macro}{\AfterTheoremHeaderChar} |
| 752 |
% \begin{macro}{\AfterTheoremHeaderSkip} |
| 753 |
% Theorem customization commands: |
| 754 |
% \begin{macrocode} |
| 755 |
\newcommand{\TheoremBreakStyle}{\NCC@thmbrtrue} |
| 756 |
\newcommand{\TheoremNoBreakStyle}{\NCC@thmbrfalse} |
| 757 |
\newcommand*{\TheoremCommentDelimiters}[2]{% |
| 758 |
\def\NCC@thmcmt@##1{#1\ignorespaces##1\unskip#2}% |
| 759 |
} |
| 760 |
\newcommand*{\AfterTheoremHeaderChar}[1]{\def\NCC@thmchar{#1}} |
| 761 |
\newcommand*{\AfterTheoremHeaderSkip}[1]{\def\NCC@thmskip{#1}} |
| 762 |
\@onlypreamble\TheoremBreakStyle |
| 763 |
\@onlypreamble\TheoremNoBreakStyle |
| 764 |
\@onlypreamble\TheoremCommentDelimiters |
| 765 |
\@onlypreamble\AfterTheoremHeaderChar |
| 766 |
\@onlypreamble\AfterTheoremHeaderSkip |
| 767 |
% \end{macrocode} |
| 768 |
% \end{macro} |
| 769 |
% \end{macro} |
| 770 |
% \end{macro} |
| 771 |
% \end{macro} |
| 772 |
% \end{macro} |
| 773 |
% |
| 774 |
% \begin{macro}{\NCC@thmhdr} |
| 775 |
% The |\NCC@thmhdr|\marg{style}\marg{header} prints a theorem header |
| 776 |
% in the required \meta{style} and implements the current break mode. |
| 777 |
% At the end of macro, the break mode is reset to |\relax|. |
| 778 |
% The header is prepared in a group. |
| 779 |
% \begin{macrocode} |
| 780 |
\def\NCC@thmhdr#1#2{% |
| 781 |
\qef |
| 782 |
% \end{macrocode} |
| 783 |
% Insert a negative low penalty to increase a chance of |
| 784 |
% page break before the beginning of theorem. |
| 785 |
% \begin{macrocode} |
| 786 |
\addpenalty{-\@lowpenalty}% |
| 787 |
\begingroup |
| 788 |
#1% |
| 789 |
% \end{macrocode} |
| 790 |
% Test the break mode. If it is undefined, we set it basing |
| 791 |
% on the value of |\ifNCC@thmbr| switch. |
| 792 |
% \begin{macrocode} |
| 793 |
\ifx\NCC@thmbrmode\relax |
| 794 |
\ifNCC@thmbr \chardef\NCC@thmbrmode\z@ |
| 795 |
\else \chardef\NCC@thmbrmode\@ne |
| 796 |
\fi |
| 797 |
\fi |
| 798 |
% \end{macrocode} |
| 799 |
% The break case: to implement the break in the vertical |
| 800 |
% mode, it is enough to put the header in hbox. To allow |
| 801 |
% multi-line header, we prepare it in inner vbox. |
| 802 |
% \begin{macrocode} |
| 803 |
\ifnum\NCC@thmbrmode=\z@ |
| 804 |
\@tempdima\parindent |
| 805 |
\hbox{\vbox{\hsize\linewidth\@parboxrestore |
| 806 |
\ifNCC@thmindent\parindent\@tempdima\fi |
| 807 |
\leavevmode\strut#2\strut |
| 808 |
}}\nobreak\noindent |
| 809 |
% \end{macrocode} |
| 810 |
% The no-break case: The |\ncc@thmskip| command |
| 811 |
% \begin{macrocode} |
| 812 |
\else |
| 813 |
\ifNCC@thmindent\else\noindent\fi |
| 814 |
\leavevmode{#2\normalfont\NCC@thmskip}\nobreak |
| 815 |
\fi |
| 816 |
\endgroup |
| 817 |
% \end{macrocode} |
| 818 |
% Reset the break mode to the initial value: |
| 819 |
% \begin{macrocode} |
| 820 |
\global\let\NCC@thmbrmode\relax |
| 821 |
} |
| 822 |
% \end{macrocode} |
| 823 |
% \end{macro} |
| 824 |
% |
| 825 |
% \begin{macro}{\NCC@thmcmt} |
| 826 |
% The |\NCC@thmcmt|\marg{comment-style}\marg{comment} tests |
| 827 |
% a comment to be nonempty and produces it in corresponding style. |
| 828 |
% \begin{macrocode} |
| 829 |
\def\NCC@thmcmt#1#2{% |
| 830 |
\@ifempty{#2}{}{\/\space\normalfont#1\NCC@thmcmt@{#2}}% |
| 831 |
} |
| 832 |
% \end{macrocode} |
| 833 |
% \end{macro} |
| 834 |
% |
| 835 |
% \begin{macro}{\NCC@lthm} |
| 836 |
% Standard mode basic command: |
| 837 |
% \begin{quote} |
| 838 |
% |\NCC@lthm|\marg{header-style}\marg{comment-style}\marg{body-style}\marg{title}\\ |
| 839 |
% | |\marg{number}\oarg{comment} |
| 840 |
% \end{quote} |
| 841 |
% \begin{macrocode} |
| 842 |
\def\NCC@lthm#1#2#3#4#5{% |
| 843 |
\@ifnextchar[{\NCC@lthm@{#1}{#2}{#3}{#4}{#5}}% |
| 844 |
{\NCC@lthm@{#1}{#2}{#3}{#4}{#5}[]}% |
| 845 |
} |
| 846 |
\def\NCC@lthm@#1#2#3#4#5[#6]{% |
| 847 |
% \end{macrocode} |
| 848 |
% Prepare theorem header. |
| 849 |
% \begin{macrocode} |
| 850 |
\NCC@thmhdr{}{% |
| 851 |
#1#4\@ifempty{#5}{}{\space#5}% |
| 852 |
\NCC@thmcmt{#2}{#6}\NCC@thmchar |
| 853 |
}% |
| 854 |
% \end{macrocode} |
| 855 |
% Set the body style and do a small skip to avoid extra |
| 856 |
% space after the |\label| command. |
| 857 |
% \begin{macrocode} |
| 858 |
#3\hskip 0.001\p@ \ignorespaces |
| 859 |
} |
| 860 |
% \end{macrocode} |
| 861 |
% \end{macro} |
| 862 |
% |
| 863 |
% \begin{macro}{\NCC@thxhdr} |
| 864 |
% The |\NCC@thxhdr|\marg{style}\marg{header} produces an apar theorem |
| 865 |
% header. |
| 866 |
% \begin{macrocode} |
| 867 |
\def\NCC@thxhdr#1#2{% |
| 868 |
\refstepcounter{apar}% |
| 869 |
\NCC@thmhdr{% |
| 870 |
% \end{macrocode} |
| 871 |
% In margin style, the indent style is turned off for apar theorems: |
| 872 |
% \begin{macrocode} |
| 873 |
\ifNCC@thmmargin \NCC@thmindentfalse \fi |
| 874 |
#1% |
| 875 |
}{% |
| 876 |
% \end{macrocode} |
| 877 |
% Put the \meta{apar-tag} (prepared in the |\NCC@thmapar| command) |
| 878 |
% before the header using |\llap| or |\hbox|. Then put the header. |
| 879 |
% \begin{macrocode} |
| 880 |
\ifNCC@thmmargin \llap{\NCC@thmapar}\else \hbox{\NCC@thmapar}\fi |
| 881 |
#2% |
| 882 |
}% |
| 883 |
} |
| 884 |
% \end{macrocode} |
| 885 |
% \end{macro} |
| 886 |
% |
| 887 |
% \begin{macro}{\NCC@lthx} |
| 888 |
% Apar mode basic command: |
| 889 |
% \begin{quote} |
| 890 |
% |\NCC@lthx|\marg{header-style}\marg{comment-style}\marg{body-style}\marg{title}\\ |
| 891 |
% | |\oarg{comment} |
| 892 |
% \end{quote} |
| 893 |
% \begin{macrocode} |
| 894 |
\def\NCC@lthx#1#2#3#4{% |
| 895 |
\@ifnextchar[{\NCC@lthx@{#1}{#2}{#3}{#4}}% |
| 896 |
{\NCC@lthx@{#1}{#2}{#3}{#4}[]}% |
| 897 |
} |
| 898 |
\def\NCC@lthx@#1#2#3#4[#5]{% |
| 899 |
\NCC@thxhdr{}{% |
| 900 |
\normalfont#1#4\NCC@thmcmt{#2}{#5}\NCC@thmchar |
| 901 |
}% |
| 902 |
#3\hskip 0.001\p@ \ignorespaces |
| 903 |
} |
| 904 |
% \end{macrocode} |
| 905 |
% \end{macro} |
| 906 |
% |
| 907 |
% \begin{macro}{\NCC@likethm} |
| 908 |
% The base for |\like|\meta{type} commands. It passes the control |
| 909 |
% to |\NCC@lthm| or |\NCC@lthx| depending on the star appearing |
| 910 |
% after the third parameter: |
| 911 |
% \begin{quote} |
| 912 |
% |\NCC@likethm|\marg{header-style}\marg{comment-style}\marg{body-style}\marg{title}\\ |
| 913 |
% | |\marg{number}\oarg{comment}\\ |
| 914 |
% |\NCC@likethm|\marg{header-style}\marg{comment-style}\marg{body-style}|*|\marg{title}\\ |
| 915 |
% | |\oarg{comment} |
| 916 |
% \end{quote} |
| 917 |
% \begin{macrocode} |
| 918 |
\def\NCC@likethm#1#2#3{% |
| 919 |
\@ifstar{\NCC@lthx{#1}{#2}{#3}}{\NCC@lthm{#1}{#2}{#3}}% |
| 920 |
} |
| 921 |
% \end{macrocode} |
| 922 |
% \end{macro} |
| 923 |
% |
| 924 |
% \subsection{Apar Sections} |
| 925 |
% |
| 926 |
% The counter used in the apar mode is dynamic: |
| 927 |
% \begin{macrocode} |
| 928 |
\DeclareDynamicCounter{apar} |
| 929 |
% \end{macrocode} |
| 930 |
% |
| 931 |
% \begin{macro}{\AparStyleParameters} |
| 932 |
% Apar style parameters provider: |
| 933 |
% \begin{macrocode} |
| 934 |
\newcommand*{\AparStyleParameters}[3]{% |
| 935 |
\def\NCC@thmaparstyle{#1}% |
| 936 |
\def\NCC@thmapar{#2\theapar#3}% |
| 937 |
} |
| 938 |
\@onlypreamble\AparStyleParameters |
| 939 |
% \end{macrocode} |
| 940 |
% \end{macro} |
| 941 |
% |
| 942 |
% \begin{macro}{\apar} |
| 943 |
% The |\apar|\oarg{title} command starts a new apar-numbered |
| 944 |
% paragraph. If the \meta{title} is omitted or empty, |
| 945 |
% we must ignore the |\NCC@thmskip|. |
| 946 |
% \begin{macrocode} |
| 947 |
\newcommand*{\apar}[1][]{% |
| 948 |
\NCC@thxhdr{\NCC@thmaparstyle} |
| 949 |
{\@ifempty{#1}{\let\NCC@thmskip\@empty}{\ignorespaces#1\unskip}}% |
| 950 |
\hskip 0.001\p@ \ignorespaces |
| 951 |
} |
| 952 |
% \end{macrocode} |
| 953 |
% \end{macro} |
| 954 |
% |
| 955 |
% \subsection{Proof of Theorem} |
| 956 |
% |
| 957 |
% \begin{macro}{\ProofStyleParameters} |
| 958 |
% Proof style parameters provider: |
| 959 |
% \begin{macrocode} |
| 960 |
\newcommand*{\ProofStyleParameters}[2]{% |
| 961 |
\def\NCC@thmproofstyle{#1}% |
| 962 |
\def\NCC@thmproof{#2}% |
| 963 |
} |
| 964 |
\@onlypreamble\ProofStyleParameters |
| 965 |
% \end{macrocode} |
| 966 |
% \end{macro} |
| 967 |
% |
| 968 |
% \begin{macro}{\proof} |
| 969 |
% The |\proof|\oarg{of-theorem} command: |
| 970 |
% \begin{macrocode} |
| 971 |
\newcommand*{\proof}[1][]{% |
| 972 |
\NCC@thmhdr{\NCC@thmproofstyle}{% |
| 973 |
\NCC@thmproof |
| 974 |
\@ifempty{#1}{}{\space\ignorespaces#1\unskip}% |
| 975 |
\NCC@thmchar |
| 976 |
}% |
| 977 |
\hskip 0.001\p@ \ignorespaces |
| 978 |
} |
| 979 |
% \end{macrocode} |
| 980 |
% \end{macro} |
| 981 |
% |
| 982 |
% \subsection{Generate New Theorem Types} |
| 983 |
% |
| 984 |
% \begin{macro}{\like...} |
| 985 |
% New theorem type generation means definition a |\like|\meta{type} |
| 986 |
% command preparing theorems of corresponding type. |
| 987 |
% The syntax of a |\like|\meta{type} command is |
| 988 |
% the following: |
| 989 |
% \begin{quote} |
| 990 |
% |\like|\meta{type}\marg{title}\marg{number}\oarg{comment}\\ |
| 991 |
% |\like|\meta{type}|*|\marg{title}\oarg{comment} |
| 992 |
% \end{quote} |
| 993 |
% The first one produces a standard theorem and the last one produces |
| 994 |
% an apar theorem. |
| 995 |
% \end{macro} |
| 996 |
% |
| 997 |
% \begin{macro}{\newtheoremtype} |
| 998 |
% \begin{macro}{\renewtheoremtype} |
| 999 |
% Theorem type generation commands: |
| 1000 |
% \begin{quote} |
| 1001 |
% |\newtheoremtype|\marg{type}\marg{title-style}\marg{comment-style}\marg{body-style}\\ |
| 1002 |
% |\renewtheoremtype|\marg{type}\marg{title-style}\marg{comment-style}\marg{body-style} |
| 1003 |
% \end{quote} |
| 1004 |
% \begin{macrocode} |
| 1005 |
\newcommand*{\newtheoremtype}[1]{% |
| 1006 |
\edef\@tempa{\noexpand\newcommand*{\expandafter\noexpand |
| 1007 |
\csname like#1\endcsname}}\NCC@nthmtype |
| 1008 |
} |
| 1009 |
\newcommand*{\renewtheoremtype}[1]{% |
| 1010 |
\edef\@tempa{\noexpand\renewcommand*{\expandafter\noexpand |
| 1011 |
\csname like#1\endcsname}}\NCC@nthmtype |
| 1012 |
} |
| 1013 |
\def\NCC@nthmtype#1#2#3{\@tempa{\NCC@likethm{#1}{#2}{#3}}} |
| 1014 |
\@onlypreamble\newtheoremtype |
| 1015 |
\@onlypreamble\renewtheoremtype |
| 1016 |
\@onlypreamble\NCC@nthmtype |
| 1017 |
% \end{macrocode} |
| 1018 |
% \end{macro} |
| 1019 |
% \end{macro} |
| 1020 |
% |
| 1021 |
% \subsection{Generate New Theorems} |
| 1022 |
% |
| 1023 |
% \begin{macro}{\NCC@thmdef} |
| 1024 |
% Basic theorem generation command: |
| 1025 |
% \begin{quote} |
| 1026 |
% |\NCC@thmdef|\marg{env-name}\marg{action}\marg{parameters}\oarg{type} |
| 1027 |
% \end{quote} |
| 1028 |
% The |\@tempa| command must contain either |\noexpand\newenvironment| or |
| 1029 |
% |\noexpand\renewenvironment| before the call. |
| 1030 |
% The \meta{action} is an action applied at the beginning |
| 1031 |
% of theorem. The \meta{parameters} contains parameters passed |
| 1032 |
% to the |\like|\meta{type} command. |
| 1033 |
% \begin{macrocode} |
| 1034 |
\def\NCC@thmdef#1#2#3{% |
| 1035 |
\@ifnextchar[{\NCC@thmdef@{#1}{#2}{#3}}% |
| 1036 |
{\NCC@thmdef@{#1}{#2}{#3}[theorem]}% |
| 1037 |
} |
| 1038 |
\def\NCC@thmdef@#1#2#3[#4]{% |
| 1039 |
% \end{macrocode} |
| 1040 |
% Generate an error if the given type is unknown. |
| 1041 |
% \begin{macrocode} |
| 1042 |
\@ifundefined{like#4}{% |
| 1043 |
\PackageError{nccthm}{Unknown theorem type `#4'}{}% |
| 1044 |
}% |
| 1045 |
% \end{macrocode} |
| 1046 |
% |\@tempa := \[re]newenvironment|\marg{env-name}|{#1\like|\meta{type}|#2}| |
| 1047 |
% \begin{macrocode} |
| 1048 |
\edef\@tempa##1##2{% |
| 1049 |
\@tempa{#1}{##1\expandafter\noexpand\csname like#4\endcsname##2}% |
| 1050 |
}% |
| 1051 |
% \end{macrocode} |
| 1052 |
% Generate a theorem envirinment: |
| 1053 |
% \begin{macrocode} |
| 1054 |
\ifNCC@thmbr |
| 1055 |
\@tempa{#2\breakafterheader}{#3}{\qef\ignorespacesafterend}% |
| 1056 |
\else |
| 1057 |
\@tempa{#2\nobreakafterheader}{#3}{\qef\ignorespacesafterend}% |
| 1058 |
\fi |
| 1059 |
} |
| 1060 |
\@onlypreamble\NCC@thmdef |
| 1061 |
\@onlypreamble\NCC@thmdef@ |
| 1062 |
% \end{macrocode} |
| 1063 |
% \end{macro} |
| 1064 |
% |
| 1065 |
% \begin{macro}{\newtheorem} |
| 1066 |
% \begin{macro}{\renewtheorem} |
| 1067 |
% \begin{macro}{\newtheorem*} |
| 1068 |
% \begin{macro}{\renewtheorem*} |
| 1069 |
% Theorem generation commands: |
| 1070 |
% \begin{quote} |
| 1071 |
% |\newtheorem|\marg{env-name}\oarg{counter}\marg{title}\oarg{type}\\ |
| 1072 |
% |\renewtheorem|\marg{env-name}\oarg{counter}\marg{title}\oarg{type}\\ |
| 1073 |
% |\newtheorem*|\marg{env-name}\marg{title}\oarg{type}\\ |
| 1074 |
% |\renewtheorem*|\marg{env-name}\marg{title}\oarg{type} |
| 1075 |
% \end{quote} |
| 1076 |
% \begin{macrocode} |
| 1077 |
\renewcommand*{\newtheorem}{\def\@tempa{\noexpand\newenvironment}% |
| 1078 |
\@ifstar{\NCC@nthx}{\NCC@nthm}} |
| 1079 |
\newcommand*{\renewtheorem}{\def\@tempa{\noexpand\renewenvironment}% |
| 1080 |
\@ifstar{\NCC@nthx}{\NCC@nthm}} |
| 1081 |
\def\NCC@nthx#1#2{\NCC@thmdef{#1}{}{*{#2}}} |
| 1082 |
\def\NCC@nthm#1{\@ifnextchar[{\NCC@nthm@{#1}}{\NCC@nthm@{#1}[#1]}} |
| 1083 |
\def\NCC@nthm@#1[#2]#3{% |
| 1084 |
\DeclareDynamicCounter{#2}% |
| 1085 |
\NCC@thmdef{#1}{\refstepcounter{#2}}{{#3}{\csname the#2\endcsname}}% |
| 1086 |
} |
| 1087 |
\@onlypreamble\newtheorem |
| 1088 |
\@onlypreamble\renewtheorem |
| 1089 |
\@onlypreamble\NCC@nthx |
| 1090 |
\@onlypreamble\NCC@nthm |
| 1091 |
\@onlypreamble\NCC@nthm@ |
| 1092 |
% \end{macrocode} |
| 1093 |
% \end{macro} |
| 1094 |
% \end{macro} |
| 1095 |
% \end{macro} |
| 1096 |
% \end{macro} |
| 1097 |
% |
| 1098 |
% \subsection{Defaults} |
| 1099 |
% |
| 1100 |
% \begin{macrocode} |
| 1101 |
\newtheoremtype{theorem}{\bfseries}{}{\itshape} |
| 1102 |
\newtheoremtype{remark}{\itshape}{}{} |
| 1103 |
\TheoremNoBreakStyle |
| 1104 |
\TheoremCommentDelimiters{(}{)} |
| 1105 |
\AfterTheoremHeaderChar{} |
| 1106 |
\AfterTheoremHeaderSkip{\hskip 1em \@plus .2em \@minus .2em} |
| 1107 |
\AparStyleParameters{\bfseries}{\bfseries}{\enskip} |
| 1108 |
\ProofStyleParameters{\bfseries}{Proof} |
| 1109 |
%</package> |
| 1110 |
% \end{macrocode} |
| 1111 |
\endinput |