diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/alnumsec/alnumsec.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/alnumsec/alnumsec.dtx | 549 |
1 files changed, 549 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/alnumsec/alnumsec.dtx b/Master/texmf-dist/source/latex/alnumsec/alnumsec.dtx new file mode 100644 index 00000000000..84d2d7f6f97 --- /dev/null +++ b/Master/texmf-dist/source/latex/alnumsec/alnumsec.dtx @@ -0,0 +1,549 @@ +% \CheckSum{490} +% \iffalse meta-comment +% ====================================================================== +% alnumsec.dtx +% Copyright (C) 2003 Frank Küster +% +% This file can be redistributed and/or modified under the terms +% of the LaTeX Project Public Licence Version 1.0. See: +% http://www.ctan.org/tex-archive/macros/latex/base/lppl.txt +% ---------------------------------------------------------------------- +% alnumsec.dtx +% Copyright (C) 2003, 2005 +% +% Diese Datei kann nach den Regeln der LaTeX Project Public +% Licence Version 1.0 weiterverbreitet und/oder modifiziert +% werden. +% +% ====================================================================== +% +% \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} + [2005/02/16 v0.02 alphanumeric section numbers with + ordinary sectioning commands] +%<*driver> +\documentclass{article} +\usepackage{doc} +\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} +% \author{Frank K\"uster} +% \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{} +% +% \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. +% +% +% \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} +% +% \part{Implementation} +% +% +% +% \begin{macrocode} +%<*alnumsec> +\newif\ifusepreviouslevels\usepreviouslevelsfalse% +\DeclareOption{usehighlevels}{\usepreviouslevelstrue}% +\ProcessOptions% +\RequirePackage{ifthen}% +% \end{macrocode} +% +% Macros for greek "numbers" and double letters: +% +% \begin{macrocode} +\newcommand*{\@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}% +\newcommand*{\@doublegreek}[1]{\@greek{#1}{\@greek{#1}}} +\newcommand*{\@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[(]{}{)} +%% +%% End of file `alnumsec.sty'. + +%</alnumsec> +% \end{macrocode} +% +% \begin{macrocode} +%<*alnumsec> +\endinput +%</alnumsec> +% \end{macrocode} +% +% \clearpage +% \Finale +% +% |