diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-12 23:51:19 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-12 23:51:19 +0000 |
commit | 37a695553d7e238ab715b3bd4bbfdbc5702f1cf0 (patch) | |
tree | ed0d928035488ba353b6a60a03f465ce88038e45 /Master | |
parent | beaf2b459adeac4ade8f9d12e99c60a0640a1a78 (diff) |
alnumsec
git-svn-id: svn://tug.org/texlive/trunk@659 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/tex/latex/alnumsec/alnumsec.sty | 267 |
1 files changed, 267 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/alnumsec/alnumsec.sty b/Master/texmf-dist/tex/latex/alnumsec/alnumsec.sty new file mode 100644 index 00000000000..9ccb311d46f --- /dev/null +++ b/Master/texmf-dist/tex/latex/alnumsec/alnumsec.sty @@ -0,0 +1,267 @@ +%% +%% This is file `alnumsec.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% alnumsec.dtx (with options: `alnumsec') +%% +%% Copyright (C) 2003 Frank Küster. +%% +%% All rights reserved. +\ProvidesPackage{alnumsec} + [2005/02/16 v0.02 alphanumeric section numbers with + ordinary sectioning commands] +\newif\ifusepreviouslevels\usepreviouslevelsfalse% +\DeclareOption{usehighlevels}{\usepreviouslevelstrue}% +\ProcessOptions% +\RequirePackage{ifthen}% +\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}% +\def\otherseparators#1{% + \setcounter{fk@changelevel}{#1} +} +\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} +} +\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% +} +\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% +}% +\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% + \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'. + +\endinput +%% +%% End of file `alnumsec.sty'. |