3.19. Math
There are no math environments implemented in the KOMA-Script classes. Instead of this,
the math features of the L
A
TEX kernel have been supported. With this also, the options leqno
and fleqn are available.
You will not find a description of the math environments of the L
A
TEX kernel here. If you
want to use displaymath, equation, and eqnarray you should read a short introduction into
L
A
TEX like [
OPHS11
]. But if you want more than very simple mathematics, usage of package
amsmath would be recommended (see [
Ame02
]).
leqno
Equations are normally numbered on the right. The standard option leqno causes the standard
option file leqno.clo to be loaded. The equations are then numbered on the left. This
option has to be used as an optional argument of \documentclass. Usage as an argument
of \KOMAoptions or \KOMAoption is not supported. This would not make sense, because the
114
Chapter 3.
recommended math package amsmath supports the option at loading time only too and would
not react on run-time changes of the option.
fleqn
Displayed equations are normally centered. The standard option fleqn causes the standard
option file fleqn.clo to be loaded. Displayed equations are then left-justified. This op-
tion may be used as an optional argument of \documentclass but not as an argument of
\KOMAoptions
or \KOMAoption. The latter would not make sense, because the recommended
math package amsmath supports the option at loading time only too and would not react on
run-time changes of the option.
3.20. Floating Environments of Tables and Figures
With the floating environments, L
A
TEX offers a very capable and comfortable mechanism for
automatic placement of figures and tables. But often these floating environments are slightly
misunderstood by beginners. They often ask for a fixed position of a table or figure within
the text. However, since these floating environments are being referenced in the text this is
not necessary in most cases. It is also not sensible because such an object can only be set on
the page if there is enough space left for it. If this is not the case the object would have to be
shifted onto the next page, thereby possibly leaving a huge blank space on the page before.
Often one finds in a document for every floating object the same optional argument for
positioning the object. This also makes no sense. In such cases one should rather change the
standard parameter globally. For more details refer to [
Wik
].
One last important note before starting this section: most mechanisms described here which
extend the capabilities of the standard classes no longer work correctly when used together
with packages which modify the typesetting of captions of figures and tables. This should be
self evident, but it is often not understood.
captions=selection
The standard classes format titles of floating environments, which are placed with \caption
(see below), like signatures. They differentiate between one-line and multi-line table or figure
captions. One-line captions are centered while multi-line captions are left-justified.
For tables, however, headings are often used. That’s because there may be tables that span
several pages. Surely the reader wants to know the purpose of the table at the first page
already. Furthermore tables will be read row by row from top down to bottom. So there are
at least two good reasons to generally use table headings. KOMA-Script therefor supports
option captions=tableheading, which changes the caption format into headings at tables
only.
115
Chapter 3.
Please note that multi-page tabulars may not use any floating environment. To have an
automatic page break at any kind of tabular you also need additional packages like longtable
(see [
Car04
]) or tabu (see [
Che11
]).
You may switch back to the default table signatures using captions=tablesignature. Note
that using any of these options does not change the position of the caption from above the
top of the table to below the bottom of the table or vice versa. It only affects whether the
text is formatted as a caption for use above or below a table. Whether the text is in fact
placed above or below a table is set through the position of the \caption command inside
the table environment. This may change using package float and command \restylefloats
(see [
Lin01
]).
Of course similar features exist
v3.09
for figures using options captions=figureheading and
captions=figuresignature
. Nevertheless, figures like photos will be viewed as a whole, and
a diagram or graph will mostly be examined from left bottom to the right. Therefore, in
general, signatures should be used and it would not be useful to change the caption format
from signatures to headings.
Nevertheless sometimes all floating environments shall use headings. For this KOMA-Script
supports
v3.09
options captions=heading and captions=signature to switch the format of every
floating environment. These options may be used also inside a floating environment but before
using \caption.
Note that when using the float package, the options captions=tablesignature and
float
captions=tableheading
cease to act correctly when \restylefloat is applied to tables.
More details of the float package and \restylefloat can be found in [
Lin01
]. Additional
support in KOMA-Script for the float package may be found at the explanation of komaabove
(see
page 124
).
Furthermore, KOMA-Script supports to switch off the distinguish of captions with only one
line or more than one line using option captions=nooneline. This may be useful, if one-line
captions should not be centered. The default of centering one-line captions corresponds to
captions=oneline
.
Another special feature of KOMA-Script is to alternatively put the caption neither above
nor below the floating object but beside it. For this you need Environment captionsbeside,
that will be described from
page 121
. Several settings for this environment may be done also
using caption. You may find all the available settings at
table 3.17
.
116
Chapter 3.
Table 3.17.: Available values for option captions to select formation of captions as headings or signa-
tures at floating environments
bottombeside
, besidebottom
Captions and contents of environment captionsbeside (see
section 3.20
,
page 121
)
will be vertically align depending on the bottommost base lines.
centeredbeside
, besidecentered, middlebeside, besidemiddle
Captions and contents of environment captionsbeside (see
section 3.20
,
page 121
)
will be vertically centered
figureheading
, figureabove, abovefigure, topatfigure
v3.09
Captions of figures will use heading formation — maybe in discrepancy to
captions=signature
.
figuresignature
, belowfigure, bottomatfiggure
v3.09
Captions of figures will use signature formation — maybe in discrepancy to
captions=headings
.
heading
, above, top
v3.09
Captions of floating environments will use heading formation. Nevertheless this does
not influence whether they are really placed at the top or at the bottom of the object.
This options also implies captions=tableheading and captions=figureheading.
innerbeside
, besideinner
Captions of environment captionsbeside (siehe
section 3.20
,
page 121
) will be
placed innermost beside the contents of the environment at double-side printing. At
single-side printing captions=leftbeside will be used.
leftbeside
, besideleft
Captions of environment captionsbeside (siehe
section 3.20
,
page 121
) will be
placed left beside the contents of the environment.
nooneline
Captions with only one line will not be handled different from captions with more
than one line.
oneline
Captions with only one line will be centered horizontally.
. . .
117
Chapter 3.
Table 3.17.: Available values for option captions (continuation)
outerbeside
, besideouter
Captions of environment captionsbeside (siehe
section 3.20
,
page 121
) will be
placed outermost beside the contents of the environment at double-side printing. At
single-side printing captions=rightbeside will be used.
rightbeside
, besideright
Captions of environment captionsbeside (siehe
section 3.20
,
page 121
) will be
placed right beside the contents of the environment.
signature
, below, bot, bottom
v3.09
Captions of floating environments will use signature formation. Nevertheless this
does not influence whether they are really placed at the top or at the bot-
tom of the object. This options also implies captions=tablesignature and
captions=figuresignature
.
tableheading
, tableabove, abovetable, abovetabular, topattable
Captions of tables will use heading formation — maybe in discrepancy to
captions=signature
.
tablesignature
, belowtable, belowtabular, bottomattable
Captions of tables will use signature formation — maybe in discrepancy to
captions=heading
.
topbeside
, besidetop
Captions and contents of environment captionsbeside (see
section 3.20
,
page 121
)
will be vertically align depending on the topmost base lines.
\caption[entry ]{title }
\captionbelow[entry ]{title }
\captionabove[entry ]{title }
In the standard classes caption text title of tables and figures is inserted with the \caption
command below the table or figure. In general this is correct for figures. Opinions differ as
to whether captions of tables are to be placed above or, consistent with captions of figures,
below the table. That is the reason why KOMA-Script, unlike the standard classes, offers
\captionbelow
for captions below and \captionabove for captions above tables or figures.
Not only for tables but also for figures or all kind of floating environments the behaviour of
\caption
may be modified using option captions described at the beginning of this section.
For compatibility reasons the default behaviour of \caption used with all kinds of floating
environments is similar to \captionbelow. Nevertheless it is recommended to use table head-
ings and therefor switch behaviour of \caption inside table environments into \captionabove
118
Chapter 3.
using option captions=tableheading. Alternatively you may use \captionabove instead of
\caption
inside of every table environment.
Example: Instead of using captions below a table you want to place your captions above it,
because you have tables which span more then one page. In the standard classes
you could only write:
\begin{table}
\caption{This is an example table}
\begin{tabular}{llll}
This & is & an & example.\\\hline
This & is & an & example.\\
This & is & an & example.
\end{tabular}
\end{table}
Then you would get the unsatisfying result:
Table 30.2: This is an example table.
This is an example.
This is an example.
This is an example.
Using KOMA-Script you write instead:
\begin{table}
\captionabove{This is just an example table}
\begin{tabular}{llll}
This & is & an & example.\\\hline
This & is & an & example.\\
This & is & an & example.
\end{tabular}
\end{table}
Then you get:
Table 30.2: This is just an example table
This is an example.
This is an example.
This is an example.
Since you want all your tables typeset with captions above, you could of course
use the option captions=tableheading instead (see
page 114
). Then you can use
\caption
as you would in the standard classes. You will get the same result as
with \captionabove.
The font style
v2.8p
for the description and the label — “Figure” or “Table”, followed by
the number and the delimiter — can be changed with the commands \setkomafont and
119
Chapter 3.
Table 3.18.: Font defaults for the elements of figure or table
captions
element
default
caption
\normalfont
captionlabel
\normalfont
\addtokomafont
(see
section 3.6
,
page 53
). The respective elements for this are caption
and captionlabel (see
table 3.2
,
page 54
). First the font style for the element caption is
applied to the element captionlabel too. After this the font style of captionlabel is applied
on the respective element. The default settings are listed in
table 3.18
.
Example: You want the table and figure descriptions typeset in a smaller font size. Thus you
could write the following in the preamble of your document:
\addtokomafont{caption}{\small}
Furthermore, you would like the labels to be printed in sans serif and bold. You
add:
\setkomafont{captionlabel}{\sffamily\bfseries}
As you can see, simple extensions of the default definitions are possible.
\captionof{float type }[entry ]{title }
\captionbelowof{float type }[entry ]{title }
\captionaboveof{float type }[entry ]{title }
KOMA-Script supports a command \captionof
v3.05
similar to packages caption and capt-of. You
may use this command to place a floating environment caption with corresponding entry into
the list of that kind of floating environment but even inside a another floating environment or
outside any floating environment. In difference to \caption the kind of floating environment
has to be set as first parameter.
Furthermore, KOMA-Script provides the additional commands \captionaboveof
v3.09
and
\captionbelowof
. These are like \captionabove and \captionbelow but with the addi-
tional features and parameter of \captionof.
Of course KOMA-Script
v3.09a
takes care of the heading and signature setting of option
captions
. But this feature may be lost, loading package capt-of or caption. Please note
the manual of package caption for this!
Example: Assumed you want to create a floating object with a table and a figure side by
side. As you know, there are now mixed floating environment. Therefor you use a
figure
environment primarily:
\ begin{figure}
\begin{minipage}{.5\linewidth}
\centering
120
Chapter 3.
Figure 3.3.: Example:
Usage
of
\captionaboveof
inside
another floating environment
Figure 3.2.: A rectangle
Table 3.19.: Rectangle size
Width: 4 cm
Height: 3 cm
\rule{4cm}{3cm}
\caption{A rectangle}\label{fig:rechteck}
\end{minipage}%
\begin{minipage}{.5\linewidth}
\centering
\captionaboveof{table}
[Measure of the rectangle in
figure~\ref{fig:rechteck}]%
{Measure of the rectangle}
\label{tab:rechteck}
\begin{tabular}{ll}
Width:
& 4\,cm\\
Height: & 3\,cm
\end{tabular}
\end{minipage}
\end{figure}
Two minipage environments have been used to have figure and table side by side.
The percent char after the end of the first minipage is important. Without an
additional inter-word distance would be made between the minipage environments.
The figure signature has been done using \caption. The table heading has been
done using \captionaboveof with first argument table. Because of this KOMA-
Script knows, that despite the figure environment a table caption should be made.
The optional argument of \captionaboveof does make the entry into the list of
tables. Without the optional argument, the last mandatory argument would have
been used for the list of tables too. Although this caption text is sufficient for
the environment itself, it would be very useful at the list of tables. Therefor a
somehow more detailed description has been used for the list of tables using the
optional argument. The
figure 3.3
shows the result of the example code.
A non-floating table with a caption may be produced in the same kind like the table inside a
figure environment in the example above. In such a case also a minipage environment should
121
Chapter 3.
be used, to avoid page breaks between table caption an tabular. An additional flushleft
environment around the minipage environment may be used, to have a pleasing distance above
and below is and to avoid the paragraph indentation of the minipage environment.
\begin{captionbeside}[entry ]{title }%
[placement ][width ][offset ]
. . .
\end{captionbeside}
\begin{captionbeside}[entry ]{title }%
[placement ][width ][offset ]*
. . .
\end{captionbeside}
Apart
v2.8q
from captions above and below the figure, one often finds captions, in particular with
small figures, which are placed beside the figure. In general in this case both the baseline of
the figure and of the caption are aligned at the bottom. With some fiddling and the use of
two \parbox commands this could also be achieved in the standard classes. However, KOMA-
Script offers a special environment for this which can be used within the floating environment.
The first optional parameter entry and the obligatory parameter title mean the same as
the corresponding parameters of \caption, \captionabove or \captionbelow. The caption
text title is placed beside the content of the environment in this case.
Whether the caption text title is placed on the left or the right can be determined by the
parameter placement . Exactly one of the following letters is allowed:
l
– left
r
– right
i
– inner margin in two-sided layout
o
– outer margin in two-sided layout
Default setting is to the right of the content of the environment. This default
v3.00
my be changed us-
ing option captions (see
page 114
) with values like innerbeside, leftbeside, outerbeside,
and rightbeside. If either o or i are used you may need to run L
A
TEX twice to obtain the
correct placement.
Per default the content of the environment and the caption text title fill the entire available
text width. However, using the optional parameter width , it is possible to adjust the width
used. This width could even be larger than the current text width.
When supplying a width the used width is usually centered with respect to the text width.
Using the optional parameter offset , you can shift the environment relative to the left margin.
A positive value corresponds to a shift to the right, whereas a negative value corresponds to
a shift to the left. An offset of 0 pt gives you a left-aligned output.
Adding a star to the optional parameter offset makes the the value mean a shift relative
to the right margin on left hand pages in two-sided layout. A positive value corresponds to
122
Chapter 3.
Figure 3.4.: A figure description which is neither above nor below, but
beside the figure
KOMA-Script
a shift towards the outer margin, whereas a negative value corresponds to a shift towards
the inner margin. An offset of 0 pt means alignment with the inner margin. As mentioned
before, in some cases it takes two L
A
TEX runs for this to work correctly.
The default vertical alignment is bottom. This means that the bottommost base lines of the
contents of the environment and of the caption are aligned. This setting
v3.00
may be changed using
option captions (see
page 114
) with value topbeside, centeredbeside, or bottombeside.
With setting topbeside the topmost base lines of the environment contents and caption will
be aligned. With centeredbeside they will be centered vertically. In this context it should
be known, that the base line of a pictures is mostly at the bottom of the picture. This may
be changed, e. g., using \raisebox.
Example: An example for the usage of the captionbeside environment can be found in
figure 3.4
. This figure was typeset with:
\begin{figure}
\begin{captionbeside}[Example: Figure beside description]%
{A figure description which is neither above nor
below, but beside the figure}[i][\linewidth][%
[i][\linewidth][%
\dimexpr\marginparwidth+\marginparsep\relax]*
\fbox{%
\parbox[b][5\baselineskip][c]{.25\textwidth}
{%
\hspace*{\fill}\KOMAScript
\hspace*{\fill}\par
}%
}
\end{captionbeside}
\ label{fig:maincls.captionbeside}
\end{figure}
The total width is thus the currently available width \linewidth. However, this
width is shifted \marginparwidth + \marginparsep to the outside. The caption
text or description is placed on the inner side beside the figure. The figure itself is
shifted 2 em into the outer margin.
With \dimexp a ε-TEX command has been used. This should not be a problem at
123
Chapter 3.
Figure 3.5.: A figure description which is neither above nor below, but
centered beside the figure
KOMA-Script
all, because KOMA-Script itself needs ε-TEX and every almost up-to-date L
A
TEX
distribution uses ε-TEXalready.
Figure 3.5
shows a centered caption with:
\KOMAoption{captions}{centeredbeside}
Even if you are not a typographer you may see, that this is not a recommended
suggestion.
In opposite to the centered example, the top aligned from
figure 3.6
may be used.
To show how to change the baseline using \raisebox, the complete example code
follows:
\documentclass[captions=topbeside]{scrbook}
\usepackage[english]{babel}
\usepackage{graphics}
\begin{document}
\chapter{An Example}
\begin{figure}
\begin{captionbeside}%
[Example: Figure title top beside]%
{A figure description which is neither above nor
below, but top beside the figure}%
[i][\linewidth][%
\dimexpr\marginparwidth+\marginparsep\relax
]*
\raisebox{%
\ dimexpr\ baselineskip-\ totalheight\ relax
}{%
\includegraphics{examplepicture}%
}%
\end{captionbeside}
\label{fig:maincls.captionbesidetop}
\end{figure}
\end{document}
You may use such a movement not only at graphics replacements like show, but
also using \includegraphics (see [
Car05
]).
124
Chapter 3.
Figure 3.6.: A figure description which is neither above nor below, but
top beside the figure
KOMA-Script
\begin{captionofbeside}{float type }[entry ]{title }%
[placement ][width ][offset ]
. . .
\end{captionofbeside}
\begin{captionofbeside}{float type }[entry ]{title }%
[placement ][width ][offset ]*
. . .
\end{captionofbeside}
This
v3.10
environment corresponds to captionbeside in the same manner like \captionof corre-
sponds to \caption. The float type is not defined by a floating environment but by the first
mandatory argument.
komaabove
komabelow
If you use the float package the appearance of the float environments is solely defined by the
float
float
style. This includes whether captions above or below are used. In the float package there
is no predefined style which gives you the same output and offers the same setting options (see
below) as KOMA-Script. Therefore KOMA-Script defines the two additional styles komaabove
and komabelow. When using the float package these styles can be activated just like the styles
plain
, boxed or ruled defined in float. For details refer to [
Lin01
]. The style komaabove inserts
\caption
, \captionabove and \captionbelow above, whereas komabelow inserts them below
the float content.
\captionformat
In KOMA-Script there are different ways to change the formatting of the caption text. The
definition of different font styles was already explained above. This or the caption delimiter
between the label and the label text itself is specified in the macro \captionformat. In
contrast to all other \...format commands, in this case it does not contain the counter but
only the items which follow it. The original definition is:
\newcommand*{\captionformat}{:\ }
This too can be changed with \renewcommand.
Dostları ilə paylaş: |