Debian Codegraph @

texmf-dist/source/latex/sectsty/sectsty.dtx

raw
1 % \iffalse
2 % File sectsty.dtx
3 % Copyright Rowland McDonnell 1996, 1998, and 2002
4 % email [email protected]
5 % Some bits copyright the LaTeX3 team 1998.
6 %
7 % To install the sectsty package, run LaTeX on sectsty.ins. To
8 % typeset the documentation, run LaTeX on sectsty.dtx.
9 %
10 % Documentation and source file for the sectsty package. The package
11 % consists of two files:
12 %
13 % sectsty.ins
14 % sectsty.dtx
15 %
16 % This program - the two files sectsty.dtx and sectsty.ins - may be
17 % distributed and/or modified under the conditions of the LaTeX Project
18 % Public License, either version 1.2 of this license or (at your option)
19 % any later version.
20 % The latest version of this license is in
21 % http://www.latex-project.org/lppl.txt
22 % and version 1.2 or later is part of all distributions of LaTeX
23 % version 1999/12/01 or later.
24 %
25 % Don't give this file to anyone unless you also give them an unmodified
26 % versions of sectsty.ins.
27 %
28 % Don't modify this file unless you change its name and change all the
29 % various identification strings it contains to indicate that: it's
30 % derived from my sectsty package, it's now your responsibility, and
31 % it's no longer part of the sectsty package.
32 %
33 % Remove \OnlyDescription to get the code typeset. The code is not
34 % well documented.
35 %
36 % Note to me: comment out \OnlyDescription to get the checksum right,
37 % and then uncomment it because I don't want the code typeset by
38 % default (this package is meant for non-hackers).
39 %
40 %\fi
41 %\iffalse
42 %<*driver>
43 \documentclass[a4paper,11pt]{ltxdoc}
44 \usepackage{varioref}
45 \def\MacroFont{\fontencoding\encodingdefault
46 \fontfamily\ttdefault
47 \fontseries\mddefault
48 \fontshape\updefault
49 \normalsize}%
50 \OnlyDescription
51 \begin{document}
52 \DocInput{sectsty.dtx}
53 \end{document}
54 %</driver>
55 %\fi
56 %\iffalse
57 %<*package>
58 %\fi
59 %%
60 %% \CheckSum{1463}
61 %% \CharacterTable
62 %% {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
63 %% 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
64 %% Digits \0\1\2\3\4\5\6\7\8\9
65 %% Exclamation \! Double quote \" Hash (number) \#
66 %% Dollar \$ Percent \% Ampersand \&
67 %% Acute accent \' Left paren \( Right paren \)
68 %% Asterisk \* Plus \+ Comma \,
69 %% Minus \- Point \. Solidus \/
70 %% Colon \: Semicolon \; Less than \<
71 %% Equals \= Greater than \> Question mark \?
72 %% Commercial at \@ Left bracket \[ Backslash \\
73 %% Right bracket \] Circumflex \^ Underscore \_
74 %% Grave accent \` Left brace \{ Vertical bar \|
75 %% Right brace \} Tilde \~}
76 %
77 %\iffalse
78 % The instances of ^^A are `real' comment characters to suppress the
79 % end-of-line space in the middle of the command definitions.
80 %\fi
81 %
82 % \makeatletter
83 %\newcommand{\ttlb}{{\ttfamily\def\@tempcmda{OT1}^^A
84 %\ifx\f@encoding\@tempcmda\char"7B\else\{\fi}}
85 %
86 %\newcommand{\ttrb}{{\ttfamily\def\@tempcmda{OT1}^^A
87 %\ifx\f@encoding\@tempcmda\char"7D\else\}\fi}}
88 %
89 %\newcommand{\ttbs}{{\ttfamily\def\@tempcmda{OT1}^^A
90 %\ifx\f@encoding\@tempcmda\char`\\\else\textbackslash\fi}}
91 %^^A \char`\\ was \char"5C
92 %
93 %\newcommand*{\comname}[2][VF500F2E]{{\ttfamily\ttbs #2^^A
94 %\def\@tempcmda{VF500F2E}\def\@tempcmdb{#1}^^A
95 %\ifx\@tempcmda\@tempcmdb\else\comarg{#1}\fi}}
96 %
97 %\newcommand*{\itinangle}[1]{$\langle$^^A
98 %{\mdseries\rmfamily\itshape#1}\/$\rangle$}
99 %
100 %\newcommand*{\comarg}[1]{{\ttfamily\ttlb^^A
101 %\itinangle{#1}\ttrb}}
102 %
103 %\newcommand*{\comoptarg}[1]{{\ttfamily[$\langle$^^A
104 %{\rmfamily\itshape#1}\/$\rangle$]}}
105 % \makeatother
106 %
107 % \author{Rowland McDonnell\\ \texttt{[email protected]}}
108 % \title{The \packname{sectsty} package v2.0.2}
109 % \date{25th February 2002}
110 %
111 % \newcommand*{\packname}[1]{{\sffamily #1}}
112 % \newcommand*{\classname}[1]{{\ttfamily #1}}
113 % \newcommand*{\filename}[1]{{\ttfamily #1}}
114 %
115 % \maketitle
116 %
117 % \tableofcontents
118 %
119 % \section{Introduction}
120 %
121 % The \packname{secsty} package provides a set of commands for changing
122 % the fount\footnote{I am one of the few remaining English speaking
123 % people on the planet to use this spelling to refer to a set of type in
124 % one size and style.} used for the various sectional headings in the
125 % standard \LaTeXe\ document classes: \classname{article},
126 % \classname{book}, and \classname{report}. This package also works
127 % with the KOMA-Script classes \classname{scrartcl},
128 % \classname{scrbook}, and \classname{scrreprt}.
129 %
130 % When I refer to sectional headings in this document, I mean the stuff
131 % that is printed in the body of a document to indicate the start of
132 % a part, chapter, section, and so on. Appendix headings are treated
133 % as chapter headings.
134 %
135 % I'd appreciate any bug reports, comments, or suggestions emailed to
136 % the address above. I'm especially interested in any problems you
137 % might have had understanding the documentation; and, of course,
138 % anything else you'd like to tell me about this package. I'm
139 % certainly interested in any problems you might have had in using
140 % \packname{sectsty} with other packages, although I can't promise to
141 % be able to do anything useful about such problems.
142 %
143 % The \packname{titlesec} package offers a different
144 % approach to changing the appearance of sectional headings. The
145 % \packname{fncychap} package has a set of alternative `canned' chapter
146 % headings. Both are available from CTAN.
147 %
148 % Donald Arseneau won't let me say what bits of \packname{sectsty} he
149 % wrote, but I'd like to thank him anyway: I couldn't have managed
150 % without his help. Thanks are also due to the various people who sent
151 % me bug reports -- I've not kept track so rather than mention some of
152 % you and miss others out, I'll just say thanks and leave it at that.
153 % You know who you are and I appreciate your help.
154 %
155 % \section{Basic use of \packname{sectsty}}
156 %
157 % Make sure you include the package in your document by saying in your
158 % document preamble:
159 %\begin{verbatim}
160 % \usepackage{sectsty}
161 %\end{verbatim}
162 % You will then have some new commands available. For example:
163 %\begin{verbatim}
164 % \allsectionsfont{\sffamily}
165 %\end{verbatim}
166 % will give you sanserif for all sectional headings.
167 %
168 % \packname{Sectsty} doesn't make any changes to the fount used until
169 % you tell it what to do. The idea is that you supply some standard
170 % \LaTeX\ fount selection commands which change the default selection.
171 % The standard classes use Computer Modern Bold Extended by default for
172 % sectional headings, and your commands change this. This means the
173 % example above gives you Computer Modern Sanserif Bold Extended by
174 % default.
175 %
176 % You might want to change all headings so that they used medium
177 % italic. Since the default headings use bold extended, you need to
178 % switch to the medium weight as well as switching to italic using the
179 % standard \LaTeX\ fount selection commands, like this:
180 %\begin{verbatim}
181 % \allsectionsfont{\mdseries\itshape}
182 %\end{verbatim}
183 % You can change the style of the different sectional headings separately.
184 % If you want \comname{section}s to be set in bold Adobe Times, you might
185 % use standard \LaTeX\ fount selection commands like this:
186 %\begin{verbatim}
187 % \sectionfont{\fontfamily{ptm}\selectfont}
188 %\end{verbatim}
189 %
190 % Similar commands exist to change the style of the rest of \LaTeX's
191 % standard headings independently: \comname{chapterfont}\comarg{commands}
192 % will change chapter headings, and so on. The full list of commands is
193 % given in section~\vref{sec:command_list}.
194 %
195 % If you don't understand the fount selection commands above, you might
196 % like to look at the file \filename{fntguide.tex} that comes with the
197 % standard \LaTeX\ distribution.
198 %
199 % \section{Raggedright, raggedleft, and centred headings}
200 %
201 % The arguments to \packname{sectsty}'s sectional heading style changing
202 % commands can contain any \LaTeX\ commands you like. For example, you
203 % might say:
204 %\begin{verbatim}
205 % \allsectionsfont{\sffamily\raggedright}
206 %\end{verbatim}
207 % and all sectional headings would be typeset raggedright in bold
208 % extended sanserif. Not all \LaTeX\ commands will work properly when
209 % used this like, although these three commands all have the expected
210 % effect when used in one of \packname{sectsty}'s
211 % \comname{\itinangle{section}font} commands:
212 % \begin{center}
213 % \begin{tabular}{ll}
214 % \comname{centering} & Headings centred on the page \\
215 % \comname{raggedright} & Headings set flush left with a ragged right
216 % margin \\
217 % \comname{raggedleft} & Headings set flush right with a ragged left
218 % margin \\
219 % \end{tabular}
220 % \end{center}
221 % It's a bad idea to use any of these commands to change paragraph or
222 % subparagraph sectional headings: these two sections begin with `run-in'
223 % headings that are on the same line as the start of the section's text,
224 % and don't like being messed around like this. You can change the
225 % indentation before these two sectional headings like this:
226 %\begin{verbatim}
227 % \subparagraphfont{\hspace*{5em}}
228 %\end{verbatim}
229 % This adds an extra 5\,em space before each subparagraph heading.
230 %
231 % As a further example, you might want chapter headings set flush with
232 % the right margin. This will do the job:
233 %\begin{verbatim}
234 % \chapterfont{\raggedleft}
235 %\end{verbatim}
236 %
237 % If you want to play around with this sort of thing, it might be useful
238 % to know what sort of positioning you get by default with the standard
239 % classes: all sectional headings except chapter and part are fully
240 % justified (text set flush with the left and right margins), and
241 % chapter headings are raggedright. Part headings vary: they are
242 % raggedright in the article class, and centred in the book and report
243 % classes.
244 %
245 % \subsection{A complication affecting multiple line headings}
246 %
247 % The standard \comname{section}, \comname{subsection}, and
248 % \comname{subsubsection} commands ensure that, if you've got a
249 % multiple line heading, lines beyond the first are typeset with a small
250 % amount of indentation. This is called hanging indentation, and is
251 % entirely appropriate with the standard formatting. However, two
252 % problems arise from this: firstly, this hanging indentation usually
253 % looks pretty stupid if you've decided to have centred headings; and
254 % secondly, due to a bug in \LaTeX, the hanging indentation is
255 % suppressed if you use |\\| in a heading that's typeset raggedright or
256 % centred.
257 %
258 % The first problem can be dealt with: if you use the
259 % \comname{nohang} command in the appropriate
260 % \comname{\itinangle{section}font} command, the hanging indentation will
261 % be suppressed. For example:
262 %\begin{verbatim}
263 % \sectionfont{\nohang\centering}
264 %\end{verbatim}
265 % will ensure that any multiple line section headings come out centred
266 % as expected.
267 %
268 % The second problem -- the suppression of hanging indentation when you
269 % use |\\| in a raggedright or centred heading -- remains unsolved. I'm
270 % told that it's caused by the definition of \comname{@centercr}. This
271 % is part of the \LaTeX\ kernel and beyond my abilities to patch up.
272 % This problem has been reported as a \LaTeX\ bug, so it might well be
273 % sorted out in a future \LaTeX\ release.
274 %
275 % Donald Arseneau's \packname{ulem} package makes its own arrangements
276 % in this area, so sectional headings that are underlined using
277 % \packname{sectsty} and \packname{ulem} have correct hanging
278 % indentation even if you do use |\\| to end a line early.
279 %
280 % \section{The KOMA-script classes}
281 %
282 % If you just want to change the fount used for all sectional headings,
283 % you shouldn't use \packname{sectsty} with any of the KOMA-script
284 % classes. Instead, you should redefine the \comname{sectfont} command
285 % provided by the KOMA-script classes. This is akin to using
286 % \packname{sectsty}'s \comname{allsectionsfont} command.
287 %
288 % For example, the default definition is:
289 %\begin{verbatim}
290 % \newcommand*\sectfont{\sffamily\bfseries}
291 %\end{verbatim}
292 % you might want to change from this bold sanserif to medium italic
293 % roman. To do this, you could add the following line to your document
294 % preamble:
295 %\begin{verbatim}
296 % \renewcommand*\sectfont{\rmfamily\mdseries\itshape}
297 %\end{verbatim}
298 % If you'd like different sectional headings to be printed with
299 % different styles of type to each other, or if you'd like to underline
300 % sectional headings or play other games that you can't do with the
301 % KOMA-script \comname{sectfont} command, then \packname{sectsty} might
302 % be of use with the KOMA-script classes.
303 %
304 % You should note that the modifications applied by \packname{sectsty}
305 % commands happen immediately after the \comname{sectfont} command is
306 % executed.
307 %
308 % The documentation for this package is written with the standard
309 % \LaTeX\ classes in mind, so might not tie up exactly to the
310 % KOMA-script classes. Despite that, and despite differences in
311 % behaviour when things go wrong, \packname{sectsty} should work as
312 % expected with the KOMA-script classes.
313 %
314 %
315 %\section{All the commands}\label{sec:command_list}
316 %
317 % The full list of commands is:
318 % \begin{description}
319 % \item[\comname{allsectionsfont}\comarg{commands}] Changes the style of
320 % all sectional headings by executing \comarg{commands} before
321 % printing each heading.
322 %
323 % \item[\comname{partfont}\comarg{commands}] Changes the style of
324 % `part' headings only by executing \comarg{commands} before
325 % printing each heading; this affects both the title of the part and the
326 % part number.
327 %
328 % \item[\comname{chapterfont}\comarg{commands}] Changes the style of
329 % `chapter' headings only by executing \comarg{commands} before
330 % printing each heading; this affects both the title of the chapter and
331 % the chapter number.
332 %
333 % \item[\comname{sectionfont}\comarg{commands}] Changes the style of
334 % `section' headings only by executing \comarg{commands} before
335 % printing each heading.
336 %
337 % \item[\comname{subsectionfont}\comarg{commands}]Changes the style of
338 % `subsection' headings only by executing \comarg{commands} before
339 % printing each heading.
340 %
341 % \item[\comname{subsubsectionfont}\comarg{commands}]Changes the style
342 % of `subsubsection' headings only by executing \comarg{commands} before
343 % printing each heading.
344 %
345 % \item[\comname{paragraphfont}\comarg{commands}]Changes the style of
346 % `paragraph' headings only by executing \comarg{commands} before
347 % printing each heading; you should not use text positioning commands
348 % for this heading.
349 %
350 % \item[\comname{subparagraphfont}\comarg{commands}]Changes the style of the
351 % `subparagraph' heading only by executing \comarg{commands} before
352 % printing each heading; you should not use text positioning
353 % commands for this heading.
354 %
355 % \item[\comname{minisecfont}\comarg{commands}]]Changes the style of the
356 % `minisec' heading only by executing \comarg{commands} before
357 % printing each heading. This command always works, but since these
358 % headings only exist in the KOMA-script classes, it's useless with the
359 % standard \LaTeX\ classes.
360 % \end{description}
361 %
362 % There are also these commands:
363 % \begin{description}
364 % \item[\comname{partnumberfont}\comarg{commands}]Changes the style of
365 % `part' heading numbers only; this does not affect the title of the
366 % part heading.
367 %
368 % \item[\comname{parttitlefont}\comarg{commands}]Changes the style of
369 % `part' heading titles only; this does not affect the number of the
370 % part heading.
371 %
372 % \item[\comname{chapternumberfont}\comarg{commands}]Changes the style
373 % of `chapter' heading numbers only; this does not affect the
374 % title of the chapter heading.
375 %
376 % \item[\comname{chaptertitlefont}\comarg{commands}]Changes the style of
377 % `chapter' heading titles only; this does not affect the number
378 % of the chapter heading.
379 % \end{description}
380 %
381 % And finally, an anomalous helper command:
382 % \begin{description}
383 % \item[\comname{nohang}]For use in multiple-line headings: this
384 % command stops lines beyond the first having hanging indentation,
385 % which looks pretty daft with centred headings.
386 % \end{description}
387 %
388 % \section{Some notes}
389 %
390 % The way \packname{sectsty} works is by re-defining all the commands
391 % that produce the sectional headings. The change arranges things so
392 % that the fount selection commands you specify are executed immediately
393 % before the sectional heading is printed. You can change sizes, for
394 % example, with the normal \LaTeX\ size changing commands.
395 %
396 % You can include almost any \LaTeX\ commands in the argument to one of
397 % \packname{sectsty's} commands. Whether any particular command will
398 % work properly or have the effect you want is a different matter. If
399 % you come across anything interesting you can do with this package that
400 % I've not mentioned and you think someone else might be interested in,
401 % you could let me know and I'll put it in the documentation.
402 %
403 % If you use long section names you might like to make all sectional
404 % headings \comname{raggedright}:
405 %\begin{verbatim}
406 % \allsectionsfont{\raggedright}
407 %\end{verbatim}
408 % This means that \LaTeX\ won't try and justify sectional headings and
409 % should manage to avoid a hyphentated sectional heading which tends to
410 % look pretty bad.
411 %
412 % If you use \packname{sectsty} and get a complaint that you are using
413 % an old version of \LaTeX, there's probably no need to worry.
414 % \packname{Sectsty} will probably work correctly with any version of
415 % \LaTeXe\ after June 1996; because the earliest version I've tested
416 % \packname{sectsty} with is the June 1998 release of \LaTeX, that's the
417 % version I've specified as being needed. \packname{Sectsty} is not
418 % meant to work with \LaTeX~2.09; it's a good idea to get \LaTeXe\ if at
419 % all possible.
420 %
421 % \section{Underlining}
422 %
423 % Some people have to underline sectional headings because of
424 % regulations governing thesis submission and things like that. If
425 % you're not forced to use underlining, it's probably best to avoid it:
426 % underlining is usually considered bad typographical practice
427 % (well-placed horizontal rules are a different matter). On top of that,
428 % underlining sectional headings with \packname{sectsty} is not as
429 % trivial a job as I'd like -- you've either got to get another package
430 % or accept quite a lot of limitations.
431 %
432 % To underline a sectional heading with \packname{sectsty}, you need to
433 % put the \comname{underline} command as the last command in a
434 % \comname{\itinangle{section}font} command. For example:
435 %\begin{verbatim}
436 % \usepackage{sectsty}
437 % \allsectionsfont{\sffamily\underline}
438 %\end{verbatim}
439 % will give you underlined sanserif headings.
440 %
441 % There are two main problems with this way of doing things: firstly,
442 % the standard \LaTeX\ \comname{underline} command produces a one line
443 % box in LR mode that can't be split across lines. This means that long
444 % headings can't be split into two or more lines and will always result
445 % in overfull \comname{hbox}es. Secondly, the underline rule is placed
446 % underneath the lowest extent of the text and affects vertical spacing.
447 % This is particularly ugly in the case of \comname{paragraph} and
448 % \comname{subparagraph} headings which are on the same line as the
449 % first line of text of the section.
450 %
451 % Both these problems can be avoided by using the \packname{ulem}
452 % package (see section~\vref{ulemsource} for how to get it):
453 %\begin{verbatim}
454 % \documentclass{article}
455 % \usepackage{sectsty}
456 % \usepackage[normalem]{ulem}
457 % \allsectionsfont{\sffamily\underline}
458 %\end{verbatim}
459 % Don't forget that the \comname{underline} command must always be the
460 % last item in the \comname{\itinangle{section}font} command. This
461 % example uses the familiar \comname{underline} command as before, but
462 % because \packname{ulem} has been loaded, \packname{sectsty}
463 % automatically redefines \comname{underline} inside sectional headings
464 % to use \packname{ulem}'s underline code. The \comname{underline}
465 % command has its normal meaning outside sectional headings, so you won't
466 % get any nasty surprises.
467 %
468 % I prefer the results you get using the \packname{ulem} package, but
469 % you might prefer the appearance of underlined sectional headings
470 % produced without \packname{ulem}'s help. If so, and you're not using
471 % \comname{paragraph} or \comname{subparagraph} sections, or section
472 % headings that need to be split over two lines, there's no need to use
473 % \packname{ulem}.
474 %
475 % \packname{Sectsty} always plays some dirty tricks which involve
476 % re-defining the \comname{underline} command inside sectional headings
477 % only. These tricks work differently if \packname{ulem} has been
478 % loaded, but it doesn't matter whether you load \packname{ulem} before
479 % or after \packname{sectsty}.
480 %
481 % Despite these fun and games, the \comname{underline} command always
482 % has its usual definition outside sectional headings and will work
483 % normally in the rest of your document.
484 %
485 % \subsection{A detailed look at underlining}
486 %
487 % It is possible to underline sectional headings in other ways. This
488 % section explains how, and also explains a little more about
489 % underlining sectional headings with \packname{sectsty}.
490 %
491 % The \packname{secsty} package lets you use two different commands to
492 % underline sectional headings: \comname{underline} and
493 % \comname{ulemheading}. Both commands suffer from the same restriction
494 % in use: they must always be the last command in the argument to the
495 % \comname{\itinangle{section}font} command. Both commands can be used
496 % whether or not you've loaded \packname{ulem}: they are defined
497 % differently depending on whether or not the \packname{ulem} package
498 % has been loaded. The decision on which definition to use is made at
499 % the \comname{begin\ttlb document\ttrb} command, so you can load
500 % \packname{ulem} before or after \packname{sectsty}.
501 %
502 % If you want to use underlined headings, I strongly suggest you get the
503 % \packname{ulem} package as well. Without the \packname{ulem} package,
504 % you get identical results (with a few problems) in sectional headings
505 % using both \comname{underline} and \comname{ulemheading}.
506 %
507 % \packname{Sectsty} re-defines the \comname{underline} command inside
508 % sectional headings. This re-definition is what allows underlining to
509 % work correctly in all of the standard sectional headings, and allows
510 % the same command to behave differently if you've use the
511 % \packname{ulem} package. \TeX's usual grouping rules mean that the
512 % \comname{underline} command is restored to its usual meaning at the
513 % end of each sectional heading: the re-definition used by
514 % \packname{sectsty} should have no effect on the rest of your document.
515 %
516 % Assuming for the moment that you're not using \packname{ulem}, you can
517 % get a straightforward single underline using the normal \LaTeX\
518 % underline command like this:
519 %\begin{verbatim}
520 % \allsectionsfont{\underline}
521 %\end{verbatim}
522 % This has a few problems. Most noticeably, it won't allow sectional
523 % headings to break at the end of the line, so long headings will extend
524 % beyond the right hand edge of the text. This is because the standard
525 % \LaTeX\ \comname{underline} command puts its argument into a box made
526 % in LR mode, so headings underlined this way will be one line headings
527 % no matter what you do.
528 %
529 % Another problem is that the underline rule used sits below the lowest
530 % possible extent of the text it's underlining, and so increases the
531 % space between the underlined heading and the text below. This is
532 % especially noticeable if you're using \comname{paragraph} or
533 % \comname{subparagraph} headings. And remember that the
534 % \comname{underline} command must be the last in this list, like this:
535 %\begin{verbatim}
536 % \allsectionsfont{\sffamily\underline}
537 %\end{verbatim}
538 % If you put \comname{sffamily} (or anything else) after
539 % \comname{underline}, it won't work properly.
540 %
541 % \subsubsection{Underlining with the \packname{ulem} package}
542 %
543 % The \packname{ulem} package has some nice commands for improved
544 % underlining in normal text. The main advantages are that the underline
545 % rule is positioned better (so it doesn't mess up the line spacing),
546 % and it allows long underlined headings to break normally at the end of
547 % the line. All you need to do is load \packname{ulem}, and
548 % \packname{sectsty} will do the rest. Try the following example as it
549 % is here:
550 %\begin{verbatim}
551 % \documentclass{article}
552 % \usepackage{sectsty}
553 % \usepackage[normalem]{ulem}
554 % \allsectionsfont{\sffamily\raggedright\underline}
555 % \begin{document}
556 % \section{A very long sectional heading title that will
557 % have to be split over two lines}
558 % \end{document}
559 %\end{verbatim}
560 % You'll notice that the long section heading was split over two
561 % lines. Now try this:
562 %\begin{verbatim}
563 % \documentclass{article}
564 % \usepackage{sectsty}
565 % \allsectionsfont{\sffamily\raggedright\underline}
566 % \begin{document}
567 % \section{A very long sectional heading title that will
568 % have to be split over two lines}
569 % \end{document}
570 %\end{verbatim}
571 % You'll notice that the underlining rule is positioned differently, and
572 % the heading could not be split over two lines.
573 %
574 % If you want to use in sectional headings some of the other types of
575 % underlining allowed by the \packname{ulem} package, you can use the
576 % \comname{ulemheading} command, as in this example to give double
577 % underlining and raggedright sectional headings:
578 %\begin{verbatim}
579 % \usepackage{sectsty,ulem}
580 % \allsectionsfont{\raggedright\ulemheading{\uuline}}
581 %\end{verbatim}
582 % The \comname{ulemheading} command is meant to be used only inside
583 % sectional headings like this. It takes two arguments: the first
584 % argument is the \packname{ulem} package command to generate a
585 % particular style of underlining; the second argument is the text to be
586 % underlined, and is provided by the command that generates the
587 % sectional heading. All you have to do is provide the first argument
588 % and ensure that you put the \comname{ulemheading} at the end of the
589 % \comname{\itinangle{section}font} command's argument, as in this
590 % example to give you wavy underlined sans-serif headings:
591 %\begin{verbatim}
592 % \usepackage{sectsty,ulem}
593 % \allsectionsfont{\sffamily\ulemheading{\uwave}}
594 %\end{verbatim}
595 % The full list of modifications allowed by the \comname{ulemheading}
596 % command is:
597 % \begin{center}
598 % \begin{tabular}{ll}
599 % \ttbs ulemheading\ttlb\ttbs uline\ttrb & single underline \\
600 % \ttbs ulemheading\ttlb\ttbs uuline\ttrb & double underline \\
601 % \ttbs ulemheading\ttlb\ttbs uwave\ttrb & wavy underline \\
602 % \ttbs ulemheading\ttlb\ttbs sout\ttrb & strike out with \texttt{-} \\
603 % \ttbs ulemheading\ttlb\ttbs xout\ttrb & cross out with \texttt{/} \\
604 % \end{tabular}
605 % \end{center}
606 % It's possible to define more by following the directions in the
607 % \packname{ulem} package.
608 %
609 % If you typeset a document that uses \comname{ulemheading} on a system
610 % where the \packname{ulem} package is unavailable, the document will be
611 % processed but the output will be different. If you've not loaded the
612 % \packname{ulem} package, \comname{ulemheading} will produce
613 % underlining exactly the same as if you'd used the \comname{underline}
614 % command: \comname{ulemheading} is defined to ignore the first argument
615 % and pass the heading text to the normal underlining code. This means
616 % you can produce a document using \packname{ulem}'s fancy underlining,
617 % and process it on a \LaTeX\ system without \packname{ulem} by making a
618 % single modification: commenting out the \comname{usepackage\ttlb
619 % ulem\ttrb} command. The results will of course be different, but the
620 % document will typeset.
621 %
622 % \subsubsection{More notes on \packname{ulem} and
623 % underlining}\label{ulemsource}
624 %
625 % The \packname{ulem} package is available via anonymous ftp from the
626 % Comprehensive \TeX\ Archive Network (CTAN).
627 % You can find a list of CTAN sites and a Web interface to CTAN at
628 % \texttt{http://www.tug.org/ctan.html}. The following ftp urls work now
629 % (August 1998):
630 % \begin{center}
631 %{\footnotesize\begin{tabular}{@{}l@{}}
632 % \ttfamily
633 % ftp://ftp.dante.de/tex-archive/macros/latex/contrib/other/misc/ulem.sty\\
634 % \ttfamily
635 % ftp://ftp.tex.ac.uk/tex-archive/macros/latex/contrib/other/misc/ulem.sty\\
636 % \ttfamily
637 % ftp://ctan.tug.org/tex-archive/macros/latex/contrib/other/misc/ulem.sty\\
638 %\end{tabular}}
639 % \end{center}
640 % The \packname{ulem} package was written by Donald Arseneau, who
641 % contributed some code and lots of useful advice to \packname{sectsty}.
642 %
643 % It doesn't matter if you load \packname{ulem} before or after
644 % \packname{sectsty}, because \packname{sectsty} waits until the
645 % \comname{begin\ttlb document\ttrb} command before checking to see if
646 % \packname{ulem} has been loaded.
647 %
648 % \packname{Sectsty} uses a cunning trick to re-define the
649 % \comname{underline} command inside sectional headings only;
650 % \comname{underline} will work normally outside sectional headings.
651 % The trick is cunning because the re-definition is different if the
652 % \packname{ulem} package is in use in that document: the commands that
653 % make this trick work wait until the \comname{begin\ttlb document\ttrb}
654 % command has been executed, so it doesn't matter if you load
655 % \packname{ulem} before or after \packname{sectsty}.
656 %
657 % The \comname{underline} and \comname{ulemheading} commands produce
658 % identical results if the \packname{ulem} package is not loaded; they
659 % will both use \LaTeX's normal underlining mechanism. If you do load
660 % \packname{ulem}, \comname{underline} will produce nicer results, and
661 % \comname{ulemheading} will allow you to use any of \packname{ulem}'s
662 % different underlining styles.
663 %
664 % The \packname{ulem} package changes \LaTeX's emphasis commands so that
665 % they use underlining rather than italics for emphasis. If you don't
666 % want this, you should load \packname{ulem} with the |normalem| option:
667 %\begin{verbatim}
668 % \usepackage[normalem]{ulem}
669 %\end{verbatim}
670 %
671 % \section{Other things you can do with \packname{sectsty}}
672 %
673 % Here are a few other things you can do using \packname{sectsty}; the
674 % techniques for modifying section heading numbers work with or without
675 % \packname{sectsty}. If you find that you can already get
676 % \packname{sectsty} to do what you want to do, it might be an idea to
677 % leave reading this section until later.
678 %
679 % If you are going to read on, an apology: the \packname{sectsty}
680 % package was originally meant to be a very simple thing to use. Various
681 % requests from people who wanted to do various things mean that it's no
682 % longer as simple to use as I'd like. This can't be helped: some people
683 % \emph{need} underlining, and that's that. Unfortunately, the
684 % documentation has ended up much more complicated that I'd like. This
685 % section makes it even worse. I hope that the use people get from the
686 % over long documentation outweighs the extra hassle it causes.
687 %
688 % \subsection{Suppressing a page number}
689 % It's occasionally useful to be able to suppress page numbering on the
690 % first page of a chapter. You can do this by saying:
691 %\begin{verbatim}
692 % \chapterfont{\thispagestyle{empty}}
693 %\end{verbatim}
694 % This works because the argument to the \comname{chapterfont} command
695 % is (obviously) executed on the page that the chapter begins on. As
696 % luck has it, it's executed after the \comname{thispagestyle\ttlb
697 % plain\ttrb} command issued by the \comname{chapter} command, so the
698 % page style selected by the \comname{chapterfont} command is the one
699 % that's used.
700 %
701 % \subsection{Rules around sectional headings}
702 %
703 % I've included a `unofficial' command, \comname{sectionrule}, in
704 % \packname{sectsty} that can put a solid rule across the entire width
705 % of the page, above and below a sectional heading. It's probably a good
706 % idea to visit the library and study some typography books before using
707 % this command. The command must be used as the last command in a
708 % \comname{\itinangle{section}font} command, and has this syntax:
709 % \begin{center}
710 % \begin{tabular}{ll}
711 % \comname{sectionrule} & \comarg{raise top by}\comarg{top rule height}\\
712 % & \comarg{raise bottom by}\comarg{bottom rule height}\\
713 % \end{tabular}
714 % \end{center}
715 % \comarg{raise top by} is the length that the top rule is raised above
716 % the baseline of the top line of the heading;
717 % \comarg{top rule height} is the height (thickness) of the top rule;
718 % \comarg{raise bottom by} is the length that the bottom rule is raised
719 % above the baseline of the bottom line of the heading (a negative
720 % length places the rule underneath the last line); and
721 % \comarg{bottom rule height} is the height (thickness) of the bottom
722 % rule.
723 %
724 % The \comname{sectionrule} command works like this:
725 %\begin{verbatim}
726 % \sectionfont{\sectionrule{3ex}{3pt}{-1ex}{1pt}}
727 %\end{verbatim}
728 % What this example does is place two rules across the full width of the
729 % text. One is a 3\,pt rule 3\,ex above the baseline of the top line of
730 % the heading, and the other is a 1\,pt rule 1\,ex below the baseline of
731 % the bottom line of the heading.
732 %
733 % The vertical space before and after sectional headings can be affected
734 % by these rules: the vertical space around a heading is placed before
735 % and after \emph{everything} that is printed for the sectional heading,
736 % so if a rule is the topmost item in the sectional heading, then the
737 % vertical space will be measured to that rule.
738 %
739 % Setting the height of either rule to 0\,pt will make it invisible,
740 % although such a rule can still have an effect on spacing if you raise
741 % or lower it.
742 %
743 % The \comname{sectionrule} command has a few problems: in particular,
744 % it can't place rules around centred headings, and it doesn't work
745 % properly with run in headings such as the standard \comname{paragraph}
746 % and \comname{subparagraph} headings. You might like to try the
747 % \packname{titlesec} package if \packname{sectsty} can't help you do
748 % what you want.
749 %
750 % Because \comname{sectionrule} must be the last command in a
751 % \comname{\itinangle{section}font} command, it can't be used with
752 % underlined section headings: the underlining commands must
753 % also be placed last, so you can't have both underlining and rules
754 % around a sectional heading.
755 %
756 % I wrote the \comname{sectionrule} command and it will be staying in
757 % \packname{sectsty}. I call it `unofficial' because \packname{sectsty}
758 % is meant to be very simple, and this command takes things a long way
759 % away from my original `design concept'; this is why it's not
760 % mentioned in the bulk of the documentation above.
761 %
762 % \subsection{A box around sectional headings}
763 %
764 % You can put a sectional heading inside a frame using the standard
765 % \LaTeX\ \comname{fbox} command like this:
766 %\begin{verbatim}
767 % \sectionfont{\noindent\fbox}
768 %\end{verbatim}
769 %
770 % This has two limits: it doesn't work with \comname{chapter} or
771 % \comname{part} headings, and it only works with single line headings.
772 % The reason for this last problem is that the \comname{fbox} command
773 % typesets text in LR mode and will therefore always produce a single
774 % line of text.
775 %
776 % I've heard that other box making commands can be used to place a frame
777 % around a sectional heading in a similar way (\comname{colorbox}
778 % apparently works). If you use any box making command like this, you
779 % will need to add a \comname{noindent} as with \comname{fbox}. This is
780 % because the box making command switches \TeX\ from vertical mode to
781 % horizontal mode, which inserts a paragraph indent unless there's a
782 % \comname{noindent} at that point. There is a \comname{noindent}
783 % command buried deep inside the code that produces sectional headings,
784 % but too late on to help with this.
785 %
786 % Another way of putting a box round a sectional heading gets round the
787 % one-line limit of the simple approach above:
788 %\begin{verbatim}
789 % \makeatletter
790 %
791 % \newcommand{\sectbox}[1]{%
792 % \noindent\protect\fbox{%
793 % \@tempdima=\hsize
794 % \advance\@tempdima by-2\fboxsep
795 % \advance\@tempdima by-2\fboxrule
796 % \protect\parbox{\@tempdima}{%
797 % \smallskip
798 % % extra commands here
799 % #1\smallskip
800 % }}}
801 %
802 % \makeatother
803 %
804 % \sectionfont{\sectbox}
805 %\end{verbatim}
806 % Again, this doesn't work properly with \comname{chapter} or
807 % \comname{part} headings; another limit is that the \comname{sectbox}
808 % command must be the last command in the
809 % \comname{\itinangle{section}font} command.
810 %
811 % This technique has two significant differences to the first
812 % suggestion: firstly, it puts a bit of extra vertical space between the
813 % text and the frame, which improves the appearance of the heading;
814 % secondly, it places the text of the heading inside a \comname{parbox}
815 % that stretches across the full width of the text. This means that
816 % long headings can be broken across lines, and also that the
817 % surrounding frame extends across the full width of the text, rather
818 % than just enclosing the text of the heading.
819 %
820 % While you can use fount changing commands as usual with the
821 % \comname{sectbox} command --
822 % \comname{sectionfont\ttlb\comname{sffamily}\comname{sectbox}\ttrb}
823 % will work as expected -- the use of \comname{parbox} means that
824 % \comname{raggedright} and similar commands won't work in
825 % \comname{\itinangle{section}font} commands. There is a way round this
826 % problem: put the appropriate command in the definition of
827 % \comname{sectbox} at the place marked \verb|extra commands here|. For
828 % example, you could say:
829 %\begin{verbatim}
830 % \makeatletter
831 %
832 % \newcommand{\sectbox}[1]{%
833 % \noindent\protect\fbox{%
834 % \@tempdima=\hsize
835 % \advance\@tempdima by-2\fboxsep
836 % \advance\@tempdima by-2\fboxrule
837 % \protect\parbox{\@tempdima}{%
838 % \smallskip
839 % \raggedright% extra commands here
840 % #1 \smallskip
841 % }}}
842 %
843 % \makeatother
844 %
845 % \sectionfont{\sectbox}
846 %\end{verbatim}
847 % and you'd get raggedright headings within the box. Both
848 % \comname{raggedleft} and \comname{centering} also work, although you
849 % might like to use \comname{nohang} with \comname{centering}.
850 %
851 % \subsection{Changes to section numbers}
852 %
853 % The two suggestions below don't require \packname{sectsty}; I'm
854 % including them because if you're using \packname{sectsty}, you
855 % might want to do something like this.
856 %
857 % The suggestions modify the \comname{@seccntformat} command. This is
858 % the internal \LaTeX\ command which prints the number part of all
859 % sectional headings except chapter and part headings. It's quite in
860 % order to change this sort of command: one of the reasons this command
861 % exists in the first place is so that people can change it to modify
862 % the output they get with \LaTeX. You can find out more about it
863 % by \LaTeX ing \filename{classes.dtx}, part of the standard \LaTeX\
864 % distribution.
865 %
866 % The best place in general for the modifications I suggest in this
867 % section is in a class or package file. If you put the modifications
868 % there, you won't need the surrounding \comname{makeatletter} and
869 % \comname{makeatother} commands.
870 %
871 % If you find yourself wanting to do more stuff along these lines, it
872 % might be an idea to look at the \packname{titlesec} package from CTAN.
873 %
874 % \subsubsection{Printing the section number in the left margin}
875 %
876 % This is a quick hack I stumbled over by accident one day and I hope
877 % someone else finds it useful. I haven't tested it thoroughly, so do be
878 % aware that it might produce unwanted effects; I can't see that it will
879 % do anything untoward, but I think it's best to be paranoid when
880 % dealing with computers.
881 %
882 % Putting this code in the preamble of your document:
883 %\begin{verbatim}
884 % \makeatletter
885 % \def\@seccntformat#1{\protect\makebox[0pt][r]{\csname
886 % the#1\endcsname\quad}}
887 % \makeatother
888 %\end{verbatim}
889 % will typeset the number of each section in the left margin, with the
890 % start of each instance of sectional heading text aligned with the left
891 % hand edge of the body text. It doesn't affect chapter or part
892 % headings. This code won't affect the normal paragraph and subparagraph
893 % headings. If you change the normal form of these headings by telling
894 % \LaTeX\ to print section numbers with them, paragraph headings will
895 % work as you'd expect, but subparagraph headings will have the section
896 % number to the left of the normal position although not in the left
897 % margin.
898 %
899 % \subsubsection{Putting a full stop (period) after the section number}
900 %
901 % Requests on how to do this appear in \texttt{news://comp.text.tex}
902 % quite often. One solution is:
903 %\begin{verbatim}
904 % \makeatletter
905 % \def\@seccntformat#1{\csname the#1\endcsname.\quad}
906 % \makeatother
907 %\end{verbatim}
908 % This will put a full stop after sectional numbers in sectional headers
909 % other than part and chapter headings. It doesn't affect
910 % cross-references or table of contents entries.
911 %
912 % An interesting extension to the simple original command allows you to
913 % control the style of numbering you get with each level of sectional
914 % heading independently:
915 %\begin{verbatim}
916 % \makeatletter
917 % \def\@seccntformat#1{\@ifundefined{#1@cntformat}%
918 % {\csname the#1\endcsname\quad}% default
919 % {\csname #1@cntformat\endcsname}% individual control
920 % }
921 % \def\section@cntformat{\thesection.\quad}
922 % \def\subsection@cntformat{\thesubsection.\quad}
923 % \makeatother
924 %\end{verbatim}
925 % this example gives you a full stop after section and subsection
926 % headings, and has no effect on other levels.
927 %
928 % \section{Compatibility with other packages}
929 %
930 % The \packname{sectsty} package works by blindly re-defining the
931 % various sectioning commands, so any package that requires
932 % that \LaTeX's sectioning commands are precisely as they are defined
933 % in the standard classes will have trouble working with
934 % \packname{sectsty}.
935 %
936 % The \packname{fncychap} package, for example, re-defines the code
937 % that produces chapter headings. If you use \packname{fncychap} with
938 % \packname{sectsty}, you will have to load \packname{fncychap} after
939 % \packname{sectsty}:
940 %\begin{verbatim}
941 % \usepackage{sectsty}
942 % \usepackage{fncychap}
943 %\end{verbatim}
944 % You'll find that \packname{sectsty} will have no effect on chapter
945 % headings when you use it like this.
946 %
947 % Some packages perform interesting tricks to add code to the standard
948 % sectioning commands. These packages might well work quite happily
949 % with \packname{sectsty}, but they must be loaded after
950 % \packname{sectsty}: because \packname{sectsty} re-defines the
951 % sectioning commands, any earlier changes will be thrown away.
952 %
953 % In particular, the \packname{minitoc} package modifies the sectioning
954 % commands (rather than just re-defining them like \packname{sectsty}
955 % does), but if you say:
956 %\begin{verbatim}
957 % \usepackage{sectsty,minitoc}
958 %\end{verbatim}
959 % to load \packname{minitoc} after \packname{sectsty}, everything should
960 % work perfectly.
961 %
962 % \StopEventually{}
963 %
964 % \iffalse
965 % 2002/02/25 v2.0.2 Changed email address and fiddled with scribbles
966 % round the edges. No code changes.
967 % 1999/04/12 v2.0.1 changed licence conditions to lppl.txt; stopping
968 % it typesetting code by default (silly boy). Released.
969 % 1999/04/07 v2.0 bit the bullet. Released
970 % 1999/04/06 v1.9.7 Added KOMA-script note. Unreleased.
971 % 1999/03/08 v1.9.6 Fixed \sectbox definition. Commented out the
972 % redundant chapfudge defs. Unreleased.
973 % 1999/02/07 v1.9.5 Fixed showkeys problem thanks to Bernd Schandl.
974 % More playing with underlining code. Unreleased.
975 % 1999/01/22 v1.9.4 Playing with underlining code. Unreleased.
976 % 1999/01/20 v1.9.3 Changed \SS@sectlevel to \SSsectlevel so that it
977 % can be used inside documents. It's 1999, not 1998. Hunted down
978 % and killed yet another spurious space. Well, killed it anyway.
979 % God knows where it actually was. Doc mods. First bash at
980 % getting \sectionrule to work with the KOMA-script classes.
981 % Unreleased.
982 % 1999/01/18 v1.9.2 added grouping to \chapter and \part commands.
983 % Why didn't I do this ages ago? Hunted down and killed a
984 % spurious space. Added grouping to \minisec too, and made its
985 % underlining stuff same as part and chapter stuff. Changed
986 % \SE@ to \SS@. Unreleased.
987 % 1999/01/15 v1.9.1 added debugging stuff. Unreleased.
988 % 1999/01/13 v1.9 added stuff for KOMA-script classes. Untested,
989 % undocumented, and unreleased. This will transmogrify into v2.0
990 % when it's ready for release.
991 % 1999/01/06 v1.8.7 Added warning if sectsty isn't going to do
992 % anything because article, report, or book haven't been loaded.
993 % Released.
994 % 1999/01/03 v1.8.6 More \fbox doc bits. Added \ttbs command and
995 % changed \comname definition to use it. Untested. Unreleased.
996 % 1998/12/29 v1.8.5 Added doc note about \fbox. Unreleased.
997 % 1998/12/11 v1.8.4 Fixed \nohang bug (how the hell did *that*
998 % happen?). Some documentation mods. Released
999 % 1998/12/10 v1.8.3 Documention mods. Unreleased
1000 % 1998/12/10 v1.8.2 Documention mods. Released
1001 % 1998/12/09 v1.8.1 Documentation mods and changed syntax of
1002 % \sectionrule command. Modified doc stuff so code comes out in
1003 % 9pt and codeline numbers in 7pt, as standard. Unreleased.
1004 % 1998/12/08 v1.8 Major \sectionrule mods - should now work with
1005 % raggedleft and chapter/part headings as well. Documentation
1006 % mods. Unreleased
1007 % 1998/12/06 v1.7.2 Documentation mods. Unreleased.
1008 % 1998/12/01 v1.7.1 Documentation mods. Unreleased.
1009 % 1998/11/29 v1.7 Stopped being such a bloody fool and added \nohang.
1010 % Added note about rule under chapter and part headings.
1011 % Unreleased
1012 % 1998/11/19 v1.6 Probably dealt with centering/underline multiline
1013 % problem. Taken Donald Arseneau's name out of the copyright
1014 % notice. Some doc changes. Unreleased
1015 % 1998/11/18 v1.5.3 Minor doc changes. Released?
1016 % 1998/11/16 v1.5.2 Minor doc changes. Re-positioned \strut in
1017 % \SS@ulemsectuline. Unreleased.
1018 % 1998/11/15 v1.5.1 Added \strut to \SS@ulemsectuline. Some doc
1019 % changes. Unreleased.
1020 % 1998/11/14 v1.5 Changed \sectionrule command and documented it.
1021 % Changed \@svec fix to \let. Not released.
1022 % 1998/11/12 v1.4.4 added \sectionrule command. Iffy. No doc changes.
1023 % Unreleased.
1024 % 1998/11/11 v1.4.3 Moved the version history; added fix for
1025 % underlining *-form heading problem; minor documentation mods;
1026 % started to document way of putting a full width rule underneath
1027 % a section heading and ran into trouble; unreleased.
1028 % 1998/08/24 v1.4.2 Yet more documentation mods; unreleased
1029 % 1998/08/20 v1.4.1 Documentation mods; unreleased
1030 % 1998/08/05 v1.4 more underlining modifications and finished docs
1031 % 1998/07/15 v1.3 added sectional heading underlining stuff and added
1032 % some more documentation. Unreleased.
1033 % 1998/06/28 v1.2 removed \selectfont commands which are redundant
1034 % and stop you using commands that take the sectional heading as
1035 % an argument. This is to allow you to underline sectional
1036 % headings, as is often required in theses etc.
1037 % 1998/05/28 v1.1.1 fixed problem with \OnlyDescription and
1038 % corrected \CheckSum (kicks self vigorously)
1039 % 1998/05/27 v1.1 Fixed bugs in chapter/part code, corrected a
1040 % documentation bug, and added a few more notes (thanks to
1041 % Bernd Schandl <[email protected]>). And removed the
1042 % spurious spaces from the other sectional headings (grr).
1043 % 1998/05/26 v1.0 Made into dtx/ins pair for general release
1044 % 1998/05/13 v0.2 Changed more than a little
1045 % 1996/12/08 v0.1 original version
1046 %\fi
1047 %
1048 % \iffalse
1049 % This code is used to switch to the usual fount sizes for
1050 % typesetting the code; because this document is typeset in 11pt rather
1051 % than 10pt, the code would normally be typeset in a larger than usual
1052 % fount leading to lots of overfull \hboxes. I've bunged it here so
1053 % the casual reader can see what's going on - it's executed just
1054 % before the first code is typeset.
1055 %
1056 % Because this document is set in 11pt, need to select a smaller than
1057 % usual size for \MacroFont to get the macros set in 9pt, and code line
1058 % numbers set in 7pt.
1059 %
1060 % Yes, I know it's ugly. It was a bit of a battle to get it to work,
1061 % and now that it does work, I'm loathe to change anything.
1062 %\fi
1063 %
1064 % \makeatletter
1065 % \def\macro@font{\fontencoding \encodingdefault \fontfamily \ttdefault
1066 % \fontseries \mddefault \fontshape \updefault \footnotesize}
1067 % \let\MacroFont\macro@font
1068 %
1069 % \def\theCodelineNo{\rmfamily%
1070 % \@setfontsize\scriptsize\@viipt\@viiipt%
1071 % \arabic{CodelineNo}}
1072 % \makeatother
1073 %
1074 %
1075 % \section{The code itself}
1076 %
1077 %
1078 % Who am I, and what do I need? This package will probably work with
1079 % any version of \LaTeXe, but I've only tested it with the June
1080 % 1998 release and some later ones.
1081 %
1082 % \begin{macrocode}
1083 \ProvidesPackage{sectsty}[2002/02/25 v2.0.2 Commands to change all
1084 sectional heading styles]
1085 \NeedsTeXFormat{LaTeX2e}[1998/06/01]
1086 % \end{macrocode}
1087 %
1088 % \subsection{Options}
1089 %
1090 % \subsubsection{Control how much stuff is reported}
1091 %
1092 % This lot is for my benefit at the moment. Maybe the full range of
1093 % values will have some meaning one day.
1094 %
1095 % \begin{macro}{\SS@ocl}
1096 % \comname{SS@ocl}\comarg{number}\comarg{if okay to blather}\comarg{if
1097 % not okay to blather}
1098 %
1099 % (ocl stands for On Chat Level)
1100 %
1101 % If \comarg{number} (1-4) is greater than the current chat level, then
1102 % blather away. If not, do the other thing. So use 4 for stuff to be
1103 % printed all the time, and 1 for other stuff.
1104 %
1105 % \begin{macrocode}
1106 \long\def\SS@ocl#1#2#3{\ifnum #1>\SS@chatlevel #2\else #3\fi}
1107 % \end{macrocode}
1108 % \end{macro}
1109 %
1110 % \begin{macro}{\SS@oclto}
1111 %
1112 % On Chat Level TypeOut -- used for debugging reports (etc).
1113 %
1114 % \begin{macrocode}
1115 \def\SS@oclto#1#2{\SS@ocl{#1}{\typeout{#2}}{}}
1116 % \end{macrocode}
1117 % \end{macro}
1118 %
1119 %
1120 % \begin{macro}{\SS@chatlevel}
1121 % By default, don't make much fuss.
1122 % \begin{macrocode}
1123 \def\SS@chatlevel{3}
1124 % \end{macrocode}
1125 %
1126 % Maybe I'll activate the other options one of these days, but only if
1127 % the messages are meant for people other than me.
1128 %
1129 % \begin{macrocode}
1130 % \DeclareOption{verbose}{\def\SS@chatlevel{1}}% chatty
1131 % \DeclareOption{silent}{\def\SS@chatlevel{3}}% yorkshire
1132 %
1133 % \DeclareOption{errorshow}{\def\SSchatlevel{3}}% yorkshire
1134 % \DeclareOption{warningshow}{\def\SS@chatlevel{2}}% taciturn
1135 % \DeclareOption{infoshow}{\def\SS@chatlevel{1}}% chatty
1136 % \DeclareOption{debugshow}{\def\SS@chatlevel{0}}% garrulous
1137 %
1138 \DeclareOption{garrulous}{\def\SS@chatlevel{0}}
1139 \DeclareOption{chatty}{\def\SS@chatlevel{1}}
1140 \DeclareOption{taciturn}{\def\SS@chatlevel{2}}
1141 \DeclareOption{yorkshire}{\def\SS@chatlevel{3}}
1142 % \end{macrocode}
1143 % \end{macro}
1144 %
1145 % \begin{macrocode}
1146 \ProcessOptions
1147 % \end{macrocode}
1148 %
1149 %
1150 % \subsection{Underlining}
1151 %
1152 % Stuff for underlining sectional headings. I didn't write much of
1153 % this myself.
1154 %
1155 %\begin{macro}{\@svsec}
1156 % First thing to do\ldots\ Define |\@svsec| to prevent underlining
1157 % extras throwing a wobbly when you try to underline a |\section*| or
1158 % similar. |\@svsec| is referred to by the underlining code, but it
1159 % normally only exists inside the non star form of the commands
1160 % generating sectional headings.
1161 % \begin{macrocode}
1162 \let\@svsec\relax
1163 % \end{macrocode}
1164 %\end{macro}
1165 %
1166 %\begin{macro}{\nohang}
1167 % A hack: you should get hanging indentation on subsequent lines of all
1168 % sectional headings, but this isn't always appropriate.
1169 % \comname{nohang} suppresses the hanging indentation. If you're using
1170 % centred or raggedright headings, a bug in \comname{@centercr} means
1171 % the hanging indentation is suppressed if you end lines with |\\|.
1172 % \begin{macrocode}
1173 \newcommand{\nohang}{\let\@hangfrom\@empty}
1174 % \end{macrocode}
1175 %\end{macro}
1176 %
1177 % And then add some stuff so that:
1178 %\begin{verbatim}
1179 % \section{Algorithm according to \cite{knuth}}
1180 %\end{verbatim}
1181 % works when using the \packname{showkeys} package. Problem reported by
1182 % and solved by Bernd Schandl.
1183 %\begin{macro}{\SS@origunderline}
1184 % start by saving the original definition of \comname{underline}
1185 % \begin{macrocode}
1186 \let\SS@origunderline\underline
1187 % \end{macrocode}
1188 %\end{macro}
1189 %
1190 % Then check to ensure that the \comname{underbar} command is as it
1191 % should be by default. This matters: \comname{underbar} is defined
1192 % inside sectional headings to use \comname{orig@underline} rather than
1193 % \comname{underline}, because \comname{underline} is redefined under
1194 % such circumstances; this breaks the \comname{underbar} command used
1195 % by \packname{showkeys}. If \comname{underbar}'s definition has
1196 % changed, I need to know about it.
1197 %
1198 % \begin{macrocode}
1199 \CheckCommand*{\underbar}[1]%
1200 {\underline{\sbox\tw@{#1}\dp\tw@\z@\box\tw@}}
1201 % \end{macrocode}
1202 %
1203 % \subsubsection{Main underlining code}
1204 % The first command is for underlining sectional headings created
1205 % with |\@startsection|.
1206 %
1207 %\begin{macro}{\SS@ulemsectuline}
1208 %
1209 % |\SS@ulemsectuline| is a hack that modifies the behaviour of sections
1210 % created using the |\@startsection| command. It allows you to underline
1211 % sectional headings with fewer problems than otherwise. First argument
1212 % is the \packname{ulem} underlining command; second argument is the
1213 % section heading text to underline.
1214 % \begin{macrocode}
1215 \newcommand*{\SS@ulemsectuline}[2]{%
1216 \ifhmode% run-in head
1217 \begingroup%
1218 \def\hskip##1\relax##2\@@par{\endgroup\@@hskip##1\relax#1{##2}}%
1219 \else% stand alone head
1220 % \ifx\\\@centercr\let\@hangfrom\@empty\fi% deal with \@hangfrom prob
1221 \protected@edef\@svsec{\noexpand#1{\@svsec\strut}}% added strut
1222 \def\interlinepenalty##1##2\@@par{\@@interlinepenalty##1#1{##2}\@@par}%
1223 \fi%
1224 #2\@@par}% added strut here then removed it (stupid boy)
1225 \let\@@hskip\hskip
1226 \let\@@interlinepenalty\interlinepenalty
1227 % \end{macrocode}
1228 %\end{macro}
1229 %
1230 % \begin{macro}{\SS@chapuline}
1231 %
1232 % A simple command that underlines everything up to the next |\par|.
1233 % It's used to underline chapter and part headings. The |\part|
1234 % commands need a bit of extra modification for this to work. This
1235 % command is now obsolete, because I turned my brain on and added
1236 % grouping to the chapter and part code, so I don't have to use
1237 % \comname{par} as an argument delimiter any more.
1238 % \begin{macrocode}
1239 % \def\SS@chapuline#1\par{\uline{#1}\par}
1240 % \end{macrocode}
1241 %\end{macro}
1242 %
1243 % \begin{macro}{\SS@underline}
1244 % Save the definition of |\underline| in |\SS@underline| so \LaTeX's
1245 % normal |\underline| command is available in sectioning commands when
1246 % |\underline| has been re-defined. For some reason, the construction
1247 % |\let\SS@underline\underline| didn't work right so I started doing
1248 % it this way. This way is now essential, because I need to add
1249 % |\strut|s to keep the underlines lined up (|\SS@ulemsectuline|
1250 % underlines the numbers and words of a heading separately, which
1251 % means the underlining would have a discontinuity unless I forced all
1252 % both the number and title boxes to have the same depth by adding a
1253 % |\strut| to each).
1254 %
1255 % First check the definition of |\underline| in |latex.ltx|
1256 % hasn't changed; then define |\SS@underline| to be the same with added
1257 % struts.
1258 % \begin{macrocode}
1259 \CheckCommand*{\underline}[1]{%
1260 \relax
1261 \ifmmode\@@underline{#1}%
1262 \else $\@@underline{\hbox{#1}}\m@th$\relax\fi}
1263 %
1264 \def\SS@underline#1{%
1265 \relax
1266 \ifmmode\@@underline{\strut#1}%
1267 \else $\@@underline{\hbox{\strut#1}}\m@th$\relax\fi}
1268 % \end{macrocode}
1269 % \end{macro}
1270 %
1271 %\begin{macro}{\SS@ulemunderlinechapfudge}
1272 %\begin{macro}{\SS@ulemheadingchapfudge}
1273 %\begin{macro}{\SS@normunderlinechapfudge}
1274 %
1275 % Three remarkable similar commands, written to deal with the problem of
1276 % underlining the number part of KOMA-script chapter headings. I'm sure
1277 % there's a better way of doing it, but this appears to work and my head
1278 % hurts now.
1279 %
1280 % \comname{SS@ulemheadingchapfudge} is the only one which is still
1281 % used. I've not changed the name to anything more sensible out of
1282 % sheer inertia.
1283 %
1284 % \begin{macrocode}
1285 % \def\SS@ulemunderlinechapfudge#1{%
1286 % \ifSS@komascript%
1287 % \ifnum\SSsectlevel=1% chapter level
1288 % \ifx\SS@headingpart\SS@nopartid%
1289 % \SS@oclto{1}{Koma-script chapter number part}%
1290 % \let\SS@savechapterformat\chapterformat%
1291 % \def\chapterformat{\uline{\SS@savechapterformat}}%
1292 % \def\@tempcmda{#1}%
1293 % \else%
1294 % \SS@oclto{1}{Koma-script chapter title part}%
1295 % \def\@tempcmda{\uline{#1}}%
1296 % \fi%
1297 % \else%
1298 % \SS@oclto{1}{Koma-script not chapter}%
1299 % \def\@tempcmda{\uline{#1}}%
1300 % \fi%
1301 % \else%
1302 % \SS@oclto{1}{Not Koma-script}%
1303 % \def\@tempcmda{\uline{#1}}%
1304 % \fi%
1305 % \@tempcmda
1306 % }%
1307
1308 \def\SS@ulemheadingchapfudge#1#2{%
1309 \ifSS@komascript%
1310 \ifnum\SSsectlevel=1% chapter level
1311 \ifx\SS@headingpart\SS@nopartid%
1312 \SS@oclto{1}{Koma-script chapter number part}%
1313 \let\SS@savechapterformat\chapterformat%
1314 \def\chapterformat{#1{\SS@savechapterformat}}%
1315 \def\@tempcmda{#2}%
1316 \else%
1317 \SS@oclto{1}{Koma-script chapter title part}%
1318 \def\@tempcmda{#1{#2}}%
1319 \fi%
1320 \else%
1321 \SS@oclto{1}{Koma-script not chapter}%
1322 \def\@tempcmda{#1{#2}}%
1323 \fi%
1324 \else%
1325 \SS@oclto{1}{Not Koma-script}%
1326 \def\@tempcmda{#1{#2}}%
1327 \fi%
1328 \@tempcmda
1329 }%
1330
1331 % \def\SS@normunderlinechapfudge#1{%
1332 % \ifSS@komascript%
1333 % \ifnum\SSsectlevel=1% chapter level
1334 % \ifx\SS@headingpart\SS@nopartid%
1335 % \SS@oclto{1}{Koma-script chapter number part}%
1336 % \let\SS@savechapterformat\chapterformat%
1337 % \def\chapterformat{\SS@underline{\SS@savechapterformat}}%
1338 % \def\@tempcmda{#1}%
1339 % \else%
1340 % \SS@oclto{1}{Koma-script chapter title part}%
1341 % \def\@tempcmda{\SS@underline{#1}}%
1342 % \fi%
1343 % \else%
1344 % \SS@oclto{1}{Koma-script not chapter}%
1345 % \def\@tempcmda{\SS@underline{#1}}%
1346 % \fi%
1347 % \else%
1348 % \SS@oclto{1}{Not Koma-script}%
1349 % \def\@tempcmda{\SS@underline{#1}}%
1350 % \fi%
1351 % \@tempcmda
1352 % }%
1353 % \end{macrocode}
1354 % \end{macro}
1355 % \end{macro}
1356 % \end{macro}
1357 %
1358 %\begin{macro}{\underline}
1359 %\begin{macro}{\ulemheading}
1360 % Two commands:
1361 % |\underline{text}|
1362 % used for normal underlining in all headings
1363 % |\ulemheading{ulem underline command}{text}|
1364 % used for fancy underlining in all headings
1365 %
1366 % Basic idea:
1367 %
1368 % \comname{SS@makeulinesect} defines \comname{underline} and
1369 % \comname{ulemheading}
1370 % appropriately for |\@startsection| headings.
1371 %
1372 % |\SS@makeulinechap| defines |\underline| and |\ulemheading| appropriately
1373 % for chapter and modified part headings.
1374 %
1375 % \begin{macrocode}
1376 \AtBeginDocument{%
1377 \@ifundefined{UL@box}%
1378 {% if ulem has not been loaded
1379 \SS@oclto{1}{ulem not loaded; underlining setup}%
1380 \def\SS@makeulinesect{%
1381 % \def\underline##1{\noindent\SS@underline{##1}}%
1382 \def\underbar##1{\SS@origunderline{\sbox\tw@{##1}\dp\tw@\z@\box\tw@}}%
1383 \def\underline{\SS@ulemsectuline{\SS@underline}}%
1384 \def\ulemheading##1{\SS@ulemsectuline{\SS@underline}}}%
1385 %
1386 \def\SS@makeulinepartchap{%
1387 % \def\underline##1\par{\SS@underline{##1}\par}
1388 % \def\ulemheading##1##2\par{\SS@underline{##2}\par}}%
1389 % \def\underline##1{\SS@underline{##1}}% pre KOMA-script
1390 % \def\ulemheading##1##2{\SS@underline{##2}}}% pre KOMA-script
1391 \def\underbar##1{\SS@origunderline{\sbox\tw@{##1}\dp\tw@\z@\box\tw@}}%
1392 % \let\underline\SS@normunderlinechapfudge% 7/2/99
1393 \def\underline##1{\SS@ulemheadingchapfudge{\SS@underline}{##1}}%
1394 % \def\ulemheading##1##2{\SS@normunderlinechapfudge{##2}}% 7/2/99
1395 \def\ulemheading##1##2{\SS@ulemheadingchapfudge{\SS@underline}{##2}}}%
1396 %
1397 % \def\SS@makeulinepart{%
1398 % \def\underline##1\par{\SS@underline{##1}\par}
1399 % \def\ulemheading##1##2\par{\SS@underline{##2}\par}}%
1400 }% endif ulem has not been loaded
1401 %
1402 {% If ulem has been loaded
1403 \SS@oclto{1}{ulem loaded; underlining setup}%
1404 \def\SS@makeulinesect{%
1405 \def\underbar##1{\SS@origunderline{\sbox\tw@{##1}\dp\tw@\z@\box\tw@}}%
1406 \def\underline{\SS@ulemsectuline{\uline}}%
1407 \def\ulemheading##1##2{\SS@ulemsectuline{##1}{##2}}}%
1408 %
1409 \def\SS@makeulinepartchap{%
1410 % \let\underline\SS@chapuline
1411 % \def\ulemheading##1##2\par{##1{##2}\par}}%
1412 % \let\underline\uline% pre KOMA-script
1413 % \def\ulemheading##1##2{##1{##2}}}% pre KOMA-script
1414 \def\underbar##1{\SS@origunderline{\sbox\tw@{##1}\dp\tw@\z@\box\tw@}}%
1415 % \let\underline\SS@ulemunderlinechapfudge% 7/2/99
1416 \def\underline##1{\SS@ulemheadingchapfudge{\uline}{##1}}%
1417 \let\ulemheading\SS@ulemheadingchapfudge}
1418 }% endif ulem has been loaded
1419 }% end \AtBeginDocument
1420 % \end{macrocode}
1421 %\end{macro}
1422 %\end{macro}
1423 %
1424 %\begin{macro}{\SS@rr}
1425 % Stolen from \filename{latex.ltx}; this command is used to remove the
1426 % \comname{leftskip} and \comname{parindent} changes from the definition
1427 % of \comname{raggedright} in \comname{@start\-section} headings so run-in
1428 % headings can be indented as specified when you say
1429 % \comname{raggedright}.
1430 % \begin{macrocode}
1431 \def\SS@rr{\def\raggedright{%
1432 \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip}}
1433 % \leftskip\z@skip% part of the original def
1434 % \parindent\z@}% part of the original def
1435 % \end{macrocode}
1436 %\end{macro}
1437 %
1438 % \subsection{Stuff for putting rules around headings}
1439 %
1440 % Start out with some supporting commands\ldots
1441 %
1442 %\begin{macro}{\ifSS@komascript}
1443 %
1444 % I can think of several reasons to know if one of the KOMA-Script
1445 % classes has been loaded, so let's have a new if for the job. This was
1446 % written for the \comname{sectionrule} command, which needs to know one
1447 % way or another, and since \comname{@ifclassloaded} can't be used
1448 % outside the preamble, this seemed like a sensible solution. The
1449 % alternative involved hideous contortions or horrible inefficiency as
1450 % far as I could tell.
1451 %
1452 % \begin{macrocode}
1453 \newif\ifSS@komascript
1454 \SS@komascriptfalse
1455 \@ifclassloaded{scrartcl}{\SS@komascripttrue}{}
1456 \@ifclassloaded{scrreprt}{\SS@komascripttrue}{}
1457 \@ifclassloaded{scrbook} {\SS@komascripttrue}{}
1458 % \end{macrocode}
1459 %\end{macro}
1460
1461 %\begin{macro}{\SS@sectid}
1462 % A command to allow detection of the current section level. 0=part,
1463 % 1=chapter, 2=section, and so on.
1464 % \begin{macrocode}
1465 \newcommand{\SS@sectid}[1]{\gdef\SSsectlevel{#1}}
1466 % \end{macrocode}
1467 %\end{macro}
1468 %
1469 %\begin{macro}{\SS@nopart}
1470 %\begin{macro}{\SS@titlepart}
1471 %\begin{macro}{\SSnopartid}
1472 %\begin{macro}{\SStitlepartid}
1473 %\begin{macro}{\SSifnumberpart}
1474 %\begin{macro}{\SSiftitlepart}
1475 % A set of commands to allow detection of what part of a chapter or
1476 % part heading is being typeset (the number part or the title part).
1477 % This is quite important for bunging rules around the Koma-script
1478 % chapter headings, if nothing else.
1479 %
1480 % \begin{macrocode}
1481 \newcommand{\SS@nopart}{\global\let\SS@headingpart\SS@nopartid}
1482 \newcommand{\SS@titlepart}{\global\let\SS@headingpart\SS@titlepartid}
1483 %
1484 \newcommand{\SS@nopartid}{number part}
1485 \newcommand{\SS@titlepartid}{title part}
1486 %
1487 \newcommand{\SSifnumberpart}{%
1488 \ifx\SS@headingpart\SS@nopartid
1489 \expandafter\@firstoftwo
1490 \else
1491 \expandafter\@secondoftwo
1492 \fi}
1493 %
1494 \newcommand{\SSiftitlepart}{%
1495 \ifx\SS@headingpart\SS@titlepartid
1496 \expandafter\@firstoftwo
1497 \else
1498 \expandafter\@secondoftwo
1499 \fi}
1500 % \end{macrocode}
1501 %\end{macro}
1502 %\end{macro}
1503 %\end{macro}
1504 %\end{macro}
1505 %\end{macro}
1506 %\end{macro}
1507 %
1508 %\begin{macro}{\ifraggedleft}
1509 % With a bit of luck, the following command detects if \LaTeX\ is
1510 % currently doing raggedleft typesetting -- this test is used by the
1511 % rule commands below. The tests are based on this stuff from
1512 % |latex.ltx|:
1513 %\begin{verbatim}
1514 % \def\centering{%
1515 % \let\\\@centercr
1516 % \rightskip\@flushglue\leftskip\@flushglue
1517 % \parindent\z@\parfillskip\z@skip}
1518 % \def\raggedright{%
1519 % \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip
1520 % \leftskip\z@skip
1521 % \parindent\z@}
1522 % \def\raggedleft{%
1523 % \let\\\@centercr
1524 % \rightskip\z@skip\leftskip\@flushglue
1525 % \parindent\z@\parfillskip\z@skip}
1526 %\end{verbatim}
1527 %
1528 % If raggedleft is `on', the first argument is executed. If it's
1529 % off, the second argument is executed. This isn't the most elegant
1530 % code possible, but it does have the virtue that I understand it.
1531 % \begin{macrocode}
1532 \def\ifraggedleft#1#2{%
1533 \edef\@tempcmda{\the\rightskip}%
1534 \edef\@tempcmdb{\the\z@skip}%
1535 \ifx\@tempcmda\@tempcmdb\@tempswatrue\else\@tempswafalse\fi
1536 \edef\@tempcmda{\the\leftskip}%
1537 \edef\@tempcmdb{\the\@flushglue}%
1538 \if@tempswa
1539 \ifx\@tempcmda\@tempcmdb\@tempswatrue\else\@tempswafalse\fi
1540 \fi
1541 \if@tempswa#1\else#2\fi}
1542 % \end{macrocode}
1543 %\end{macro}
1544 % \begin{macro}{\ifcentering}
1545 %
1546 % A similar command to detect if centering is `on'; again, first
1547 % argument is executed if centering is on, second argument is executed
1548 % if it's not. This isn't the most elegant code possible, but it does
1549 % have the virtue that I understand it.
1550 %
1551 % \begin{macrocode}
1552 % \def\ifcentering#1#2{%
1553 % \edef\@tempcmda{\the\rightskip}%
1554 % \edef\@tempcmdb{\the\@flushglue}%
1555 % \ifx\@tempcmda\@tempcmdb\@tempswatrue\else\@tempswafalse\fi
1556 % \edef\@tempcmda{\the\leftskip}%
1557 % \edef\@tempcmdb{\the\@flushglue}%
1558 % \if@tempswa
1559 % \ifx\@tempcmda\@tempcmdb\@tempswatrue\else\@tempswafalse\fi
1560 % \fi
1561 % \if@tempswa#1\else#2\fi}
1562 \def\ifcentering{%
1563 \edef\@tempcmda{\the\rightskip}%
1564 \edef\@tempcmdb{\the\@flushglue}%
1565 \ifx\@tempcmda\@tempcmdb\@tempswatrue\else\@tempswafalse\fi
1566 \edef\@tempcmda{\the\leftskip}%
1567 \edef\@tempcmdb{\the\@flushglue}%
1568 \if@tempswa
1569 \ifx\@tempcmda\@tempcmdb\@tempswatrue\else\@tempswafalse\fi
1570 \fi
1571 \if@tempswa\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
1572 % \end{macrocode}
1573 %\end{macro}
1574 %
1575 % \subsubsection{The main heading rule code}
1576 %
1577 %\begin{macro}{\sectionrule}
1578 % A rather dodgy command that will stick a rule across the full width of
1579 % the text, around a sectional heading, unless it's a run-in heading or
1580 % centred. Must be used as the last command in a |\...font| command;
1581 %\begin{verbatim}
1582 % \sectionrule{<top rule raise height>} {<top rule height>}
1583 % {<bottom rule raise height>}{<bottom rule height>}.
1584 %\end{verbatim}
1585 %
1586 % \begin{macrocode}
1587 \newcommand{\sectionrule}[5]{%
1588 \ifcentering{%
1589 \PackageError{sectsty}%
1590 {Can't use \protect\sectionrule\space with \protect\centering}%
1591 {The \protect\sectionrule\space command doesn't work properly
1592 with sectional headings that\MessageBreak are centred, so I'll
1593 carry on as if you'd not used the \protect\sectionrule\space
1594 command.}#5}%
1595 {\ifSS@komascript
1596 \ifnum\SSsectlevel>1
1597 % use normal sectionrule if Koma-script and not part/chapter
1598 \SS@oclto{1}{KOMA-script; normal section rule}%
1599 \SS@sectionrule{#1}{#2}{#3}{#4}{#5}%
1600 \else
1601 % use strange sectionrule if Koma-script and part/chapter
1602 \SS@oclto{1}{KOMA-script; part/chap section rule}%
1603 \SS@komapartchaprule{#1}{#2}{#3}{#4}{#5}%
1604 \fi
1605 \else
1606 % use normal sectionrule if not Koma-script
1607 \SS@oclto{1}{No KOMA-script; normal section rule}%
1608 \SS@sectionrule{#1}{#2}{#3}{#4}{#5}%
1609 \fi}}
1610 % \end{macrocode}
1611 %\end{macro}
1612 %\begin{macro}{\SS@sectionrule}
1613 %
1614 % This gets called by |\sectionrule| unless in a part or chapter
1615 % heading, and picks one of two commands to place the rules depending on
1616 % whether the heading's raggedleft or not.
1617 %
1618 % \begin{macrocode}
1619 \def\SS@sectionrule#1#2#3#4#5{%
1620 \ifraggedleft
1621 {\SS@rlsectionrule{#1}{#2}{#3}{#4}{#5}}%
1622 {\SS@normsectionrule{#1}{#2}{#3}{#4}{#5}}}
1623 % \end{macrocode}
1624 %\end{macro}
1625 %\begin{macro}{\SS@normsectionrule}
1626 %\begin{macro}{\SS@rlsectionrule}
1627 % These are the commands that do the dirty work for
1628 % \comname{SS@sectionrule} and actually place the rules around the
1629 % headings. \comname{SS@normsectionrule} does for raggedright and fully
1630 % justified headings; \comname{SS@rlsectionrule} does for raggedleft
1631 % headings.
1632 % \begin{macrocode}
1633 \def\SS@normsectionrule#1#2#3#4#5{%
1634 \let\SS@@par\@@par\let\@@par\relax% very dodgy
1635 \noindent\makebox[0pt][l]{\rule[#1]{\hsize}{#2}}%
1636 #5\hfill\makebox[0pt][r]{\rule[#3]{\hsize}{#4}}%
1637 \let\@@par\SS@@par\@@par}
1638 %
1639 \def\SS@rlsectionrule#1#2#3#4#5{%
1640 \let\SS@@par\@@par\let\@@par\relax% very dodgy
1641 \noindent\makebox[0pt][l]{\rule[#1]{\hsize}{#2}}\hfill%
1642 #5\makebox[0pt][r]{\rule[#3]{\hsize}{#4}}%
1643 \let\@@par\SS@@par\@@par}
1644 % \end{macrocode}
1645 %\end{macro}
1646 %\end{macro}
1647 %
1648 %\begin{macro}{\ifSS@starform}
1649 %\begin{macro}{\secdef}
1650 %
1651 % Some code to help the rule drawing commands find out if the star form
1652 % of a chapter or part heading is being typeset. This information is
1653 % needed to get rules around chapters right in scrreprt and scrartcl.
1654 %
1655 % \begin{macrocode}
1656 \newif\ifSS@starform
1657 %
1658 \def\secdef#1#2{\@ifstar{\SS@starformtrue#2}{\SS@starformfalse\@dblarg{#1}}}
1659 % \end{macrocode}
1660 %\end{macro}
1661 %\end{macro}
1662 %
1663 %\begin{macro}{\SS@komapartchaprule}
1664 %
1665 % Some more commands for shoving rules around headings. They work just
1666 % like \comname{SS@sectionrule} and friends, but for part and chapter
1667 % headings
1668 %
1669 % \begin{macrocode}
1670 % \def\SS@partchaprule#1#2#3#4#5{%
1671 % \ifraggedleft{\SS@rlpartchaprule{#1}{#2}{#3}{#4}{#5}}%
1672 % {\SS@normpartchaprule{#1}{#2}{#3}{#4}{#5}}}
1673 \def\SS@komapartchaprule#1#2#3#4#5{%
1674 \ifraggedleft
1675 {\SS@rlkomapartchaprule{#1}{#2}{#3}{#4}{#5}}%
1676 {\SS@normkomapartchaprule{#1}{#2}{#3}{#4}{#5}}%
1677 }
1678 % \end{macrocode}
1679 %\end{macro}
1680 %
1681 %\begin{macro}{\SS@normkomapartchaprule}
1682 %\begin{macro}{\SS@komapartchaprule}
1683 %
1684 % Called by \comname{SS@komapartchaprule}: these are the commands that
1685 % do the dirty work of placing the rules around the headings.
1686 % \comname{SS@normkomapartchaprule} does for raggedright and fully
1687 % justified headings; \comname{SS@rlkomapartchaprule} does for
1688 % raggedleft headings.
1689 %
1690 % \begin{macrocode}
1691 % \def\SS@normpartchaprule#1#2#3#4#5\par{%
1692 % \noindent\makebox[0pt][l]{\rule[#1]{\hsize}{#2}}%
1693 % #5%
1694 % \hfill\makebox[0pt][r]{\rule[#3]{\hsize}{#4}}%
1695 % \par}
1696 \def\SS@normkomapartchaprule#1#2#3#4#5{%
1697 \SS@oclto{1}{SS@normkomapartchaprule}%
1698 \ifSS@starform
1699 \SS@normsectionrule{#1}{#2}{#3}{#4}{#5}%
1700 \else
1701 \SSifnumberpart
1702 {\noindent\makebox[0pt][l]{\rule[#1]{\hsize}{#2}}#5}%
1703 {#5\hfill\makebox[0pt][r]{\rule[#3]{\hsize}{#4}}}%
1704 \fi
1705 }
1706 % \end{macrocode}
1707 %
1708 % \begin{macrocode}
1709 % \def\SS@rlpartchaprule#1#2#3#4#5\par{%
1710 % \noindent\makebox[0pt][l]{\rule[#1]{\hsize}{#2}}\hfill%
1711 % #5%
1712 % \makebox[0pt][r]{\rule[#3]{\hsize}{#4}}%
1713 % \par}
1714 \def\SS@rlkomapartchaprule#1#2#3#4#5{%
1715 \SS@oclto{1}{SS@rlkomapartchaprule}%
1716 \ifSS@starform
1717 \SS@rlsectionrule{#1}{#2}{#3}{#4}{#5}%
1718 \else
1719 \SSifnumberpart
1720 {\noindent\makebox[0pt][l]{\rule[#1]{\hsize}{#2}}\hfill#5}%
1721 {#5\makebox[0pt][r]{\rule[#3]{\hsize}{#4}}}%
1722 \fi
1723 }
1724 % \end{macrocode}
1725 %\end{macro}
1726 %\end{macro}
1727 %
1728 % \subsection{The new author commands}
1729 %
1730 % The extra commands are below. Note that the |\SSsectlevel| is
1731 % defined to be 0 in part headings, 1 in chapter headings, 2 in section
1732 % headings, and so on. You might find this useful if you want to play
1733 % interesting games. \comname{minisec} is a KOMA-script sectioning
1734 % command which is one level lower than \comname{subparagraph}.
1735 %
1736 % \begin{macrocode}
1737 \newcommand*{\partfont} [1]
1738 {\gdef\SS@partnumberfont{\SS@sectid{0}\SS@nopart\SS@makeulinepartchap#1}
1739 \gdef\SS@parttitlefont{\SS@sectid{0}\SS@titlepart\SS@makeulinepartchap#1}}
1740 \newcommand*{\partnumberfont} [1]
1741 {\gdef\SS@partnumberfont{\SS@sectid{0}\SS@nopart\SS@makeulinepartchap#1}}
1742 \newcommand*{\parttitlefont} [1]
1743 {\gdef\SS@parttitlefont{\SS@sectid{0}\SS@titlepart\SS@makeulinepartchap#1}}
1744 \newcommand*{\chapterfont} [1]
1745 {\gdef\SS@chapnumfont{\SS@sectid{1}\SS@nopart\SS@makeulinepartchap#1}
1746 \gdef\SS@chaptitlefont{\SS@sectid{1}\SS@titlepart\SS@makeulinepartchap#1}}
1747 \newcommand*{\chapternumberfont} [1]
1748 {\gdef\SS@chapnumfont{\SS@sectid{1}\SS@nopart\SS@makeulinepartchap#1}}
1749 \newcommand*{\chaptertitlefont} [1]
1750 {\gdef\SS@chaptitlefont{\SS@sectid{1}\SS@titlepart\SS@makeulinepartchap#1}}
1751 \newcommand*{\sectionfont} [1]
1752 {\gdef\SS@sectfont{\SS@sectid{2}\SS@rr\SS@makeulinesect#1}}
1753 \newcommand*{\subsectionfont} [1]
1754 {\gdef\SS@subsectfont{\SS@sectid{3}\SS@rr\SS@makeulinesect#1}}
1755 \newcommand*{\subsubsectionfont} [1]
1756 {\gdef\SS@subsubsectfont{\SS@sectid{4}\SS@rr\SS@makeulinesect#1}}
1757 \newcommand*{\paragraphfont} [1]
1758 {\gdef\SS@parafont{\SS@sectid{5}\SS@rr\SS@makeulinesect#1}}
1759 \newcommand*{\subparagraphfont} [1]
1760 {\gdef\SS@subparafont{\SS@sectid{6}\SS@rr\SS@makeulinesect#1}}
1761 \newcommand*{\minisecfont} [1]
1762 {\gdef\SS@minisecfont{\SS@sectid{7}\SS@rr\SS@makeulinepartchap#1}}
1763 %
1764 \newcommand*{\allsectionsfont} [1] {\partfont{#1}
1765 \chapterfont{#1}
1766 \sectionfont{#1}
1767 \subsectionfont{#1}
1768 \subsubsectionfont{#1}
1769 \paragraphfont{#1}
1770 \subparagraphfont{#1}
1771 \minisecfont{#1}}
1772 %
1773 \allsectionsfont{\relax}
1774 % \end{macrocode}
1775 %
1776 % \subsection{The re-defined sectioning commands}
1777 %
1778 % For obscure reasons, this is where I test to see if
1779 % \packname{sectsty} is being used with a class it'll work with. This
1780 % test isn't infallible, but it does let you know if \packname{sectsty}
1781 % will do nothing at all.
1782 %
1783 % \begin{macrocode}
1784 \@tempswafalse
1785 %
1786 \@ifclassloaded{article} {\@tempswatrue\SS@oclto{1}{article detected}} {}
1787 \@ifclassloaded{report} {\@tempswatrue\SS@oclto{1}{report detected}} {}
1788 \@ifclassloaded{book} {\@tempswatrue\SS@oclto{1}{book detected}} {}
1789 \@ifclassloaded{letter} {} {}
1790 \@ifclassloaded{slides} {} {}
1791 %
1792 \@ifclassloaded{scrartcl}{\@tempswatrue\SS@oclto{1}{scrartcl detected}} {}
1793 \@ifclassloaded{scrreprt}{\@tempswatrue\SS@oclto{1}{scrreprt detected}} {}
1794 \@ifclassloaded{scrbook} {\@tempswatrue\SS@oclto{1}{scrbook detected}} {}
1795 % \@ifclassloaded{handout} {} {}
1796
1797 \if@tempswa\else
1798 \PackageError{sectsty}%
1799 {The sectsty package doesn't work with\MessageBreak
1800 this document class}%
1801 {The sectsty package only works with the following classes:
1802 \MessageBreak
1803 the standard LaTeX document classes\MessageBreak
1804 article, report, and book; and\MessageBreak
1805 the KOMA-Script classes\MessageBreak
1806 scrartcl, scrbook, and scrreprt.}
1807 \fi
1808 % \end{macrocode}
1809 %
1810 % \subsubsection{Section code for article, book, and report classes}
1811 %
1812 % \begin{macrocode}
1813 \@tempswafalse
1814 %
1815 \@ifclassloaded{article} {\@tempswatrue\SS@oclto{1}{article detected}} {}
1816 \@ifclassloaded{report} {\@tempswatrue\SS@oclto{1}{report detected}} {}
1817 \@ifclassloaded{book} {\@tempswatrue\SS@oclto{1}{book detected}} {}
1818 \@ifclassloaded{letter} {} {}
1819 \@ifclassloaded{slides} {} {}
1820 %
1821 \@ifclassloaded{scrartcl}{} {}
1822 \@ifclassloaded{scrreprt}{} {}
1823 \@ifclassloaded{scrbook} {} {}
1824 % \@ifclassloaded{handout} {} {}
1825 % \end{macrocode}
1826 %
1827 % Code from |article.cls| and |report.cls| June 1996; same as book code.
1828 % Execute this only if the book, report, or article classes have been
1829 % loaded.
1830 % \begin{macrocode}
1831 \if@tempswa
1832 \SS@oclto{1}{section->subparagraph modifications for article, report,
1833 and book classes}%
1834 \renewcommand\section{\@startsection {section}{1}{\z@}%
1835 {-3.5ex \@plus -1ex \@minus -.2ex}%
1836 {2.3ex \@plus.2ex}%
1837 % {\normalfont\Large\bfseries}}
1838 {\normalfont\Large\bfseries\SS@sectfont}}
1839 \renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
1840 {-3.25ex\@plus -1ex \@minus -.2ex}%
1841 {1.5ex \@plus .2ex}%
1842 % {\normalfont\large\bfseries}}
1843 {\normalfont\large\bfseries\SS@subsectfont}}
1844 \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
1845 {-3.25ex\@plus -1ex \@minus -.2ex}%
1846 {1.5ex \@plus .2ex}%
1847 % {\normalfont\normalsize\bfseries}}
1848 {\normalfont\normalsize\bfseries\SS@subsubsectfont}}
1849 \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
1850 {3.25ex \@plus1ex \@minus.2ex}%
1851 {-1em}%
1852 % {\normalfont\normalsize\bfseries}}
1853 {\normalfont\normalsize\bfseries\SS@parafont}}
1854 \renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
1855 {3.25ex \@plus1ex \@minus .2ex}%
1856 {-1em}%
1857 % {\normalfont\normalsize\bfseries}}
1858 {\normalfont\normalsize\bfseries\SS@subparafont}}
1859 \fi
1860 % \end{macrocode}
1861 %
1862 % End re-defining section|->|subparagraph commands for article,
1863 % report, and book classes
1864 %
1865 % \subsubsection{Section code for scrartcl, scrbook, and scrreprt classes}
1866 %
1867 % \begin{macrocode}
1868 \@tempswafalse
1869 %
1870 \@ifclassloaded{article} {} {}
1871 \@ifclassloaded{report} {} {}
1872 \@ifclassloaded{book} {} {}
1873 \@ifclassloaded{letter} {} {}
1874 \@ifclassloaded{slides} {} {}
1875 %
1876 \@ifclassloaded{scrartcl}{\@tempswatrue\SS@oclto{1}{scrartcl detected}} {}
1877 \@ifclassloaded{scrreprt}{\@tempswatrue\SS@oclto{1}{scrreprt detected}} {}
1878 \@ifclassloaded{scrbook} {\@tempswatrue\SS@oclto{1}{scrbook detected}} {}
1879 % \@ifclassloaded{handout} {} {}
1880 % \end{macrocode}
1881 %
1882 % Code from |scrclass.dtx| 1998/07/17 v2.5e. Execute this only if the
1883 % scrartcl, scrreprt, or scrbook classes have been loaded.
1884 %
1885 % \begin{macrocode}
1886 \if@tempswa
1887 \SS@oclto{1}{section->minisec modifications for scrartcl, scrreprt,
1888 and scrbook classes}%
1889 \renewcommand\section{\@startsection{section}{1}{\z@}%
1890 {-3.5ex \@plus -1ex \@minus -.2ex}%
1891 {2.3ex \@plus.2ex}%
1892 {\raggedsection\normalfont\size@section\sectfont\SS@sectfont}}
1893 \renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
1894 {-3.25ex\@plus -1ex \@minus -.2ex}%
1895 {1.5ex \@plus .2ex}%
1896 {\raggedsection\normalfont\size@subsection\sectfont\SS@subsectfont}}
1897 \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
1898 {-3.25ex\@plus -1ex \@minus -.2ex}%
1899 {1.5ex \@plus .2ex}%
1900 {\raggedsection\normalfont\size@subsubsection\sectfont\SS@subsubsectfont}}
1901 \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
1902 {3.25ex \@plus1ex \@minus.2ex}%
1903 {-1em}%
1904 {\raggedsection\normalfont\size@paragraph\sectfont\SS@parafont}}
1905 \renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
1906 {3.25ex \@plus1ex \@minus .2ex}%
1907 {-1em}%
1908 {\raggedsection\normalfont\size@subparagraph\sectfont\SS@subparafont}}
1909 \renewcommand\minisec[1]{\@afterindentfalse \vskip 1.5ex
1910 {\parindent \z@ \raggedsection\sectfont\SS@minisecfont {#1}\par\nobreak}%
1911 \@afterheading}%
1912 \fi
1913 % \end{macrocode}
1914 %
1915 % \subsection{Re-defined chapter code}
1916 %
1917 % \subsubsection{Chapter command for report class}
1918 %
1919 %% Code from |report.cls| June 1996
1920 % \begin{macrocode}
1921 \@ifclassloaded{report}{%
1922 \SS@oclto{1}{chapter modifications for report class}%
1923 \def\@makechapterhead#1{%
1924 \vspace*{50\p@}%
1925 {\parindent \z@ \raggedright \normalfont
1926 \ifnum \c@secnumdepth >\m@ne
1927 \huge\bfseries\SS@chapnumfont{\@chapapp\space \thechapter}%
1928 \par\nobreak
1929 \vskip 20\p@
1930 \fi
1931 \interlinepenalty\@M
1932 \raggedright \normalfont
1933 \Huge \bfseries \SS@chaptitlefont {#1}\par\nobreak
1934 \vskip 40\p@
1935 }}
1936 \def\@makeschapterhead#1{%
1937 \vspace*{50\p@}%
1938 {\parindent \z@ \raggedright
1939 \normalfont
1940 \interlinepenalty\@M
1941 \Huge \bfseries \SS@chaptitlefont {#1}\par\nobreak
1942 \vskip 40\p@
1943 }}%
1944 }{}
1945 % \end{macrocode}
1946 %
1947 %% End code re-defining chapter stuff for report class
1948 %
1949 % \subsubsection{Chapter command for book class}
1950 %
1951 %% Chapter code from |book.cls| 1997/10/10 v1.3x
1952 %
1953 % \begin{macrocode}
1954 \@ifclassloaded{book}{%
1955 \SS@oclto{1}{chapter modifications for book class}%
1956 \def\@makechapterhead#1{%
1957 \vspace*{50\p@}%
1958 {\parindent \z@ \raggedright \normalfont
1959 \ifnum \c@secnumdepth >\m@ne
1960 \if@mainmatter
1961 \huge\bfseries\SS@chapnumfont {\@chapapp\space \thechapter}%
1962 \par\nobreak
1963 \vskip 20\p@
1964 \fi
1965 \fi
1966 \interlinepenalty\@M
1967 \raggedright \normalfont
1968 \Huge \bfseries \SS@chaptitlefont {#1}\par\nobreak
1969 \vskip 40\p@
1970 }}
1971 \def\@makeschapterhead#1{%
1972 \vspace*{50\p@}%
1973 {\parindent \z@ \raggedright
1974 \normalfont
1975 \interlinepenalty\@M
1976 \Huge \bfseries \SS@chaptitlefont {#1}\par\nobreak
1977 \vskip 40\p@
1978 }}%
1979 }{}
1980 % \end{macrocode}
1981 %
1982 %% End code redefining chapter stuff from book.cls
1983 %
1984 % \subsubsection{Chapter command for scrreprt class}
1985 %
1986 % Code from \filename{scrreprt.cls} 1998/07/17 v2.5e.
1987 %
1988 %% Begin code redefining chapter stuff from scrreprt.cls
1989 %
1990 % \begin{macrocode}
1991 \@ifclassloaded{scrreprt}{%
1992 \SS@oclto{1}{chapter modifications for scrreprt class}%
1993 \def\@makechapterhead#1{\chapterheadstartvskip%
1994 {\size@chapter{\sectfont\SS@chapnumfont
1995 \@hangfrom{\ifnum \c@secnumdepth >\m@ne%
1996 \chapterformat\fi}%
1997 {\raggedsection \interlinepenalty \@M \SS@chaptitlefont {#1}\par}}%
1998 \nobreak\chapterheadendvskip
1999 }}
2000 \def\@makeschapterhead#1{\chapterheadstartvskip%
2001 {\parindent \z@ \raggedsection
2002 \normalfont
2003 \size@chapter\sectfont\SS@chaptitlefont {#1}\par
2004 \nobreak\chapterheadendvskip
2005 }}
2006 }{}
2007 % \end{macrocode}
2008 %
2009 %% End code redefining chapter stuff from scrreprt.cls
2010 %
2011 % \subsubsection{Chapter command for scrbook class}
2012 %
2013 % Code from \filename{scrbook.cls} 1998/07/17 v2.5e.
2014 %
2015 %% Begin code redefining chapter stuff from scrbook.cls
2016 %
2017 % \begin{macrocode}
2018 \@ifclassloaded{scrbook}{%
2019 \SS@oclto{1}{chapter modifications for scrbook class}%
2020 \def\@makechapterhead#1{\chapterheadstartvskip%
2021 {\size@chapter{\sectfont\SS@chapnumfont
2022 \@hangfrom{\ifnum \c@secnumdepth >\m@ne%
2023 \if@mainmatter \chapterformat\fi\fi}%
2024 {\raggedsection \interlinepenalty \@M \SS@chaptitlefont {#1}\par}}%
2025 \nobreak\chapterheadendvskip
2026 }}
2027 \def\@makeschapterhead#1{\chapterheadstartvskip%
2028 {\parindent \z@ \raggedsection
2029 \normalfont
2030 \size@chapter\sectfont\SS@chaptitlefont {#1}\par
2031 \nobreak\chapterheadendvskip
2032 }}%
2033 }{}
2034 % \end{macrocode}
2035 %
2036 %% End code redefining chapter stuff from scrbook.cls
2037 %
2038 % \subsection{Re-defined part code}
2039 %
2040 % \subsubsection{Part command for book class}
2041 %
2042 %% Part code from book.cls 1997/10/10 v1.3x
2043 %\begin{macro}{\part}
2044 %
2045 % This code adds the |\[email protected]| hooks; there used to be some other
2046 % additions but there aren't any more because they were silly.
2047 %
2048 % \begin{macrocode}
2049 \@ifclassloaded{book}{%
2050 \SS@oclto{1}{part modifications for book class}%
2051 \def\@part[#1]#2{%
2052 \ifnum \c@secnumdepth >-2\relax
2053 \refstepcounter{part}%
2054 \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
2055 \else
2056 \addcontentsline{toc}{part}{#1}%
2057 \fi
2058 \markboth{}{}%
2059 {\centering
2060 \interlinepenalty \@M
2061 \normalfont
2062 \ifnum \c@secnumdepth >-2\relax
2063 \huge\bfseries\SS@partnumberfont {\partname~\thepart}%
2064 \par
2065 \vskip 20\p@
2066 \fi
2067 \centering \normalfont
2068 \Huge \bfseries \SS@parttitlefont {#2}\par}%
2069 \@endpart}
2070 \def\@spart#1{%
2071 {\centering
2072 \interlinepenalty \@M
2073 \normalfont \Huge \bfseries \SS@parttitlefont {#1}\par}%
2074 \@endpart}
2075 }{}
2076 % \end{macrocode}
2077 %
2078 %% End code redefining part stuff from |book.cls|
2079 %
2080 % \subsubsection{Part command for article class}
2081 %
2082 %% Part code from |article.cls| 1997/10/10 v1.3x
2083 %
2084 % \begin{macrocode}
2085 \@ifclassloaded{article}{%
2086 \SS@oclto{1}{part modifications for article class}%
2087 \def\@part[#1]#2{%
2088 \ifnum \c@secnumdepth >\m@ne
2089 \refstepcounter{part}%
2090 \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
2091 \else
2092 \addcontentsline{toc}{part}{#1}%
2093 \fi
2094 {\parindent \z@ \raggedright
2095 \interlinepenalty \@M
2096 \normalfont
2097 \ifnum \c@secnumdepth >\m@ne
2098 \Large\bfseries\SS@partnumberfont {\partname~\thepart}%
2099 \par\nobreak
2100 \fi
2101 \raggedright \normalfont
2102 \huge \bfseries \SS@parttitlefont {#2}%
2103 \markboth{}{}\par}%
2104 \nobreak
2105 \vskip 3ex
2106 \@afterheading}
2107 \def\@spart#1{%
2108 {\parindent \z@ \raggedright
2109 \interlinepenalty \@M
2110 \normalfont
2111 \huge \bfseries \SS@parttitlefont {#1}\par}%
2112 \nobreak
2113 \vskip 3ex
2114 \@afterheading}
2115 }{}
2116 % \end{macrocode}
2117 %
2118 %% End code redefining part stuff from |article.cls|
2119 %
2120 % \subsubsection{Part command for report class}
2121 %
2122 %% Part code from |report.cls| 1997/10/10 v1.3x
2123 %
2124 % \begin{macrocode}
2125 \@ifclassloaded{report}{%
2126 \SS@oclto{1}{part modifications for report class}%
2127 \def\@part[#1]#2{%
2128 \ifnum \c@secnumdepth >-2\relax
2129 \refstepcounter{part}%
2130 \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
2131 \else
2132 \addcontentsline{toc}{part}{#1}%
2133 \fi
2134 \markboth{}{}%
2135 {\centering
2136 \interlinepenalty \@M
2137 \normalfont
2138 \ifnum \c@secnumdepth >-2\relax
2139 \huge\bfseries\SS@partnumberfont {\partname~\thepart}%
2140 \par
2141 \vskip 20\p@
2142 \fi
2143 \centering \normalfont
2144 \Huge \bfseries \SS@parttitlefont {#2}\par}%
2145 \@endpart}
2146 \def\@spart#1{%
2147 {\centering
2148 \interlinepenalty \@M
2149 \normalfont
2150 \Huge \bfseries \SS@parttitlefont {#1}\par}%
2151 \@endpart}
2152 }{}
2153 % \end{macrocode}
2154 %
2155 %% End code redefining part stuff from report.cls
2156 %
2157 % \subsubsection{Part command for scrbook and scrreprt classes}
2158 % \begin{macrocode}
2159 \@tempswafalse
2160 %
2161 \@ifclassloaded{scrreprt}{\@tempswatrue}{}
2162 \@ifclassloaded{scrbook} {\@tempswatrue}{}
2163 %
2164 %% Part code from |scrbook.cls| 1998/07/17 v2.5e
2165 \if@tempswa%
2166 \SS@oclto{1}{part modifications for scrreprt and scrbook classes}%
2167 \def\@part[#1]#2{%
2168 \ifnum \c@secnumdepth >-2\relax
2169 \refstepcounter{part}\@maybeasf%
2170 \addcontentsline{toc}{part}{\protect\numberline{\thepart}#1}%
2171 \else
2172 \addcontentsline{toc}{part}{#1}%
2173 \fi
2174 \chaptermark{}
2175 {\centering
2176 \interlinepenalty \@M
2177 \normalfont
2178 \ifnum \c@secnumdepth >-2\relax
2179 \size@partnumber\sectfont\SS@partnumberfont\partformat
2180 \par
2181 \vskip 20\p@
2182 \fi
2183 \size@part\sectfont\SS@parttitlefont {#2}\par}%
2184 \@endpart}
2185 \def\@spart#1{%
2186 {\centering
2187 \interlinepenalty \@M
2188 \normalfont
2189 \size@part\sectfont\SS@parttitlefont {#1}\chaptermark{}\par}%
2190 \@endpart}%
2191 \fi
2192 % \end{macrocode}
2193 %% End part code from |scrbook.cls| 1998/07/17 v2.5e
2194 %
2195 % \subsubsection{Part command for the scrartcl classes}
2196 %
2197 %% Part code from |scrartcl.cls| 1998/07/17 v2.5e
2198 % \begin{macrocode}
2199 \@ifclassloaded{scrartcl}{%
2200 \SS@oclto{1}{part modifications for scrartcl classes}%
2201 \def\@part[#1]#2{%
2202 \ifnum \c@secnumdepth >\m@ne
2203 \refstepcounter{part}\@maybeasf%
2204 \addcontentsline{toc}{part}{\protect\numberline{\thepart}#1}%
2205 \else
2206 \addcontentsline{toc}{part}{#1}%
2207 \fi
2208 {\parindent \z@ \raggedright
2209 \interlinepenalty \@M
2210 \normalfont
2211 \ifnum \c@secnumdepth >\m@ne
2212 \size@partnumber\sectfont\SS@partnumberfont\partformat
2213 \par\nobreak
2214 \fi
2215 \size@part\sectfont\SS@parttitlefont {#2}%
2216 \sectionmark{}\par}%
2217 \nobreak
2218 \vskip 3ex
2219 \@afterheading}
2220 \def\@spart#1{%
2221 {\parindent \z@ \raggedright
2222 \interlinepenalty \@M
2223 \normalfont
2224 \size@part\sectfont\SS@parttitlefont {#1}\sectionmark{}\par}%
2225 \nobreak
2226 \vskip 3ex
2227 \@afterheading}%
2228 }{}
2229 % \end{macrocode}
2230 %
2231 %\end{macro}
2232 % The end
2233 % \begin{macrocode}
2234 \endinput
2235 % \end{macrocode}
2236 %
2237 % \Finale
2238 %\iffalse
2239 %<*package>
2240 %%
2241 %% End of file `sectsty.dtx'.
2242 %% \fi