part{Department for Word Processing}
Depending on the settings for the heading font size (see
page 86
) and the options
for the abstract environment (see
section 3.8
,
page 64
), the result would look
similar to:
Part III.
Department for Word Processing
Abstract
This is a filler text. It serves merely to demonstrate the capabilities
of KOMA-Script. If you read this text, you will get no information.
Please note that it is you who is responsible for the spaces between the heading, preamble
and the following text. Please note also that there is no abstract environment in the class
scrbook (see
section 3.8
,
page 64
).
The
v2.8p
first optional argument position determines the position at which the preamble is
placed with the help of one or two letters. For the vertical placement there are two possibilities
at present:
o
– above the heading
u
– below the heading
You can insert one preamble above and another below a heading. For the horizontal placement
you have the choice between three alignments:
l
– left-aligned
r
– right-aligned
c
– centered
However, this does not output the text of the preamble in such a manner, but inserts a
box whose width is determined by the second optional argument width . If you leave out
this second argument the whole text width is used. In that case the option for horizontal
103
Chapter 3.
positioning will have no effect. You can combine exactly one letter from the vertical with one
letter from the horizontal positioning.
A more often usage of \setchapterpreamble would be something like a smart slogan or
dictum to a heading. The command \dictum, that may be used for this, will be described at
the next section. You will also find an example there.
Please note that a preamble placed above the chapter headings will be set into the already
existing vertical space above the heading. The heading will not be moved down. It is you who
is responsible for ensuring that the preamble is small enough and the space is sufficient. See
also \chapterheadstartvskip in
section 21.3
,
page 400
for this.
3.17. Dicta
Sometimes you may find a dictum, a kind of smart slogan or excerpt, often ragged left above
or below the heading of a chapter or section. The text and the source of the slogan often use
special styles.
\dictum[author ]{dictum }
\dictumwidth
\dictumauthorformat{author }
\dictumrule
\raggeddictum
\raggeddictumtext
\raggeddictumauthor
The command \dictum inserts such a dictum. This macro can be used as obligatory argument
of either the command \setchapterpreamble or \setpartpreamble. However, this is not
obligatory.
The dictum together with an optional author is inserted in a \parbox (see [
Tea05b
])
of width \dictumwidth.
Yet \dictumwidth is not a length which can be set with
\setlength
. It is a macro that can be redefined using \renewcommand. Default setting is
0.3333\textwidth
, which is a third of the textwidth. The box itself is positioned with the
command \raggeddictum. Default here is \raggedleft, that is, right justified. The command
\raggeddictum
can be redefined using \renewcommand.
Within the box the dictum is set using \raggeddictumtext.
Default setting is
\raggedright
, that is, left justified. Similarly to \raggeddictum this can be redefined with
\renewcommand
. The output uses the default font setting for the element dictumtext, which
can be changed with the commands \setkomafont and \addtokomafont (see
section 3.6
,
page 53
). Default settings are listed in
table 3.16
.
If there is an author name, it is separated from the dictum by a rule to the full width of
the \parbox. This
v3.10
rule is defined as vertical object to command \dictumrule:
\newcommand*{\dictumrule}{\vskip-1ex\hrulefill\par}
104
Chapter 3.
Table 3.16.: Default settings
for the elements of a dictum
Element
Default
dictumtext
\normalfont\normalcolor\sffamily\small
dictumauthor
\itshape
The alignment is defined with \raggeddictumauthor. Default is \raggedleft. This com-
mand can also be redefined using \renewcommand. The format of the output is defined
with \dictumauthorformat. This macro expects the \author as argument. As default
\dictumauthorformat
is defined as:
\newcommand*{\dictumauthorformat}[1]{(#1)}
Thus the author is set enclosed in rounded parentheses. For the element dictumauthor, a
different font than for the element dictumtext can be defined. Default settings are listed in
table 3.16
. Changes can be made using the commands \setkomafont and \addtokomafont
(see
section 3.6
,
page 53
).
If \dictum is used within the macro \setchapterpreamble or \setpartpreamble you have
to take care of the following: the horizontal positioning is always done with \raggeddictum.
Therefore, the optional argument for horizontal positioning which is implemented for these
two commands has no effect. \textwidth is not the width of the whole text corpus but the
actually used text width. If \dictumwidth is set to .5\textwidth and \setchapterpreamble
has an optional width of .5\textwidth too, you will get a box with a width one quarter of
the text width. Therefore, if you use \dictum it is recommended to refrain from setting the
optional width for \setchapterpreamble or \setpartpreamble.
If you have more than one dictum, one under another, you should separate them by an
additional vertical space, easily accomplished using the command \bigskip.
Example: You are writing a chapter on an aspect of weather forecasting. You have come
across an aphorism which you would like to place at the beginning of the chapter
beneath the heading. You could write:
\setchapterpreamble[u]{%
\dictum[Anonymous]{Forecasting is the art of saying
what is going to happen and then to explain
why it didn’t.}}
\chapter{Weather forecasting}
The output would look as follows:
105
Chapter 3.
17 Weather forecasting
Forecasting is the art of
saying what is going to
happen and then to explain
why it didn’t.
(Anonymous)
If you would rather the dictum span only a quarter of the text width rather than
one third you can redefine \dictumwidth:
\renewcommand*{\dictumwidth}{.25\textwidth}
For a somewhat more sophisticated formatting of left- or right-aligned paragraphs including
hyphenation you can use the package ragged2e [
Sch09
].
3.18. Lists
Both L
A
TEX and the standard classes offer different environments for lists. Though slightly
changed or extended all these list are of course offered in KOMA-Script as well. In general,
all lists — even of different kind — can be nested up to four levels. From a typographical
view, anything more would make no sense, as more than three levels can no longer be easily
perceived. The recommended procedure in such a case is to split the large list into several
smaller ones.
\begin{itemize}
\item
. . .
\end{itemize}
\labelitemi
\labelitemii
\labelitemiii
\labelitemiv
The simplest form of a list is an itemize list. Depending on the level, KOMA-Script uses the
following marks: “•”, “–”, “∗” and “·”. The definition of these symbols is specified in the
macros \labelitemi, \labelitemii, \labelitemiii and \labelitemiv, all of which can be
redefined using \renewcommand. Every item is introduced with \item.
Example: You have a simple list which is nested in several levels. You write for example:
\minisec{Vehicles}
\begin{itemize}
\item aeroplanes
\begin{itemize}
\item biplane
106
Chapter 3.
\item jets
\item transport planes
\begin{itemize}
\item single-engined
\begin{itemize}
\item jet-driven
\item propeller-driven
\end{itemize}
\item multi-engined
\end{itemize}
\item helicopters
\end{itemize}
\item automobiles
\begin{itemize}
\item racing cars
\item private cars
\item lorries
\end{itemize}
\item bicycles
\end{itemize}
As output you get:
Vehicles
• aeroplanes
–
biplanes
–
jets
–
transport planes
∗ single-engined
· jet-driven
· propeller-driven
∗ multi-engined
–
helicopters
• automobiles
–
racing cars
–
private cars
–
lorries
• bicycles
107
Chapter 3.
\begin{enumerate}
\item
. . .
\end{enumerate}
\theenumi
\theenumii
\theenumiii
\theenumiv
\labelenumi
\labelenumii
\labelenumiii
\labelenumiv
Another form of a list often used is a numbered list which is already implemented by the
L
A
TEX kernel. Depending on the level, the numbering uses the following characters: Arabic
numbers, small letters, small roman numerals, and capital letters. The kind of numbering is
defined with the macros \theenumi down to \theenumiv. The output format is determined
by the macros \labelenumi to \labelenumiv. While the small letter of the second level is
followed by a round parenthesis, the values of all other levels are followed by a dot. Every
item is introduced with \item.
Example: Replacing every occurrence of an itemize environment with an enumerate envi-
ronment in the example above we get the following result:
Vehicles
1. aeroplanes
a) biplanes
b) jets
c) transport planes
i. single-engined
A. jet-driven
B. propeller-driven
ii. multi-engined
d) helicopters
2. automobiles
a) racing cars
b) private cars
c) lorries
3. bicycles
Using \label within a list you can set labels which are referenced with \ref. In
the example above, a label was set after the jet-driven, single-engined transport
planes with \label{xmp:jets}. The \ref value is then
1(c)iA
.
108
Chapter 3.
\begin{description}
\item[keyword ]
. . .
\end{description}
A further list form is the description list. Its main use is the description of several items. The
item itself is an optional parameter in \item. The font
v2.8p
which is responsible for emphasizing
the item can be changed with the commands \setkomafont and \addtokomafont (see
sec-
tion 3.6
,
page 53
) for the element descriptionlabel (see
table 3.2
,
page 54
). Default setting
is \sffamily\bfseries.
Example: Instead of items in sans serif and bold, you want them printed in the standard font
in bold. Using
\setkomafont{descriptionlabel}{\normalfont\bfseries}
you redefine the font accordingly.
An example for a description list is the output of the page styles listed in
sec-
tion 3.12
. The heavily abbreviated source could be:
\begin{description}
\item[empty] is the page style without any header or footer.
\item[plain] is the page style without headings.
\item[headings] is the page style with running headings.
\item[myheadings] is the page style for manual headings.
\end{description}
This abbreviated version gives:
empty is the page style without any header or footer.
plain is the page style without headings.
headings is the page style with running headings.
myheadings is the page style for manual headings.
\begin{labeling}[delimiter ]{widest pattern }
\item[keyword ]
. . .
\end{labeling}
An additional form of a description list is only available in the KOMA-Script classes: the
labeling
environment. Unlike the description environment, you can provide a pat-
tern whose length determines the indentation of all items. Furthermore, you can put
an optional delimiter between the item and its description. The font
v3.01
which is respon-
sible for emphasizing the item and the separator can be changed with the commands
\setkomafont
and \addtokomafont (see
section 3.6
,
page 53
) for the element labelinglabel
and labelingseparator (see
table 3.2
,
page 54
).
109
Chapter 3.
Example: Slightly changing the example from the description environment, we could write:
\setkomafont{labelinglabel}{\ttfamily}
\setkomafont{labelingseparator}{\normalfont}
\begin{labeling}[~--]{myheadings}
\item[empty]
Page style without header and footer
\item[plain]
Page style for chapter beginnings without headings
\item[headings]
Page style for running headings
\item[myheadings]
Page style for manual headings
\end{labeling}
As the result we get:
empty
– Page style without header and footer
plain
– Page style for chapter beginnings without headings
headings
– Page style for running headings
myheadings
– Page style for manual headings
As can be seen in this example, a font changing command may be set in the usual
way. But if you do not want the font of the separator to be changed in the same
way as the font of the label, you have to set the font of the separator as well.
Originally, this environment was implemented for things like “Precondition, Assertion, Proof”,
or “Given, Required, Solution” that are often used in lecture hand-outs. By now this environ-
ment has found many different applications. For example, the environment for examples in
this guide was defined with the labeling environment.
\begin{verse}
. . .
\end{verse}
Usually the verse environment is not perceived as a list environment because you do not
work with \item commands. Instead, fixed line breaks are used within the flushleft envi-
ronment. Yet internally in both the standard classes as well as KOMA-Script it is indeed a
list environment.
In general, the verse environment is used for poems. Lines are indented both left and right.
Individual lines of verse are ended by a fixed line break \\. Verses are set as paragraphs,
separated by an empty line. Often also \medskip or \bigskip is used instead. To avoid a
page break at the end of a line of verse you could, as usual, insert \\* instead of \\.
110
Chapter 3.
Example: As an example, the first lines of “Little Red Riding Hood and the Wolf” by Roald
Dahl:
\ begin{verse}
As soon as Wolf began to feel\\*
that he would like a decent meal,\\*
He went and knocked on Grandma’s door.\\*
When Grandma opened it, she saw\\*
The sharp white teeth, the horrid grin,\\*
And Wolfie said, ‘May I come in?’
\end{verse}
The result is as follows:
As soon as Wolf began to feel
That he would like a decent meal,
He went and knocked on Grandma’s door.
When Grandma opened it, she saw
The sharp white teeth, the horrid grin,
And Wolfie said, ‘May I come in?’
However, if you have very long lines of verse, for instance:
\begin{verse}
Both the philosopher and the house-owner
have always something to repair.\\
\bigskip
Don’t trust a man, my son, who tells you
that he has never lied.
\end{verse}
where a line break occurs within a line of verse:
Both the philosopher and the house-owner have always some-
thing to repair.
Don’t trust a man, my son, who tells you that he has never
lied.
there \\* can not prevent a page break occurring within a verse at such a line
break. To prevent such a page break, a \nopagebreak would have to be inserted
somewhere in the first line:
\begin{verse}
Both the philosopher and the house-owner\nopagebreak
have always something to repair.\\
\bigskip
Don’t trust a man, my son, who tells you\nopagebreak
that he has never lied.
\end{verse}
111
Chapter 3.
In the above example, \bigskip was used to separate the lines of verse.
\begin{quote}
. . .
\end{quote}
\begin{quotation}
. . .
\end{quotation}
These two environments are also list environments and can be found both in the standard
and the KOMA-Script classes. Both environments use justified text which is indented both
on the left and right side. Usually they are used to separate long citations from the main
text. The difference between these two lies in the manner in which paragraphs are typeset.
While quote paragraphs are highlighted by vertical space, in quotation paragraphs the first
line is indented. This is also true for the first line of a quotation environment. To prevent
indentation you have to insert a \noindent command before the text.
Example: You want to highlight a short anecdote. You write the following quotation envi-
ronment for this:
A small example for a short anecdote:
\begin{quotation}
The old year was turning brown; the West Wind was
calling;
Tom caught the beechen leaf in the forest falling.
‘‘I’ve caught the happy day blown me by the breezes!
Why wait till morrow-year? I’ll take it when me pleases.
This I’ll mend my boat and journey as it chances
west down the withy-stream, following my fancies!’’
Little Bird sat on twig. ‘‘Whillo, Tom! I heed you.
I’ve a guess, I’ve a guess where your fancies lead you.
Shall I go, shall I go, bring him word to meet you?’’
\end{quotation}
The result is:
A small example for a short anecdote:
The old year was turning brown; the West Wind was calling;
Tom caught the beechen leaf in the forest falling. “I’ve
caught the happy day blown me by the breezes! Why wait
till morrow-year? I’ll take it when me pleases. This I’ll mend
my boat and journey as it chances west down the withy-stream,
following my fancies!”
Little Bird sat on twig. “Whillo, Tom! I heed you. I’ve a
guess, I’ve a guess where your fancies lead you. Shall I go, shall
I go, bring him word to meet you?”
112
Chapter 3.
Using a quote environment instead you get:
A small example for a short anecdote:
The old year was turning brown; the West Wind was calling;
Tom caught the beechen leaf in the forest falling. “I’ve caught
the happy day blown me by the breezes! Why wait till morrow-
year? I’ll take it when me pleases. This I’ll mend my boat and
journey as it chances west down the withy-stream, following
my fancies!”
Little Bird sat on twig. “Whillo, Tom! I heed you. I’ve a guess,
I’ve a guess where your fancies lead you. Shall I go, shall I go,
bring him word to meet you?”
\begin{addmargin}[left indentation ]{indentation }
. . .
\end{addmargin}
\begin{addmargin*}[ inner indentation ]{ indentation }
. . .
\end{addmargin*}
Similar to quote and quotation, the addmargin environment changes the margin. In contrast
to the first two environments, with addmargin the user can set the width of the indentation.
Besides this, this environment does not change the indentation of the first line nor the vertical
spacing between paragraphs.
If only the obligatory argument indentation is given, both the left and right margin are
expanded by this value. If the optional argument left indentation is given as well, then at
the left margin the value left indentation is used instead of indentation .
The starred addmargin* only differs from the normal version in a two-sided layout. Fur-
thermore, the difference only occurs if the optional argument inner indentation is used.
In this case this value inner indentation is added to the normal inner indentation. For
right-hand pages this is the left margin, for left-hand pages the right margin. Then the value
of indentation determines the width of the opposite margin.
Both versions of this environment take also negative values for all parameters. This has the
effect of expanding the environment into the margin.
Example:
\newenvironment{SourceCodeFrame}{%
\begin{addmargin*}[1em]{-1em}%
\begin{minipage}{\linewidth}%
\rule{\linewidth}{2pt}%
}{%
\rule[.25\baselineskip]{\linewidth}{2pt}%
\end{minipage}%
\end{addmargin*}%
}
113
Chapter 3.
If you now put your source code in such an environment it will show up as:
You define yourself the following environment:
\newenvironment{\SourceCodeFrame}{%
\begin{addmargin*}[1em]{-1em}%
\begin{minipage}{\linewidth}%
\rule{\linewidth}{2pt}%
}{%
\rule[.25\baselineskip]{\linewidth}{2pt}%
\end{minipage}%
\end{addmargin*}%
}
This may be feasible or not. In any case it shows the usage of this envi-
ronment.
The optional argument of the addmargin* environment makes sure that the inner
margin is extended by 1 em. In turn the outer margin is decreased by 1 em. The
result is a shift by 1 em to the outside. Instead of 1em you can of course use a
length, for example, 2\parindent.
Whether a page is going to be on the left or right side of the book can not be determined
for certain in the first L
A
TEX run. For details please refer to the explanation of the commands
\ifthispageodd
(
section 3.11
,
page 71
) and \ifthispagewasodd (
section 21.1
,
page 386
).
There may be several questions about coexistence of lists and paragraphs. Because of this
additional information may be found at the description of option parskip in
section 21.1
,
page 386
.
Also at the expert part, in
section 21.1
,
page 386
, you may find additional information about page
breaks inside of addmargin*.
Dostları ilə paylaş: |