% section.cd % Anders G S Svensson % Source: section.nw % $Revision: 1.25 $ % $Date: 1996/06/04 12:57:01 $ \def\section@newunnumberedsection@#1#2{ \section@initsection@{#2} \@def@{#2banneru}{% \@cs@{section@banner@\@cs@{section@style@#2}}{#2}{}}% \@def@{#2}{\section@unnumsect@{#1}{#2}} \@ifnext@<{\section@skip@{pre}{#2}% {\@eatspace@{\section@skip@{post}{#2}{}}}}% {}} \let\section@newsection@\section@newunnumberedsection@ \def\section@unnumsect@#1#2#3{% \@ifnext@[% {\section@@unnumsect@{#1}{#2}{#3}}% {\section@@unnumsect@{#1}{#2}{#3}[#3]}} \def\section@@unnumsect@#1#2#3[#4]{% \section@section@{#2}{% \section@sectionbanner@{#2}{\@cs@{#2banneru}{#3}}% \@expandafter@{\@expandafter@{#1*{toc}{#2}}}% \csname section@\@cs@{section@tocchoice@#2}choice@\endcsname{#3}{#4}% \@expandafter@{\@expandafter@{\@cs@{#2mark}}}% \csname section@\@cs@{section@markchoice@#2}choice@\endcsname{#3}{#4}% }\ignorespaces}% \def\section@skip@#1#2#3<#4>{\relax \@ifempty@{#4}% {#3}% {\@def@{section@#1skip@#2}{\@s@\z@\@sum@\@s@#4+@\vskip\@s@}#3}} \def\section@newnumberedsection@#1#2{\relax \@ifnextchar@*% {\@expandafter@{\section@newunnumberedsection@{#1}{#2}}\@eat@}% {\section@@newnumberedsection@{#1}{#2}}} \def\section@@newnumberedsection@#1#2{% \section@initsection@{#2} \@def@{#2banneru}{% \@cs@{section@banner@\@cs@{section@style@#2}}{#2}{}}% \@def@{#2banner}{% \@cs@{section@banner@\@cs@{section@style@#2}}{#2}{\@cs@{the#2}}}% \@ifnext@[% {\section@newnumsectwithin@{#1}{#2}} {\section@newnumsect@{#1}{#2}}} \def\section@sectionbanner@#1#2{{\@cs@{section@headinghook@#1}#2}} \def\section@initsection@#1{% \@def@{#1plug}{\defaultsectionplug} \@def@{#1mark}{\defaultsectionmark{#1}} \@def@{section@markchoice@#1}{\section@markchoice@def@ult} \@def@{section@tocchoice@#1}{\section@tocchoice@def@ult} \@def@{section@style@#1}{\section@style@def@ult} \@def@{section@preskip@#1}{% \@s@\z@ \expandafter\@sum@ \expandafter\@s@\defaultpresectionskip+@\vskip\@s@} \@def@{section@postskip@#1}{% \@s@\z@ \expandafter\@sum@ \expandafter\@s@\defaultpostsectionskip+@\vskip\@s@} \@def@{section@prehook@#1}{\section@prehook@def@ult}% \@def@{section@posthook@#1}{\section@posthook@def@ult}% \@def@{section@headinghook@#1}{\section@headinghook@def@ult}} \def\section@define@#1[#2]{% \@define@{section@#1@#2}} \def\section@defvar@#1{\relax \@ifnextchar@[{\section@define@{#1}}{\section@define@{#1}[def@ult]}} \def\presectionhook{\section@defvar@{prehook}} \def\postsectionhook{\section@defvar@{posthook}} \def\headinghook{\section@defvar@{headinghook}} \let\section@prehook@def@ult\relax \def\section@posthook@def@ult{\penalty200} \def\section@headinghook@def@ult{\bf} \let\defaultsectionmark\@eattwo@ \def\defaultsectionplug{\hskip.8em} \def\defaultpresectionskip{-\lastskip+\bigskipamount+-.5\parskip} \def\defaultpostsectionskip{\medskipamount+-.5\parskip} \def\markchoice{\relax \@ifnextchar@[% {\section@choiceforclass@{mark}}% {\section@choiceforclass@{mark}[def@ult]}} \def\tocchoice{\relax \@ifnextchar@[% {\section@choiceforclass@{toc}}% {\section@choiceforclass@{toc}[def@ult]}} \def\section@choiceforclass@#1[#2]#3{% \@ifundefined@{section@#3choice@}% {\@Warning@{Invalid choice: #3}}% {\@def@{section@#1choice@#2}{#3}}} \def\section@markchoice@def@ult{alt} \def\section@tocchoice@def@ult{full} \def\section@altchoice@#1#2{{#2}} \def\section@fullchoice@#1#2{{#1}} \def\sectionstyle{\relax \@ifnextchar@[\section@styleforclass@{\section@styleforclass@[def@ult]}} \def\section@styleforclass@[#1]{% \@afterassignment@{\section@checkstyle@{#1}}\@t@} \def\section@checkstyle@#1{% \@ifundefined@{section@banner@\the\@t@}% {\@Warning@{Unknown section style: \the\@t@}}% {\@edef@{section@style@#1}{\the\@t@}}} \def\section@style@def@ult{plain} \def\section@banner@plain#1#2#3{% \noindent \@ifempty@{#2}{}{#2\@cs@{#1plug}}#3} \let\section@banner@p\section@banner@plain \def\section@banner@word#1#2#3{% \noindent \@ifempty@{#2}% {}% {\@ifundefined@{#1word}{}{\@cs@{#1word}\ }#2\@cs@{#1plug}}#3} \let\section@banner@w\section@banner@word \def\section@banner@center#1#2#3{% \parindent\z@ \leftskip=0pt plus 1fil \rightskip=0pt plus 1fil \parfillskip\z@ \@ifempty@{#2}{}{#2\@cs@{#1plug}}#3\par} \let\section@banner@centre\section@banner@center \let\section@banner@c\section@banner@center \def\section@banner@centerword#1#2#3{% \parindent\z@ \leftskip=0pt plus 1fil \rightskip=0pt plus 1fil \parfillskip\z@ \@ifempty@{#2}% {}% {\@ifundefined@{#1word}{}{\@cs@{#1word}\ }#2\@cs@{#1plug}}#3\par} \let\section@banner@centreword\section@banner@centerword \let\section@banner@cw\section@banner@centerword \def\section@newnumsectwithin@#1#2[#3]{ \newcounter{#2}[#3] \@def@{#2}{\section@numsectcs@{#1}{#2}}% \@ifnext@<{\section@skip@{pre}{#2}% {\@eatspace@{\section@skip@{post}{#2}{}}}}% {}} \def\section@newnumsect@#1#2{ \newcounter{#2} \@def@{#2}{\section@numsectcs@{#1}{#2}}% \@ifnext@<{\section@skip@{pre}{#2}% {\@eatspace@{\section@skip@{post}{#2}{}}}}% {}} \def\section@numsectcs@#1#2{\relax \@ifnextchar@*% {\section@numsectnonum@{#1}{#2}}% {\section@numsect@{#1}{#2}}} \def\section@numsectnonum@#1#2#3#4{\par \@ifnext@[% {\section@numsectionnonum@{#1}{#2}{#4}}% {\section@numsectionnonum@{#1}{#2}{#4}[#4]}} \def\section@numsectionnonum@#1#2#3[#4]{% \section@section@{#2}{% \section@sectionbanner@{#2}{\@cs@{#2banneru}{#3}}% \@expandafter@{\@expandafter@{#1*{toc}{#2}}}% \csname section@\@cs@{section@tocchoice@#2}choice@\endcsname{#3}{#4}% \@expandafter@{\@expandafter@{\@cs@{#2mark}}}% \csname section@\@cs@{section@markchoice@#2}choice@\endcsname{#3}{#4}% }\ignorespaces} \def\section@numsect@#1#2#3{\par \@ifnext@[% {\section@@numsect@{#1}{#2}{#3}}% {\section@@numsect@{#1}{#2}{#3}[#3]}} \def\section@@numsect@#1#2#3[#4]{% \stepcounter{#2}% \def\currentcounter{#2}% \section@section@{#2}{% \section@sectionbanner@{#2}{\@cs@{#2banner}{#3}}% \@expandafter@{\@expandafter@{#1{toc}{#2}}}% \csname section@\@cs@{section@tocchoice@#2}choice@\endcsname {#3}{#4}{\@cs@{the#2}}% \@expandafter@{\@expandafter@{\@cs@{#2mark}}}% \csname section@\@cs@{section@markchoice@#2}choice@\endcsname{#3}{#4}% }\ignorespaces} \DeclareOption{toc} {\usecarrot{toc} \let\newsection\section@newtocsection@} \DeclareOption{number} {\usecarrot{counter} \let\section@newsection@\section@newnumberedsection@} \def\newsection{\section@newsection@\section@notocentry@} \def\section@newtocsection@{\relax \@ifnextchar@* {\expandafter\section@newsection@\expandafter\section@notocentry@\@eat@} {\section@newsection@\writecontentsentry}} \def\section@notocentry@#1#2{\@eattwo@} \def\section@section@#1#2{% \@cs@{section@prehook@#1}\relax \@cs@{section@preskip@#1}% #2\par \@cs@{section@posthook@#1}\relax \@cs@{section@postskip@#1}% \postsectionindent} \def\postsectionindent{% \edef\@action@{\everypar={\hskip-\parindent\the\everypar \everypar={\the\everypar}}}\@action@}