summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/alnumsec/alnumsec.dtx
blob: 6770b0d06eb87f67f4bc7b87ea5ae2dd4e986440 (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
% \CheckSum{489}
% \iffalse meta-comment
% 
% This is file `alnumsec.dtx'.
% 
% Copyright (C) 2003-2007 Frank Küster (frank@kuesterei.ch)
% 
% --------------------------------------------------------------------------
% 
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
% 
% This work has the LPPL maintenance status "maintained".
% 
% This Current Maintainer of this work is Frank Küster.
% 
% This work consists of the files README, alnumsec.ins, alnumsec.dtx,
% and the derived file alnumsec.sty.
% 
% \fi
%
% \iffalse
% \charactertable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
% \fi
%
% \iffalse
%<*dtx>
            \ProvidesFile{alnumsec.dtx}
%</dtx>
%\NeedsTeXFormat{LaTeX2e}[1995/12/01]
%<driver>\ProvidesFile{alnumsec.drv}
%<alnumsec>\ProvidesPackage{alnumsec}
            [2007/07/27 v0.03 alphanumeric section numbers with
            ordinary sectioning commands]
%<*driver>
\documentclass{ltxdoc}
\usepackage{hypdoc}
\hypersetup{pdfkeywords={LaTeX,package,alnumsec},pdfstartview={}}
\EnableCrossrefs
\DoNotIndex{\@addtoreset,\@arabic,\@gobble,\@Alph,\@alph}
\DoNotIndex{\@ctrerr,\@ifnextchar,\@ifstar,\@ifundefined}
\DoNotIndex{\@minus,\@namedef,\@nameuse,\@nil}
\DoNotIndex{\@onelevel@sanitize,\@plus,\@sptoken}
\DoNotIndex{\@startsection}
\DoNotIndex{\\,\ ,\|,\@tmpA,\@tmpB,\@tmpC}
\DoNotIndex{\addtocounter,\alpha}
\DoNotIndex{\AfterPackage,\arabic,\AtEndDocument,\AtBeginDocument,\author,\addchap}
\DoNotIndex{\beta,\begin,\caption,\ClassError,\ClassWarning,\csname,\CurrentOption}
\DoNotIndex{\c@experiment,\cfigure,\c@fk@argnumber,\c@paragraph,\c@subexperiment,\c@subparagraph,\c@subsection}
\DoNotIndex{\centering,\chapter,\chi}
\DoNotIndex{\DeclareOption,\def,\documentclass,\dots,\date,\delta}
\DoNotIndex{\edef,\emph,\endinput,\epsilon,\eta}
\DoNotIndex{\if,\else,\fi,\empty,\end,\endcsname,\expandafter}
\DoNotIndex{\fbox,\FK@@sp@b,\FK@@sp@c,\FK@@sp@d,\FK@tempa,\FK@toks@,\FK@@sp@def,\frontmatter,\futurelet}
\DoNotIndex{\fk@old@addcontentsline,\fk@old@appendix,\fk@old@backmatter}
\DoNotIndex{\if@mainmatter,\fi,\ifnum,\fi}
\DoNotIndex{\ifx,\fi,\input,\ifcase,\or,\fi,\iota}
\DoNotIndex{\gamma,\kappa,\lambda}
\DoNotIndex{\l@chapter,\l@section,\l@subsection,\l@experiment,\l@labday,\l@subexperiment,\label,\let,\LoadClass}
\DoNotIndex{\maketitle,\MessageBreak,\mu}
\DoNotIndex{\newcommand,\newcounter,\newif,\newtoks,\nobreak,\normalfont,\nu}
\DoNotIndex{\othertext,\omega}
\DoNotIndex{\par,\PassOptionsToClass,\printindex,\ProcessOptions,\PackageError,\pi,\psi}
\DoNotIndex{\protect,\protected@edef,\protected@xdef,\providecommand}
\DoNotIndex{\raggedsection,\refstepcounter,\relax,\renewcommand,\RequirePackage,\rule,\rho}
\DoNotIndex{\@roman,\@Roman}
\DoNotIndex{\sectfont,\setcounter,\size@section,\space,\stepcounter,\sigma}
\DoNotIndex{\tableofcontents,\tau}
\DoNotIndex{\title,\upsilon,\value,\varepsilon,\varphi,\vartheta}
\DoNotIndex{\usepackage,\Xothertext,\Xsometext,\z@,\xi,\zeta}
\CodelineIndex
%
\begin{document}
 \DocInput{alnumsec.dtx}
\end{document}
%</driver>
% \fi
% 
% \GetFileInfo{alnumsec.dtx}
% \RecordChanges
%
% \MacroIndent=2em
% \setcounter{IndexColumns}{2}
% 
% \MakeShortVerb{\|}
% \MakeShortVerb{\§}
%
% \title{alnumsec.sty: Using alphanumeric section numbering with
%   standard sectioning commands\texorpdfstring{\thanks{%^^A
%          This package has version number \fileversion, last revised \filedate.}}{}}
% \author{Frank K\"uster\\
%         \href{mailto:frank@kuesterei.ch}{\texttt{frank@kuesterei.ch}}}
% \date{\filedate}
% \maketitle{}
%
% \begin{abstract}
%   \noindent This package allows you to use alphanumeric section 
%   numbering, e.g.  A. Introduction; III. International Law. It's
%   output is similar to alphanum.sty, but you can use the standard
%   \LaTeX\ sectioning commands. Thus it is possible to switch numbering
%   schemes easily.  Greek letters, double letters (bb) and different
%   delimiters around them are supported.
% \end{abstract}
%
% \tableofcontents{}
% \def\partname{Part}
%
% \clearpage
% \part{User documentation}
% \label{part:user-documentation}
%
% \section{Options}
% \label{sec:options}
%
% There is only one option: If you specify |usehighlevels|, then the
% numbers for every heading will start with the numbers of the superior
% levels, as without the package (e.g. A.II.3.(a) Important Section).
% Without the option, only the number of the current section level is
% used, e.g. (a) Important Section. This seems to be common with
% alphanumeric numbering.
%
% \section{Specifying the numbering scheme}
% \label{sec:spec-numb-scheme}
%
% You specify the numbering scheme for the headings with the macro
% \begin{verbatim}
% \alnumsecstyle{<list of one-letter-specifiers>}
% \end{verbatim}
% with the following specifiers:
% \begin{center}
% \begin{minipage}{0.8\textwidth}\renewcommand*{\thempfootnote}{\arabic{mpfootnote}}
% \begin{description}
% \item[a or n] stands for \textbf{arabic} number: 6
% \item[R] stands for an uppercase \textbf{Roman} number: VI
% \item[r] stands for a lowercase \textbf{roman} number: vi
% \item[L] stands for an uppercase \textbf{Letter}: A
% \item[l] stands for a lowercase \textbf{letter}: a
% \item[g] is for \textbf{greek} letter: $\alpha$
% \item[d] is for two lowercase letters (\textbf{doubleletter}): aa, bb
% \item[b] for two greek letters (\textbf{doublegreek})\footnotemark: $\alpha\alpha$
% \end{description}
% \end{minipage}
% \end{center}
% \footnotetext{The b is from \emph{bis}, latin for "twice", since the
%   greek word would also yield a \textbf{d}.}
%
% The numbers and letters are all followed by a period per default, if
% you want to change this, use the macro
% \begin{verbatim}
% \surround<name>{<before>}{<after>}
% \end{verbatim}
% Instead of |<name>|, put the word given in boldface in the list above
% (case matters!), |<before>| and |<after>| will be typeset around the
% number of type name.
%
% If you use some number types twice, e.g. arabic numbers for the second
% and fifth level: |\alnumsecstyle{LaRla}|, you might want to
% distinguish between the two numbers by their separators. To achieve
% this, you give the separators for lower levels in the optional
% argument(s) to |\surround<name>|. In the example, you might use
% |\surroundarabic[(]{}{)}| to achieve A. 2) III. d. (4) or
% |\surroundarabic[(][)]{}{.}| for A. 2. III. d. (4). Note, however,
% that alnumsec does \emph{not} recognize that a number type has yet
% been used and that it now should use the alternative separators.
% Instead, you have to specify the first level for which alternative
% separators should be used with the command
% |\otherseparators{<level>}|. In \LaTeX, chapter, if defined, has
% level 0, section has 1 and so on down to subparagraph with level
% 5. Therefore, in the above example, |\otherseparators{5}| would
% work, but |\otherseparators{3}| as well.
%
% Please note that |\alnumsecstyle| does not change the numbering
% scheme of figures or tables (yet).
% So if a |report| or |book| like document class will be used,
% one can get double periods there.
% But this can be corrected easily, for example the |figure| counter
% representation is usually defined as something like
% \begin{quote}
%  |\newcommand\thefigure{%|\\
%  |  \ifnum\value{chapter}>0 \thechapter.\fi \arabic{figure}}|
% \end{quote}
% So to remove the extra period here one can insert
% \begin{quote}
%  |\renewcommand\thefigure{%|\\
%  |  \ifnum\value{chapter}>0 \thechapter\fi \arabic{figure}}|
% \end{quote}
% right after the use of |\alnumsecstyle|. (same for tables)
%
%
% \section{Sectioning levels to use}
% \label{sec:sect-levels-use}
%
% Many people that use alphanumeric sectioning numbers also seem to use
% many, many levels of sectioning commands - alnumsec.sty can handle
% this. If you only use the levels that are defined in the standard
% classes (i.e. from |\chapter| or |\section| to |\subparagraph|), you
% don't have to do anything. |\part| is not treated at all by
% alnumsec.sty.
%
%\newcommand*{\labday}{\textbackslash\texttt{labday}}\newcommand*{\experiment}{\textbackslash\texttt{experiment}}
%\newcommand*{\typesection}{\textbackslash\texttt{section}}\newcommand*{\typechapter}{\textbackslash\texttt{chapter}}
% If you have more (or simply other\footnote{With other, I mean other
%   names for the same concept -- e.g. my labbook.cls uses \labday\
%   instead of \typechapter\ and \experiment\ instead of \typesection.
%   Different concepts, as e.g. in alphanum.sty, won't work. But anyway,
%   you'll only want to use one of both.}) sectioning macros, you have
% to tell alnumsec about their names and whether the first is on
% \LaTeX{}s level 0 (like chapter) or 1 (like section). This is done
% with the macro |\alnumsectionlevels| - here is what the package uses
% for the article class:
% \begin{verbatim}
%  \alnumsectionlevels{1}{section,subsection,subsubsection,paragraph,subparagraph}
% \end{verbatim}
%
% If you use this macro, you have to do it \emph{before}
% |\alnumsecstyle|!\smallskip
%
% alnumsec.sty assumes that the number is typeset using |\the<name>| for
% section level |<name>|. This will always be the case if the macro has
% been defined using the \LaTeX\ macro designed for this,
% |\@startsection|.
%
%
% \section{Bugs and Limitations}
% \label{sec:bugs-limitations}
%
% Currently I am not aware of any real bugs, but one could imagine a lot
% of more features. However, since I wrote this package for somebody
% else's needs and don't use it myself, I need input from users to be
% able to improve it.
%
% \StopEventually{\PrintIndex\PrintChanges}
%
% \clearpage
% \part{Implementation}
%
%
%
%    \begin{macrocode}
%<*alnumsec>
\newif\ifusepreviouslevels\usepreviouslevelsfalse%
\DeclareOption{usehighlevels}{\usepreviouslevelstrue}%
\ProcessOptions%
\RequirePackage{ifthen}%
%    \end{macrocode}
% 
% Macros for greek "numbers" and double letters:
% \changes{v0.03}{2007/07/27}{Define \cs{@greek} et al with \cs{providecommand}}
%
%    \begin{macrocode}
\providecommand*{\@greek}[1]{\ifcase#1\relax\or$\alpha$\or$\beta$\or
  $\gamma$\or$\delta$\or$\varepsilon$\or$\zeta$\or$\eta$\or$\vartheta$\or
  $\iota$\or$\kappa$\or$\lambda$\or$\mu$\or$\nu$\or$\xi$\or$o$\or$\pi$\or
  $\rho$\or$\sigma$\or$\tau$\or$\upsilon$\or$\varphi$\or$\chi$\or$\psi$\or
  $\omega$\else\@ctrerr\fi}%
\providecommand*{\@doublegreek}[1]{\@greek{#1}{\@greek{#1}}}
\providecommand*{\@doublealph}[1]{\@alph{#1}{\@alph{#1}}}
\newcounter{alnumsec@level}%
\newcounter{fk@secdepth}%
\newcounter{fk@secstart}%
\newcounter{fk@changelevel}\setcounter{fk@changelevel}{20}%
%    \end{macrocode}
% 
% |alnumsec@level| is the dynamic counter used while browsing through
% the levels. |fk@secdepth| is the number of sectioning levels for
% which names are known and thus numbers can be assigned. |fk@secstart|
% will be the starting value for every use of |alnumsec@level|, i.e. it
% will be 0 if |\chapter|\footnote{or some other macro on the level 0}
% is defined and  1 otherwise. |fk@changelevel| is the level from which
% the alternative separators for lower levels will be used. It is
% initially set very high so that lower level separators won't be used
% unless this counter is changed, using the following command:
%
%    \begin{macrocode}
\def\otherseparators#1{%
  \setcounter{fk@changelevel}{#1}
}
%    \end{macrocode}
% 
% |\alnumsectionlevels| is the command for users that have more or
% different than the usual section names. The main work is done by
% |\fk@countlevels|, after that |fk@secdepth| is set to the number of
% known levels.
%
%    \begin{macrocode}
\def\alnumsectionlevels#1#2{%
  \setcounter{fk@secstart}{#1}
  \setcounter{alnumsec@level}{#1}%
  \fk@countlevels#2,\relax,%
  \setcounter{fk@secdepth}{\value{alnumsec@level}}%
  \addtocounter{fk@secdepth}{-1}
}
%    \end{macrocode}
% 
% |\fk@countlevels| goes through the comma separated list of level names
% until it encounters the relax that has been put at the end by
% |\alnumsectionlevels|. For each level, it puts this name into a
% "numbered" name, e.g. |\fk@levelname1|, and increases the counter.
%
%    \begin{macrocode}
\def\fk@countlevels#1,{%
  \ifx\relax#1%
    \empty%
  \else%
    \expandafter\def\csname fk@levelname\thealnumsec@level\endcsname{#1}%
    \stepcounter{alnumsec@level}%
    \expandafter\fk@countlevels%
  \fi%
}
%    \end{macrocode}
% 
% |\alnumsecstyle| is the macro with which the user specifies the
% numbering scheme and, implicitly, the level of the last numbered
% section. It feeds its argument to |\fk@scanstyle| and later sets
% |secnumdepth|. This counter has to be lowered by one because
% |\fk@scanstyle| increments |alnumsec@level| \emph{after} it has parsed
% each letter, so after the last letter it is incremented once more.
% Then |\fk@assignstyle| is called which actually defines |\thesection|
% and friends.
%
%    \begin{macrocode}
\def\alnumsecstyle#1{%
  \setcounter{alnumsec@level}{\value{fk@secstart}}%
  \fk@scanstyle#1\relax%
  \setcounter{secnumdepth}{\value{alnumsec@level}}%
  \addtocounter{secnumdepth}{-1}%
  \setcounter{alnumsec@level}{\value{fk@secstart}}%
  \fk@assignstyle%
}%
\def\fk@scanstyle#1{%
  \ifx\relax#1%
    \relax%
  \else%
    \ifnum\c@alnumsec@level>\c@fk@secdepth%
      \PackageError{alnumsec}{%
        more numbering levels than sectioning levels}{%
        You have specified \thealnumsec@level\space different
        numbering styles.\MessageBreak However, only
        \thefk@secdepth\space sectioning commands have been defined,
        down to \csname fk@levelname\thefk@secdepth\endcsname.
      }%
    \else%
      \fk@whichstyle{#1}%
      \stepcounter{alnumsec@level}%
    \fi%
    \expandafter\fk@scanstyle%
  \fi%
}
\newif\iffk@letterknown\fk@letterknownfalse
\def\fk@whichstyle#1{%
  \if R#1%
    \fk@defsecstyle{\thealnumsec@level}{\@Roman}{Roman}%
    \fk@letterknowntrue
  \fi%
  \if r#1%
    \fk@defsecstyle{\thealnumsec@level}{\@roman}{roman}%
    \fk@letterknowntrue
  \fi%
  \if n#1%
    \fk@defsecstyle{\thealnumsec@level}{\@arabic}{arabic}%
    \fk@letterknowntrue
  \fi%
  \if a#1%
    \fk@defsecstyle{\thealnumsec@level}{\@arabic}{arabic}%
    \fk@letterknowntrue
  \fi%
  \if L#1%
    \fk@defsecstyle{\thealnumsec@level}{\@Alph}{Letter}%
    \fk@letterknowntrue
  \fi%
  \if l#1%
    \fk@defsecstyle{\thealnumsec@level}{\@alph}{letter}%
    \fk@letterknowntrue
  \fi%
  \if g#1%
    \fk@defsecstyle{\thealnumsec@level}{\@greek}{greek}%
    \fk@letterknowntrue
  \fi%
  \if d#1%
    \fk@defsecstyle{\thealnumsec@level}{\@doublealph}{doubleletter}%
    \fk@letterknowntrue
  \fi%
  \if b#1%
    \fk@defsecstyle{\thealnumsec@level}{\@doublegreek}{doublegreek}%
    \fk@letterknowntrue
  \fi%
  \iffk@letterknown\else%
    \PackageError{alnumsec}{unknown specifier: #1}{%
      You have given #1 as specifier for the numbering
      scheme.\MessageBreak
      Only the following are known:\MessageBreak
      nrRLldgb
    }
  \fi
}
\def\fk@defsecstyle#1#2#3{%
  \edef\fk@seclevel{\csname fk@levelname#1\endcsname}%
  \expandafter\def\csname fk@\thealnumsec@level num\endcsname{#2}%
  \ifnum\c@alnumsec@level<\c@fk@changelevel%
    \expandafter\def%
      \csname fk@pre@\thealnumsec@level\expandafter\endcsname\expandafter{%
      \csname fk@pre@#3\endcsname}%
    \expandafter\def%
      \csname fk@post@\thealnumsec@level\expandafter\endcsname\expandafter{%
      \csname fk@post@#3\endcsname}%
  \else%
    \expandafter\def%
      \csname fk@lower@pre@\thealnumsec@level\expandafter\endcsname\expandafter{%
      \csname fk@lower@pre@#3\endcsname}%
    \expandafter\def%
      \csname fk@lower@post@\thealnumsec@level\expandafter\endcsname\expandafter{%
      \csname fk@lower@post@#3\endcsname}%
  \fi%
}%
%    \end{macrocode}
%
% In |\fk@assignstyle|, the first level has to be treated differently to
% allow the use of the previous levels for the lower levels.
%
%    \begin{macrocode}
\def\fk@assignstyle{%
  \edef\fk@secname{\csname fk@levelname\thefk@secstart\endcsname}%
  \expandafter\@namedef{the\fk@secname\expandafter}\expandafter{%
    \csname fk@pre@\thealnumsec@level\expandafter\endcsname%
    \csname fk@\thefk@secstart num\expandafter\endcsname%
    \csname c@\fk@secname\expandafter\endcsname%
    \csname fk@post@\thealnumsec@level\expandafter\endcsname%
  }%
  \whiledo{%
    \c@alnumsec@level<\c@secnumdepth%
  }{%
    \stepcounter{alnumsec@level}%
    \let\fk@previoussecname\fk@secname%
    \edef\fk@secname{%
      \csname fk@levelname\thealnumsec@level\endcsname}%
    \ifusepreviouslevels%
      \ifnum\c@alnumsec@level<\c@fk@changelevel%
        \expandafter\@namedef{the\fk@secname\expandafter}\expandafter{%
          \csname the\fk@previoussecname\expandafter\endcsname
          \csname fk@pre@\thealnumsec@level\expandafter\endcsname%
          \csname fk@\thealnumsec@level num\expandafter\endcsname%
          \csname c@\fk@secname\expandafter\endcsname%
          \csname fk@post@\thealnumsec@level\endcsname}%
      \else%
        \expandafter\@namedef{the\fk@secname\expandafter}\expandafter{%
          \csname the\fk@previoussecname\expandafter\endcsname
          \csname fk@lower@pre@\thealnumsec@level\expandafter\endcsname%
          \csname fk@\thealnumsec@level num\expandafter\endcsname%
          \csname c@\fk@secname\expandafter\endcsname%
          \csname fk@lower@post@\thealnumsec@level\endcsname}%
      \fi%
    \else%
%    \end{macrocode}
%
% The following three lines are added to have references with parents,
% thanks to Markus Kohm. \changes{v0.02}{2005/02/16}{Added code to
% make references complete, thanks to Markus Kohm.}
%
%    \begin{macrocode}
      \expandafter\@namedef{p@\fk@secname\expandafter}\expandafter{%
        \csname p@\fk@previoussecname\expandafter\endcsname
        \csname the\fk@previoussecname\endcsname}%
      \ifnum\c@alnumsec@level<\c@fk@changelevel%
        \expandafter\@namedef{the\fk@secname\expandafter}\expandafter{%
          \csname fk@pre@\thealnumsec@level\expandafter\endcsname%
          \csname fk@\thealnumsec@level num\expandafter\endcsname%
          \csname c@\fk@secname\expandafter\endcsname%
          \csname fk@post@\thealnumsec@level\endcsname}%
      \else%
        \expandafter\@namedef{the\fk@secname\expandafter}\expandafter{%
          \csname fk@lower@pre@\thealnumsec@level\expandafter\endcsname%
          \csname fk@\thealnumsec@level num\expandafter\endcsname%
          \csname c@\fk@secname\expandafter\endcsname%
          \csname fk@lower@post@\thealnumsec@level\endcsname}%
      \fi%
    \fi%
  }%
}
\def\define@surroundstyle#1{%
  \@namedef{surround#1}{%
    \@ifnextchar [{%]
      \csname opt@surround#1\endcsname}{%
      \csname nopt@surround#1\endcsname}%
  }%
  \@namedef{opt@surround#1}[##1]{%
    \@ifnextchar [{%]
      \csname dopt@surround#1\endcsname[##1]}{%
      \csname @opt@surround#1\endcsname[##1]}
  }
  \@namedef{dopt@surround#1}[##1][##2]##3##4{%
    \@namedef{fk@lower@pre@#1}{##1}%
    \@namedef{fk@lower@post@#1}{##2}%
    \@namedef{fk@pre@#1}{##3}%
    \@namedef{fk@post@#1}{##4}%
  }
  \@namedef{@opt@surround#1}[##1]##2##3{%
    \relax
    \@namedef{fk@lower@pre@#1}{##1}%
    \@namedef{fk@pre@#1}{##2}%
    \@namedef{fk@post@#1}{##3}%
    \expandafter\let%
      \csname fk@lower@post@#1\expandafter\endcsname%
      \csname fk@post@#1\endcsname%
  }
  \@namedef{nopt@surround#1}##1##2{%
    \@namedef{fk@pre@#1}{##1}%
    \@namedef{fk@post@#1}{##2}%
    \expandafter\let%
      \csname fk@lower@pre@#1\expandafter\endcsname%
      \csname fk@pre@#1\endcsname%
    \expandafter\let%
      \csname fk@lower@post@#1\expandafter\endcsname%
      \csname fk@post@#1\endcsname%
  }
}
\define@surroundstyle{Roman}
\define@surroundstyle{roman}
\define@surroundstyle{Letter}
\define@surroundstyle{letter}
\define@surroundstyle{arabic}
\define@surroundstyle{doubleletter}
\define@surroundstyle{greek}
\define@surroundstyle{doublegreek}
\newif\iffk@chapterdefined%
\@ifundefined{chapter}{%
  \fk@chapterdefinedfalse%
  \setcounter{fk@secstart}{1}%
  \setcounter{fk@secdepth}{5}%
  \alnumsectionlevels{1}{section,subsection,subsubsection,paragraph,subparagraph}%
}{%
  \fk@chapterdefinedtrue%
  \setcounter{fk@secstart}{0}%
  \setcounter{fk@secdepth}{5}%
  \alnumsectionlevels{0}{chapter,section,subsection,subsubsection,paragraph,subparagraph}%
}
\iffk@chapterdefined%
  \def\fk@pre@chapter{}%
  \def\fk@post@chapter{.}%
\fi
\surroundRoman{}{.}
\surroundroman{}{.}
\surroundarabic{}{.}
\surroundLetter{}{.}
\surroundletter[(]{}{)}
\surroundgreek[(]{}{)}
\surrounddoubleletter[(]{}{)}
\surrounddoublegreek[(]{}{)}
%</alnumsec>
%    \end{macrocode}
% 
% \clearpage
% \Finale
%
\endinput