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