part{Appendices}
\addtokomafont{disposition}{\bfseries}
Using the command above you only switch off the font attribute bold for a heading
“Appendices”. A much more comfortable and elegant solution is to change all
\part
headings at once. This is done either by:
\addtokomafont{part}{\normalfont\sffamily}
\addtokomafont{partnumber}{\normalfont\sffamily}
or simply using:
\addtokomafont{part}{\mdseries}
\addtokomafont{partnumber}{\mdseries}
The last version is to be preferred because it gives you the correct result even when
you make changes to the disposition element, for instance:
\setkomafont{disposition}{\normalcolor\bfseries}
With this change it is possible to set all section levels at once to no longer use sans
serif fonts.
Please be warned of misusing the possibilities of font switching to mix fonts, font sizes and
font attributes excessively. Picking the most suitable font for a given task is a hard task even
for professionals and has almost nothing to do with the personal tastes of non-experts. Please
refer to the citation at the end of
section 2.8
,
page 48
and to the following explanation.
It is possible to use different font types for different section levels in KOMA-Script. Non-
experts in typography should for very good typographical reasons refrain absolutely from using
these possibilities.
There is a rule in typography which states that one should mix as few fonts as possible. Using
sans serif for headings already seems to be a breach of this rule. However, one should know that
bold, large serif letters are much too heavy for headings. Strictly speaking, one would then have
to at least use a normal instead of a bold or semi-bold font. However, in deeper levels of the
structuring, a normal font may then appear too lightly weighted. On the other hand, sans serif
fonts in headings have a very pleasant appearance and in fact find acceptance almost solely for
headings. That is why sans serif is the carefully chosen default in KOMA-Script.
More variety should, however, be avoided. Font mixing is only for professionals. In case you
want to use other fonts than the standard TEX fonts — regardless of whether these are CM, EC,
or LM fonts — you should consult an expert, or for safety’s sake redefine the font for the element
disposition
as seen in the example above. The author of this documentation considers the com-
monly encountered combinations Times and Helvetica or Palatino with Helvetica as unfavourable.
94
Chapter 3.
\part*{Heading }
\chapter*{Heading }
\section*{Heading }
\subsection*{Heading }
\subsubsection*{Heading }
\paragraph*{Heading }
\subparagraph*{Heading }
All disposition commands have starred versions, which are unnumbered, and produce section
headings which do not show up in the table of contents or in the running heading. The
absence of a running heading often has an unwanted side effect. For example, if a chapter
which is set using \chapter* spans several pages, then the running heading of the previous
chapter suddenly reappears. KOMA-Script offers a solution for this which is described below.
\chapter*
only exists in book and report classes, that is, book, scrbook, report and scrreport,
scrbook
,
scrreprt
but not the article classes article and scrartcl.
Please note that \part and \chapter change the page style for one page. The applied
style is defined in the macros \partpagestyle and \chapterpagestyle in KOMA-Script (see
section 3.12
,
page 75
).
As for the possibilities of font switching
v2.8p
, the same explanations apply as were given above
for the unstarred variants. The structuring elements are named the same since they do not
indicate variants but structuring levels.
In the standard classes there are no further structuring commands. In particular, there are
no commands which can produce unnumbered chapters or sections which show up in the table
of contents and in the running heading.
\addpart[Short version ]{Heading }
\addpart*{Heading }
\addchap[Short version ]{Heading }
\addchap*{Heading }
\addsec[Short version ]{Heading }
\addsec*{Heading }
In addition to the commands of the standard classes, KOMA-Script offers the new commands
\addsec
and \addchap. They are similar to the standard commands \chapter and \section,
except that they are unnumbered. They thus produce both a running heading and an entry
in the table of contents.
The starred variants \addchap* and \addsec* are similar to the standard commands
\chapter*
and \section* except for a tiny but important difference: The running head-
ings are deleted. This eliminates the side effect of obsolete headers mentioned above. Instead,
the running headings on following pages remain empty. \addchap and \addchap* of course
book
,
scrreprt
only exist in book and report classes, namely book, scrbook, report and scrreport, but not in
the article classes article and scrartcl.
Similarly, the command \addpart produces an unnumbered document part with an entry in
the table of contents. Since the running headings are already deleted by \part and \part* the
95
Chapter 3.
problem of obsolete headers does not exist. The starred version \addpart* is thus identical
to \part* and is only defined for consistency reasons.
Please note that \addpart and \addchap and their starred versions change the page style
for one page. The particular page style is defined in the macros \partpagestyle and
\chapterpagestyle
(see
section 3.12
,
page 75
).
As for the possibilities of font switching
v2.8p
, the same explanations apply as given above for
the normal structuring commands. The elements are named the same since they describe not
variants but structuring levels.
\minisec{Heading }
Sometimes a heading is wanted which is highlighted but also closely linked to the following
text. Such a heading should not be separated by a large vertical skip.
The command \minisec is designed for this situation. This heading is not associated with
any structuring level. Such a mini section does not produce an entry in the table of contents
nor does it receive any numbering.
The font type of the structuring command \minisec can be changed using the element
disposition
(see
table 3.2
,
page 54
) and minisec
v2.96a
. Default setting of element minisec is
empty, so the default of the element disposition is active.
Example: You have developed a kit for building a mouse trap and want the documentation
separated into a list of necessary items and an assembly description. You could
write the following:
\minisec{Items needed}
\begin{flushleft}
1 plank ($100\times 50 \times 12$)\\
1 spring-plug of a beer-bottle\\
1 spring of a ball-point pen\\
1 drawing pin\\
2 screws\\
1 hammer\\
1 knife
\ end{flushleft}
\minisec{Assembly}
At first one searches the mouse-hole and puts the drawing pin
directly behind the hole.
Thus the mouse cannot escape during the
following actions.
Then one knocks the spring-plug with the hammer into the mouse-hole.
If the spring-plug’s size is not big enough in order to shut the
mouse-hole entirely, then one can utilize the plank instead and
96
Chapter 3.
fasten it against the front of the mouse-hole utilizing the two
screws and the knife.
Instead of the knife one can use a
screw-driver instead.
Which gives:
Items needed
1 plank (100 × 50 × 12)
1 spring-plug of a beer-bottle
1 spring of a ball-point pen
1 drawing pin
2 screws
1 hammer
1 knife
Assembly
At first one searches the mouse-hole and puts the drawing pin directly be-
hind the hole. Thus the mouse cannot escape during the following actions.
Then one knocks the spring-plug with the hammer into the mouse-hole.
If the spring-plug’s size is not big enough in order to shut the mouse-hole
entirely, then one can utilize the plank instead and fasten it against the
front of the mouse-hole utilizing the two screws and the knife. Instead of
the knife one can use a screw-driver instead.
\raggedsection
\raggedchapter
\raggedpart
In the standard classes, headings are set as justified text. That means that hyphenated words
can occur and headings with more than one line are stretched up to the text border. This is a
rather uncommon approach in typography. KOMA-Script therefore formats the headings left
aligned with hanging indentation using \raggedsection with the definition:
\newcommand*{\raggedsection}{\raggedright}
This command can be redefined with \renewcommand.
Example: You prefer justified headings, so you write in the preamble of your document:
\renewcommand*{\raggedsection}{}
or more compactly:
\let\raggedsection\relax
You will get a formatting of the headings which is very close to that of the standard
classes. It will become even closer when you combine this change with the change
of the element disposition mentioned above.
Because
v3.15
some users want for \chapter another alignment than for all other sections, you
can change only \chapter redefining \raggedchapter. The default of this command is usage
of \raggedsection. So every change of \raggedsection will also change the alignment of
chapter headings.
97
Chapter 3.
Unlike all others, the headings of parts (\part) will be horizontally centered instead of set
ragged right. This is because command \raggedpart is defined as
\let\raggedpart\centering
You may also redefine this using \renewcommand too.
Example: You do not want different alignment at headings of \part. So you put
\renewcommand*{\raggedpart}{\raggedsection}
into the preamble of your document. In this case, and unlike in the example
above, \let has not been used, because \let would give \raggedpart the cur-
rent meaning of \raggedsection. Further changes of \raggedsection would
then stay disregarded at the usage of \raggedpart. Doing the redefinition us-
ing \renewcommand gives \raggedpart the meaning of \raggedsection not at
definition time, but each time \raggedpart will be used.
\partformat
\chapterformat
\sectionformat
\subsectionformat
\subsubsectionformat
\paragraphformat
\subparagraphformat
\othersectionlevelsformat{sectioning name }{}{counter output }
\IfUsePrefixLine{then code }{else code }
\autodot
KOMA-Script has added a further logical level on top of \the sectioning name to the out-
put of the sectioning numbers. The counters for the respective heading are not merely
output. They are formatted using the commands \partformat, \chapterformat down to
\subparagraphformat
v3.17
. Of course the command \chapterformat like \thechapter does not
scrbook
,
scrreprt
exist in the class scrartcl but only in the classes scrbook and scrreprt.
As described for option numbers at the beginning of this section (see
page 88
), periods in
section numbers should be handled for the German-speaking region according to the rules given
in [
DUD96
]. The command \autodot in KOMA-Script ensures that these rules are followed.
In all levels except for \part, a dot is followed by a further \enskip. This corresponds to a
horizontal skip of 0.5 em.
Since KOMA-Script 3.17
v3.17
the command \othersectionlevelsformat is used only in rare
circumstances, i. e., if the corresponding format command to a section command does not
exist or is \relax. This should not happen for all section commands defined by KOMA-Script
itself. Therefore the command is not officially documented any longer. Nevertheless, if a
compatibility level prior to 3.17 (see option version,
section 3.2
,
page 29
) has been selected,
commands \sectionformat down to \subparagraphformat are ignored by KOMA-Script. In
this case \othersectionlevelsformat indeed will be used.
98
Chapter 3.
The formatting commands can be redefined using \renewcommand to fit them to your per-
sonal needs. The following original definitions are used by the KOMA-Script classes:
\newcommand*{\partformat}{\partname~\thepart\autodot}
\newcommand*{\chapterformat}{%
\mbox{\chapappifchapterprefix{\nobreakspace}\thechapter
\autodot\IfUsePrefixLine{}{\enskip}}}
\newcommand*{\sectionformat}{\thesection\autodot\enskip}
\newcommand*{\othersectionlevelsformat}[3]{%
#3\autodot\enskip}
The definitions of the lower levels correspond to \sectionformat.
Because
v3.17
of \IfUsePrefixLine command \chapterformat should not be used outside of
\chapter
. \IfUsePrefixLine is only valid inside section commands of KOMA-Script. In
this case, it executes the then code if a prefix line for the number is used, but else code
otherwise.
Do not forget to change \newcommand into \renewcommand if you like to re-define one of the
commands.
Example: Assume that when using \part you do not want the word “Part” written in front
of the part number. You could use the following command in the preamble of your
document:
\renewcommand*{\partformat}{\thepart\autodot}
Strictly speaking, you could do without \autodot at this point and insert a fixed
dot instead. As \part is numbered with roman numerals, according to [
DUD96
] a
period has to be applied. However, you thereby give up the possibility to use one of
the options numbers=endperiod and numbers=noendperiod and optionally depart
from the rules. More details concerning class options can be found at
page 88
.
An additional possibility could be to place the section numbers in the left margin
in such a way that the heading text is left aligned with the surrounding text. This
can be accomplished with:
\renewcommand*{\sectionformat}{%
\makebox[0pt][r]{\thesection\autodot\enskip}}
\renewcommand*{\subsectionformat}{%
\makebox[0pt][r]{\thesubsection\autodot\enskip}}
\renewcommand*{\subsubsectionformat}{%
\makebox[0pt][r]{\thesubsubsection\autodot\enskip}}
\renewcommand*{\paragraphformat}{%
\makebox[0pt][r]{\theparagraph\autodot\enskip}}
\renewcommand*{\paragraphformat}{%
\makebox[0pt][r]{\thesubparagraph\autodot\enskip}}
See [
Tea05b
] for more information about the optional arguments of \makebox.
99
Chapter 3.
If you would like to change more than only the printing of the counter of a head-
ing, please have a look at \chapterlineswithprefixformat, \chapterlinesformat,
\sectionlinesformat
, and \sectioncatchphraseformat in
section 21.3
from
page 401
.
\chapappifchapterprefix{additional text }
\chapapp
These
v2.8o
two commands are not only used internally by KOMA-Script but are also provided
scrbook
,
scrreprt
to the user. Later it will be shown how they can be used, for example, to redefine other
commands.
Using the layout option chapterprefix=true (see
page 85
) \chapappifchapterprefix
outputs the word “Chapter” in the main part of the document in the current language, followed
by additional text . In the appendix, the word “Appendix” in the current language is
output instead, followed by additional text . If the option chapterprefix=false is set,
then nothing is output.
The command \chapapp always outputs the word “Chapter” or “Appendix”. In this case
the selection of option chapterprefix has no effect.
Since chapters only exist in the classes scrbook and scrreprt, these commands only exist in
these classes.
\chaptermark{running head }
\addchapmark{running head }
\sectionmark{running head }
\addsecmark{running head }
\subsectionmark{running head }
\chaptermarkformat
\sectionmarkformat
\subsectionmarkformat
As mentioned in
section 3.12
the page style headings works with automatic running
heads. For this, the commands \chaptermark and \sectionmark, or \sectionmark and
\subsectionmark
, respectively, are defined. Every structuring command (\chapter, \section,
etc.) automatically carries out the respective \...mark command. The parameter passed con-
tains the text of the section heading. The respective section number is added automatically in the
\...mark
command. The formatting is done according to the section level with one of the three
commands \chaptermarkformat, \sectionmarkformat, or \subsectionmarkformat.
Please note, the running heads of \addchap and \addsec are also based on \chaptermark
and \addsecmark but locally set counter secnumdepth to a value that makes chapters re-
spectively sections not numbered. You should pay attention for this especially if you redefine
\chaptermark
or \sectionmark (see \ifnumbered on
page 101
). The star variants \addchap*
and \addsec* use additional commands \addchapmark and \addsecmark that are defined also
basing on \chaptermark and \sectionmark with local changes of secnumdepth.
scrbook
,
scrreprt
Of course there is no command \chaptermark or \chaptermarkformat in scrartcl. Accord-
scrartcl
100
Chapter 3.
ingly, \subsectionmark and \subsectionmarkformat exist only in scrartcl. This changes when
you use the scrlayer-scrpage package (see
chapter 5
).
Similar to \partformat down to \subparagraphformat for formatting the numbers in
the headings, the commands \chaptermarkformat (not in scrartcl), \sectionmarkformat,
and \subsectionmarkformat (only in scrartcl) define the formatting of the sectioning num-
bers in the automatic running heads. They can be adapted to your personal needs with
\renewcommand
. The original definitions for the KOMA-Script classes are:
\newcommand*{\chaptermarkformat}{%
\chapappifchapterprefix{\ }\thechapter\autodot\enskip}
\newcommand*{\sectionmarkformat}{\thesection\autodot\enskip}
\newcommand*{\subsectionmarkformat}{%
\thesubsection\autodot\enskip}
Example: Suppose you want to prepend the word “Chapter” to the chapter number in the
running heading. For example you could insert the following definition in the
preamble of your document:
\renewcommand*{\chaptermarkformat}{%
\chapapp~\thechapter\autodot\enskip}
As you can see, both the commands \chapappifchapterprefix and \chapapp explained
above are used here.
secnumdepth
\partnumdepth
\chapternumdepth
\sectionnumdepth
\subsectionnumdepth
\subsubsectionnumdepth
\paragraphnumdepth
\subparagraphnumdepth
Section levels in the classes scrbook and scrreport are, by default, numbered from \part down to
\subsection
. In class scrartcl the default numbering is from \part down to \subsubsection.
The actual depth to which headings will be numbered is controlled by the L
A
TEX counter
secnumdepth
. Since version 3.12 KOMA-Script provides the commands \partnumdepth to
\subparagraphnumdepth
which return the number that corresponds to the level they bear in
their name. This saves users the trouble of having to remember abstract numbers and allows
them to define the depth to which headings should be numbered with relative ease.
KOMA-Script provides the commands \partnumdepth to \subparagraphnumdepth so
v3.12
users
do not have to remember abstract numbers, to be able to define the section level down to which
headings should be numbered. These commands stand for the corresponding numbers of the
section levels.
101
Chapter 3.
Example: For a book project you want the section levels from part down to the section to
be numbered. To achieve this, you have to set counter secnumdepth to the value
represented by \sectionnumdepth in the preamble of your document:
\setcounter{secnumdepth}{\sectionnumdepth}
Redefining these commands is not allowed. Doing so could lead to unexpected results not only
with KOMA-Script but also with third party packages. Thus, it is recommended to never
redefine any of them.
Do not confuse the counters secnumdepth and tocdepth, please refer to the explanation
concerning the counter tocdepth in
section 3.9
,
page 68
. Actually, depending on the class you
are using, the meaning of the values of the counters secnumdepth and tocdepth may deviate
from one another for the same section level.
\ifnumbered{section level }{then code }{else code }
\ifunnumbered{section level }{then code }{else code }
After
v3.12
describing above how to define down to which section level headings are numbered,
the commands \ifnumbered and \ifunnumbered can be used to execute code depending
on whether a section level is numbered or not. If the current setting of secnumdepth
stipulates that a section level will be numbered, the then code after \ifnumbered gets
executed. If it is not numbered, the else code gets executed. The \ifunnumbered command
behaves in exactly the opposite manner, executing the then code if the current level is not
numbered and the else code if it is. The section level parameter is simply the L
A
TEX
name of a section like part, chapter, section, subsection, subsubsection, paragraph
oder subparagraph.part, chapter, section, subsection, subsubsection, paragraph, or
subparagraph
.
KOMA-Script itself uses these tests, for example, in the definition of \chaptermark within
page style headings. This indirectly guarantees that headings inserted by \addchap do not
set a number inside the running head (see also \addchapmark,
page 99
).
\setpartpreamble[position ][width ]{preamble }
\setchapterpreamble[ position ][ width ]{ preamble }
Parts and chapters in KOMA-Script can be started with a preamble . This is particularly
scrbook
,
scrreprt
useful when you are using a two column layout with the class option twocolumn, since the
heading together with the preamble is always set in a one column layout. The preamble can
comprise more than one paragraph. The command to output the preamble has to be placed
before the respective \part, \addpart, \chapter, or \addchap command.
Example: You are writing a report about the condition of a company. You organize the
report in such a way that every department gets its own partial report. Every one
of these parts should be introduced by an abstract on the corresponding title page.
You could write the following:
102
Chapter 3.
\setpartpreamble{%
\begin{abstract}
This is a filler text. It serves merely to demonstrate the
capabilities of {\KOMAScript}. If you read this text, you will
get no information.
\end{abstract}
}
\ Dostları ilə paylaş: |