3 \ifcat a\noexpand @\let\next\relax\else \def\next{%
4 \documentclass{kluwer}\usepackage{doc}\MakePercentIgnore}\fi\next
5 \def\filedate{1998/03/13}
6 \def\filename{klusec.sty}
7 %\changes{1997/07/13}{Inserted mainmatter switch}{}
8 %\changes{1997/07/13}{Inserted tocentry in theindex}{}
9 %\DoNotIndex{\@M,\def,\c@secnumdepth,\baselineskip,\@pnumwidth,\else,\fi}
10 %\DoNotIndex{\newcommand,\z@,\relax,\renewcommand,\ifnum,\csname,\endcsname}
11 %\DoNotIndex{\baselineskip,\vskip,\hskip,\relax,\secdef,\refstepcounter}
12 %\DoNotIndex{\normalsize,\numberline,\protect,\endinput}
14 %\changes{1997/02/12}{TH: added a space after 'partname'.}{}
15 %\newcommand{\Bs}{$\backslash$}
20 %\setlength\marginparwidth{0pt}
21 %\addtolength{\textwidth}{4pc}
25 %\runningtitle{\filename\ -- \filedate}
27 %\author{Kluwer Academic Publishers}
28 %\runningauthor{Kluwer Academic Publishers}
31 %This internal stylefile defines all sectioning commands used by
32 %all kluwer style files. In order to facilitate usage by different
33 %stylefiles, most command herein are parameterised.
34 %There is an option to include a definition for \verb!\chapter!
41 %All `ordinary' sectioning command such as |\section| |\subsection| etc.
42 %Have the following macros defined:
45 %\Bs{\it X}hang & (1arg)\\
46 %\Bs{\it X}spaceabove\\
47 %\Bs{\it X}spaceafter \\
48 %\Bs{\it X}flushstyle\\
50 %\Bs{\it X}textstyle\\
51 %\Bs{\it X}case & (1arg)
54 %Where {\it X} is one of the following:
67 %The {\it X}hang macro encapsulates the number and the separating
68 %space. In the default
69 %configuration, for instance, |\SShang| sets hanging indentation
70 %for the subsection title to the width of the number, resulting in
71 %sections looking like this:
74 %\subsection{This is a very long example of an otherwise quite
75 % ordinary section. I stretched it a lot so you can see the
79 %This is implemented by this line:
82 %\newcommand{\SShang}[1]{\Forcedhang{#1}}
85 %where the macro \Bs Forcedhang calculates the needed \Bs hangafter.
86 %Another use for this macro could be:
89 %\renewcommand{\Shang}[1]{\charkern{#1}}
92 %To get spaced out numbering (somewhat trivial example) or
95 %\renewcommand{\Shang}[1]{}
98 %To force |\section*| like layout.
101 %\Bs{\it X}spaceabove is a skip value in the vertical direction.
102 %e.g.\\ |\renewcommand{\Pspaceabove}{.5\baselineskip}|
105 %\Bs{\it X}spaceafter is a `real' macro, that is supposed to typeset
106 %either a horizontal or a vertical skip. However, this macro can do
107 %anything:\\ |\renewcommand{\Pspaceafter}{\hskip 1em}|
110 %\Bs{\it X}flushstyle is for |\centering| etc.
113 %\Bs{\it X}numstyle and \Bs{\it X}textstyle control things like
114 %sizes and fontshape. These two and \Bs{\it X}flushstyle are inside the
115 %same group, so there is no need to define things like |\bfseries|
119 %\Bs{\it X}case behaves identical to \Bs{\it X}hang, but it braces
120 %the text of the sectioning command.
122 % \section{Considerations}
123 %The following need extra attention:
126 %|\part|, |\chapter| and |\index| set |\thispagestyle| to the pagestyle with
127 %the same name. This needs to be taken care of in |kluopen.sty| of the
128 % stylefile. This file (\filename) simply |\let|'s them all to |empty|.
130 %|\sectioncmd| is either |\section| or |\chapter|. This is more efficient
131 % than doing everything twice. The stylefile has to set this like this:\\
132 %|\AtBeginDocument{\let\sectioncmd\section}|, or it will fail.
135 %|\@secnumdepth| works, for the first time in any kluwer stylefile that I
136 %know of. It's default value is 4, so only |\subparagraph| does NOT have a
137 %section number attached.
138 %\item |\sectiondot| and |\chapterdot| contain a dot to be typeset after
139 %the number of the section$\|$chapter.
142 % The following table contains the default values as set in this
146 %\begin{tabular}{llllllll} \hline
147 %Type&spaceabove&spacebelow&flushstyle&numstyle&textstyle&hang&case\\ \hline
148 %C &33pt &vskip 33pt ¢ering &large rm &- &-&-\\
149 %S &2bs+6pt-4pt&vskip 1bs+3pt-2pt¢ering &bf &- &Forcedhang&-\\
150 %SS &1bs+3pt-2pt&vskip 1bs+3pt-2pt&raggedright&rm &sc&Forcedhang&-\\
151 %SSS&1bs+3pt-2pt&vskip 1sp &raggedright&rm &it&Forcedhang&-\\
152 %P &1bs+3pt-2pt&hskip .5em &- &rm &it&-&-\\
153 %SP &1bs+3pt-2pt&hskip .5em &- &rm &it&-&-\\ \hline
156 % bs = |\baselineskip|
158 % \section{Implementation}
160 \NeedsTeXFormat{LaTeX2e}
161 \ProvidesPackage{klusec}[\filedate ]
162 \newif\if@chapterdef \@chapterdeffalse
163 \DeclareOption{chapter}{\@chapterdeftrue }
167 %\newpage\subsection{Part}
168 % Definition of |\part|. Not much work is done on this, because it is
169 % not used this often, and fairly easy to circumvent (if needed).
173 \thispagestyle{part}%
175 \secdef\@part\@spart}
177 \ifnum \c@secnumdepth >-2\relax
178 \refstepcounter{part}%
179 \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
181 \addcontentsline{toc}{part}{#1}%
185 \ifnum \c@secnumdepth >-2\relax
186 \huge\bf \partname\ \thepart
195 \def\@spart#1{{\centering\Huge \bf #1\par}\@endpart}
196 \def\@endpart{\vfil\cleardoublepage}
198 \let\ps@part\ps@empty
201 %\newpage\subsection{Chapter}
207 % Typeset text and number.
209 \newcommand{\@makechapterhead}[2]{\vspace*{\Cspaceabove}%
210 {\parindent 0pt \hyphenpenalty 10000
211 \Cflushstyle \Cnumstyle
213 \Ctextstyle \Ccase{#2}\par
214 \nobreak \Cspaceafter \relax
217 \newcommand{\chapter}{%
220 % openright will be handled by the stylefile
228 \thispagestyle{chapter}%
231 \secdef\@chapter\@schapter
233 \def\@chapter[#1]#2{%
234 \ifnum \c@secnumdepth >\m@ne
235 \refstepcounter{chapter}%
236 \message{\@chapapp\space\thechapter\chapterdot}%
237 \addcontentsline{toc}{chapter}{\protect
238 \numberline{\thechapter}#1}%
240 \addcontentsline{toc}{chapter}{#1}%
243 \addtocontents{lof}{\protect\addvspace{10pt}}%
244 \addtocontents{lot}{\protect\addvspace{10pt}}%
245 \@makechapterhead{\thechapter\chapterdot\ }{#2}%
248 \newcommand{\@schapter}[1]{\@makechapterhead{}{#1} \@afterheading}
250 \newcommand{\Chang}[1]{#1}
251 \newcommand{\Cspaceabove}{33pt}
252 \newcommand{\Cspaceafter}{\vskip 33pt}
253 \newcommand{\Cflushstyle}{\centering}
254 \newcommand{\Cnumstyle}{\large\rm}
255 \newcommand{\Ctextstyle}{}
256 \newcommand{\Ccase}[1]{#1}
257 \newcommand{\@chapapp}{\chaptername}
258 \newcommand{\chapterdot}{.}
259 \let\ps@chapter\ps@empty
262 %\newpage\subsection{Utility macro's}
264 % The |\@haveatleast| is (loosely) borrowed from the \TeX Book. Because
265 % of it's implementation, it will do `raggedbottom'-like things to pages,
266 % but the other option turned out to be worse. A page optimizer would come
267 % very handy indeed! The penalty is rather high, because we'd rather borrow
268 % some whitespace from the rest of the page.
269 % \changes{1997/07/13}{Change of policy: penalty is 0 now}{}
270 % \changes{1997/07/13}{nobreak inserted between box and glue}{}
272 \newcommand{\vsecspace}[1]{%
275 \def\Shaveatleast{5\baselineskip}
276 \def\SShaveatleast{4\baselineskip}
277 \def\SSShaveatleast{4\baselineskip}
278 \newcommand{\@haveatleast}[1]{\relax\par \vskip #1
279 \penalty 0\vskip -#1 \relax }
281 \global\@nobreakfalse
282 \global\@noskipsectrue
283 \everypar{\setbox0\lastbox
284 \global\@noskipsecfalse
285 \begingroup \@Svsechd \endgroup
289 %|\Forcedhang| is named after it's normal usage. However, it is a bit more
290 % general than that, so maybe it will move to some other place eventually.
291 % Typesets its argument and sets the current paragraph's |\hangafter| to
292 % be the width of the argument.
294 \newcommand{\Forcedhang}[1]{\leavevmode
295 \setbox0=\hbox{#1}\hangindent\wd0
299 \def\contentsname{Table of Contents}%
300 \def\listfigurename{List of Figures}%
301 \def\listtablename{List of Tables}%
302 \def\chaptername{Chapter}%
303 \def\sectionname{Section}%
304 \def\appendixname{Appendix}%
306 %\newpage\subsection{Section}
308 \newcommand{\@makesectionhead}[2]{\vsecspace{\Sspaceabove}%
309 {\parindent0pt \hyphenpenalty=10000 \baselineskip12pt
310 \Sflushstyle \Snumstyle
312 \Stextstyle \Scase{#2}\par
313 \nobreak \Sspaceafter \relax
316 \newcommand{\section}{\@haveatleast{\Shaveatleast
317 }\@afterindentfalse \secdef\@section\@ssection}
319 \def\@section[#1]#2{%
320 \ifnum \c@secnumdepth >\z@
321 \refstepcounter{section}%
322 \addcontentsline{toc}{section}{\protect \numberline{\thesection}#1}%
324 \addcontentsline{toc}{section}{#1}%
327 \@makesectionhead{\thesection\sectiondot\hskip 0.7em}{#2}%
331 \def\@ssection#1{\@makesectionhead{}{#1}\@afterheading}
333 \newcommand{\Shang}[1]{\Forcedhang{#1}}
334 \newcommand{\Sflushstyle}{\centering}
335 \newcommand{\Snumstyle}{\normalsize\bf}
336 \newcommand{\Stextstyle}{}
337 \newcommand{\Sspaceabove}{2\baselineskip plus6pt minus4pt}
338 \newcommand{\Sspaceafter}{\vskip 1\baselineskip plus3pt minus2pt}
339 \newcommand{\Scase}[1]{#1}
340 \newcommand{\sectiondot}{.}
342 %\newpage\subsection{Subsection}
344 \newcommand{\@makesubsectionhead}[2]{\vsecspace{\SSspaceabove}%
345 {\parindent0pt \hyphenpenalty=10000 \baselineskip12pt
346 \SSflushstyle \SSnumstyle
348 \SStextstyle \SScase{#2}\par
349 \nobreak \SSspaceafter \relax
352 \newcommand{\subsection}{\@haveatleast{\SShaveatleast}%
353 \@afterindentfalse \secdef\@subsection\@ssubsection
356 \def\@subsection[#1]#2{%
357 \ifnum \c@secnumdepth >\@ne
358 \refstepcounter{subsection}%
359 \addcontentsline{toc}{subsection}{\protect
360 \numberline{\thesubsection}#1}%
362 \addcontentsline{toc}{subsection}{#1}%
365 \@makesubsectionhead{\thesubsection\sectiondot\hskip 0.7em}{#2}%
368 \def\@ssubsection#1{\@makesubsectionhead{}{#1}\@afterheading}
371 \newcommand{\SShang}[1]{\Forcedhang{#1}}
372 \newcommand{\SSflushstyle}{\raggedright}
373 \newcommand{\SSnumstyle}{\normalsize\rm}
374 \newcommand{\SStextstyle}{\sc}
375 \newcommand{\SSspaceabove}{1\baselineskip plus3pt minus2pt}
376 \newcommand{\SSspaceafter}{\vskip .8\baselineskip plus2pt minus2pt}
377 \newcommand{\SScase}[1]{#1}
379 %\newpage\subsection{Subsubsection}
381 \newcommand{\@makesubsubsectionhead}[2]{\vsecspace{\SSSspaceabove}%
382 {\parindent0pt \hyphenpenalty=10000 \baselineskip12pt
383 \SSSflushstyle \SSSnumstyle
385 \SSStextstyle \SSScase{#2}\par
386 \nobreak \SSSspaceafter \relax
389 \newcommand{\subsubsection}{\@haveatleast{\SSShaveatleast
391 \secdef\@subsubsection\@ssubsubsection}
392 \def\@subsubsection[#1]#2{%
393 \ifnum \c@secnumdepth >2
394 \refstepcounter{subsubsection}
395 \addcontentsline{toc}{subsubsection}{\protect
396 \numberline{\thesubsubsection}#1}%
398 \addcontentsline{toc}{subsubsection}{#1}%
400 \subsubsectionmark{#1}
401 \@makesubsubsectionhead{\thesubsubsection\sectiondot\hskip0.7em}{#2}%
404 \def\@ssubsubsection#1{\@makesubsubsectionhead{}{#1}\@afterheading}
406 \newcommand{\SSShang}[1]{\Forcedhang{#1}}
407 \newcommand{\SSSflushstyle}{\raggedright}
408 \newcommand{\SSSnumstyle}{\normalsize\rm}
409 \newcommand{\SSStextstyle}{\it}
410 \newcommand{\SSSspaceabove}{1\baselineskip plus3pt minus2pt}
411 \newcommand{\SSSspaceafter}{\vskip 1sp}
412 \newcommand{\SSScase}[1]{#1}
414 %\newpage\subsection{Paragraph}
416 \newcommand{\@makeparagraphhead}[2]{%
417 \vsecspace{\Pspaceabove }%
419 {\Pflushstyle \Pnumstyle
421 \Ptextstyle \Pcase{#2}%
422 \Pspaceafter \relax }}\@Xsect
425 \newcommand{\paragraph}{\par \@afterindentfalse
426 \secdef\@paragraph\@sparagraph }
428 \def\@paragraph[#1]#2{%
429 \ifnum \c@secnumdepth >3
430 \refstepcounter{paragraph}%
431 \addcontentsline{toc}{paragraph}{\protect
432 \numberline{\theparagraph}#1}%
434 \addcontentsline{toc}{paragraph}{#1}%
437 \@makeparagraphhead{\theparagraph\sectiondot\hskip 0.7em}{#2}%
439 \def\@sparagraph#1{\@makeparagraphhead{}{#1}}
441 \newcommand{\Pspaceabove}{1\baselineskip plus3pt minus2pt}
442 \newcommand{\Phang}[1]{#1}
443 \newcommand{\Pflushstyle}{}
444 \newcommand{\Pnumstyle}{\normalsize\rm}
445 \newcommand{\Ptextstyle}{\it}
446 \newcommand{\Pcase}[1]{#1}
447 \newcommand{\Pspaceafter}{\hskip 1em}
449 %\newpage\subsection{Subparagraph}
451 \newcommand{\@makesubparagraphhead}[2]{%
454 {\SPflushstyle \SPnumstyle
456 \SPtextstyle \SPcase{#2}%
457 \SPspaceafter \relax}}\@Xsect
459 \newcommand{\subparagraph}{\par\@afterindentfalse
460 \secdef\@subparagraph\@ssubparagraph }
462 \def\@subparagraph[#1]#2{%
463 \ifnum \c@secnumdepth >4
464 \refstepcounter{subparagraph}%
465 \addcontentsline{toc}{subparagraph}{\protect
466 \numberline{\thesubparagraph}#1}%
468 \addcontentsline{toc}{subparagraph}{#1}%
471 \@makesubparagraphhead{\thesubparagraph\sectiondot\hskip 0.7em}{#2}%
473 \def\@ssubparagraph#1{\@makesubparagraphhead{}{#1}}
475 \newcommand{\SPspaceabove}{1\baselineskip plus3pt minus2pt}
476 \newcommand{\SPhang}[1]{}
477 \newcommand{\SPflushstyle}{}
478 \newcommand{\SPnumstyle}{\normalsize\rm}
479 \newcommand{\SPtextstyle}{\it}
480 \newcommand{\SPcase}[1]{#1}
481 \newcommand{\SPspaceafter}{\hskip 1em}
483 %\newpage\subsection{Counters}
486 \renewcommand{\thepart}{\Roman{part}}
489 \renewcommand{\thechapter}{\arabic{chapter}}
490 \newcounter{section}[chapter]
491 \renewcommand{\thesection}{\thechapter.\arabic{section}}
494 \renewcommand{\thesection}{\arabic{section}}
496 \newcounter{subsection}[section]
497 \newcounter{subsubsection}[subsection]
498 \newcounter{paragraph}[subsubsection]
499 \newcounter{subparagraph}[paragraph]
500 \renewcommand{\thesubsection}{\thesection.\arabic{subsection}}
501 \renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection}}
502 \renewcommand{\theparagraph}{\thesubsubsection.\arabic{paragraph}}
503 \renewcommand{\thesubparagraph}{\theparagraph.\arabic{subparagraph}}
505 %\newpage\subsection{Table of Contents}
507 \def\@pnumwidth{1.55em}
508 \def\@tocrmarg{2.55em}
511 \setcounter{tocdepth}{2}
512 \setcounter{secnumdepth}{4}
514 %The macro |\imarkboth| is defined in |kluopen.sty|, allowing the current
515 % pagestyle and/or stylefile to define the meaning.
517 \def\tableofcontents{\sectioncmd *{\contentsname}%
518 \imarkboth{\contentsname}{\contentsname}%
519 \message{\contentsname}%
520 \@starttoc{toc}\newpage}
521 \def\listoffigures{\sectioncmd *{\listfigurename}\imarkboth
522 {\listfigurename}{\listfigurename}%
523 \message{\listfigurename}%
525 \def\listoftables{\sectioncmd *{\listtablename}\imarkboth
526 {\listtablename}{\listtablename}%
527 \message{\listtablename}%
530 \def\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
531 \let\l@table\l@figure
534 \addpenalty{-\@highpenalty}
535 \addvspace{2.25em plus 1pt}
538 \parindent \z@ \rightskip \@pnumwidth
539 \parfillskip -\@pnumwidth
542 #1\hfil \hbox to\@pnumwidth{\hss #2}}\par
545 \everypar{\global\@nobreakfalse\everypar{}}
549 \def\l@chapter#1#2{\addpenalty{-\@highpenalty}
550 \vskip 1.0em plus 1pt
553 \parindent \z@ \rightskip \@pnumwidth
554 \parfillskip -\@pnumwidth
557 \advance\leftskip\@tempdima
559 #1\nobreak\hfil \nobreak\hbox to\@pnumwidth{\hss #2}\par
560 \penalty\@highpenalty
564 \def\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
565 \def\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}
566 \def\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
567 \def\l@paragraph{\@dottedtocline{4}{10em}{5em}}
568 \def\l@subparagraph{\@dottedtocline{5}{12em}{6em}}
573 \newif\if@mainmatter \@mainmattertrue
575 \newcommand{\appendix}{\par
577 \setcounter{chapter}{0}%
578 \setcounter{section}{0}%
579 \renewcommand{\thechapter}{\Alph{chapter}}%
580 \renewcommand{\@chapapp}{\appendixname}%
581 \message{\appendixname}%
584 \newcommand{\appendix}{\par
586 \setcounter{section}{0}%
587 \setcounter{subsection}{0}%
588 \renewcommand{\thesection}{\Alph{section}}%
589 \message{\appendixname}%
593 \newenvironment{theindex}{%
597 \twocolumn[\@makechapterhead{}{\indexname}]
598 \addcontentsline{toc}{chapter}{\indexname}%
600 \twocolumn[\@makesectionhead{}{\indexname}]
601 \addcontentsline{toc}{section}{\indexname}%
603 \imarkboth{\indexname}{\indexname}%
604 \message{\indexname}%
605 \thispagestyle{index}%
607 \parskip\z@ plus .3pt\relax
608 \let\item\@idxitem \indexfont
610 \def\indexfont{\footnotesize}
611 \let\ps@index\ps@empty
612 \def\@idxitem{\par\hangindent 36pt}
613 \def\subitem{\par\hangindent 36pt \hspace*{12pt}}
614 \def\subsubitem{\par\hangindent 36pt \hspace*{24pt}}
615 \def\indexspace{\par \vskip 10pt plus 5pt minus 3pt\relax}