Example: Assume you have a single sided report but want similar running heads as in the
book example before. The chapter headings should be used as a running head as
long as the first section appears. From the first section on, the section heading
should be used. So we modify the previous example a little bit:
\documentclass{scrreprt}
\usepackage[autooneside=false]{scrlayer-scrpage}
\pagestyle{scrheadings}
\automark[section]{chapter}
\usepackage{lipsum}
\begin{document}
\chapter{Chapter Heading}
\lipsum[1-20]
\section{Section Heading}
\lipsum[21-40]
\end{document}
You can see, that we do not need a \automark* command in this case. Please
try the example also with autooneside set to true or remove the option and its
221
Chapter 5.
value. You should find a difference at the running head in the pages’ head from
page 4 on.
Please note, only loading the package does not have any effect on the fact whether automatic
or manual running heads are used or what kind of section headings do fill up the marks. Only
using an explicit option automark or manualmark or one of the commands \automark or
\manualmark
can reach a well defined state.
markcase=Wert
As already mentioned with scrlayer you may switch between manual and automatic running
heads. Using automatic running heads the corresponding marks will be filled by the section
heading commands. Some culture areas do convert the running heads into upper case letters
in opposite to the German typographic habit. The L
A
TEX standard classes do so by default.
Package scrlayer optionally provides this too. Therefor you’d use option markcase=upper
which results in a redefinition of \MakeMarkcase, a command, that is used by scrlayer for
automatic running heads.
Unfortunately L
A
TEX’s command for upper case letter typesetting, \MakeUppercase results
in an very inadequate typesetting, because it neither uses letter spacing nor does it space
balancing. One reason for this behaviour might be, that a glyph analyzing would be needed,
to incorporate the letter shapes and their combination while space balancing. Because of
this KOMA-Script author suggests to abstain from upper case letter typesetting for run-
ning heads. This could be achieved using markcase=used. Nevertheless, some classes would
add \MarkUppercase or even TEX command \uppercase into the running heads. For such
cases option markcase=noupper can be used. This will also deactivate \MakeUppercase and
\uppercase
inside the running heads.
You can find all valid values for markcase in
table 5.2
.
\leftmark
\rightmark
\headmark
\pagemark
If you want to differ from the predefined page styles, usually you need to decide, where to
place the marks’ contents. With \leftmark you can state the contents of the left mark.
Similar you can use \rightmark to state the contents of the right mark. For more informa-
tion about some intricacies of this see the further description of \rightmark in
section 21.1
,
page 386
.
Somehow easier would be usage of \headmark. This extension of scrlayer aliases either
\leftmark
or \rightmark depending on whether the current page is even or odd.
Strictly thought command \pagemark is not involved by TEX’s mark mechanism. It is only
used to output a formatted page number. The font of element pagenumber will be used for
222
Chapter 5.
Table 5.2.: Possible values for option markcase to select upper/lower case letter typesetting in auto-
matic running heads
lower
redefines \MakeMarkcase to convert the automatic running heads into lower case
letters using \MakeLowercase (lower case typesetting).
upper
redefines \MakeMarkcase to convert the automatic running heads into upper case
letters using \MakeUppercase (upper case typesetting).
used
redefines \MakeMarkcase to use automatic running heads without any case changes.
ignoreuppercase
, nouppercase, ignoreupper, noupper
redefines not only \MakeMarkcase but also locally to the running heads
\MakeUppercase
and \uppercase to leave the automatic running heads unchanged.
the output. This can be changed using command \setkomafont or \addtokomafont (see also
section 3.6
,
page 53
).
Example: Assume you want to use a left aligned running head and right aligned page number
in the head of the pages of a document in single side layout. The following minimal
but working examples would do so:
\documentclass{scrreprt}
\usepackage{blindtext}
\usepackage[automark]{scrlayer-scrpage}
\pagestyle{scrheadings}
\ihead{\headmark}
\ohead[\pagemark]{\pagemark}
\chead{}
\cfoot[]{}
\begin{document}
\blinddocument
\end{document}
Here package blindtext with its command \blinddocument has been used to easily
generate content for an example document.
Commands \ihead and \ohead have been used to place the wanted marks. Al-
though the page mark will be place not only to pages in page style scrheadings
but using the optional argument also to pages in page style plain.scrheadings.
Because of both page styles already have marks in the middle of the page head
and page foot, those elements will be cleared using \chead and \cfoot with empty
223
Chapter 5.
arguments. Alternatively you’d use \clearpairofpagestyles before \ihead. You
will find a description of this command in
section 18.2
.
Please note, that the empty optional argument of \cfoot in the example above is not the
same like omitting the optional argument. Please try it out and have a look at the difference
in the footer of the first page.
If all the mark features described above are not sufficient, experienced users can find more
of them on
page 362
. For example, you can find there \leftfirstmark and \rightbotmark,
which seem to be useful for lexicon like documents.
\partmarkformat
\chaptermarkformat
\sectionmarkformat
\subsectionmarkformat
\subsubsectionmarkformat
\paragraphmarkformat
\subparagraphmarkformat
Usually the KOMA-Script classes and package scrlayer use these commands internally to bring
the section numbers into wanted form and additionally they support the \autodot mechanism
of the KOMA-Script classes. If wanted these commands may be redefined to get another form
of section numbers.
Example: Assume you do not want section numbers but section heading text only in the
running head. So:
\renewcommand*{\sectionmarkformat}{}
would be a simple solution for this.
\partmark{Text }
\chaptermark{Text }
\sectionmark{Text }
\subsectionmark{Text }
\subsubsectionmark{Text }
\paragraphmark{Text }
\subparagraphmark{Text }
Most classes use these commands to setup marks corresponding to the section commands.
Thereby the only argument is the text without the number of the section heading, that should
be used for the running head. For the number simply the number of the current section level
will be used, if the current level uses numbers.
Unfortunately, not all classes use such a command for every section level. The standard
classes for example do not call \partmark. The KOMA-Script classes support such commands
for all section levels and therefore also use \partmark.
224
Chapter 5.
If users redefine these commands, they should take care to also use the counter secnumdepth
for the test whether or not the section level should output a number, even in the case the user
does not change counter secnumdepth himself, because packages and classes may do so locally
and rely on correct handling of secnumdepth.
However, package scrlayer redefines these commands whenever you use \automark or
\manualmark
or the corresponding options, to activate or deactivate the wanted running heads.
\markleft{left mark }
\markright{right mark }
\markboth{left mark }{right mark }
Independent of whether currently manual or automatic running heads are active, you may
change the contents of the left mark or the right mark at any time using these com-
mands. You should note, that the resulting contents of \leftmark is the left mark of the
last \markleft or \markboth command of the current page. In opposite to this the resulting
contents of \rightmark is the right mark of the first \rightmark or \markboth command
of the current page.
If you are using manual running heads, the marks will stay valid until one of the corre-
sponding commands will be used again. If you are using automatic running heads the marks
can loose their validity with the next section heading depending on the configuration of the
automatism.
You may also use these commands together with the star versions of the section commands.
Example: Assume you are using a preface with several pages just before the table of contents,
that should not have an entry at the table of contents itself. Because of using a
separation line at the page head, you want also a running head for this preface:
\documentclass[headsepline]{book}
\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\usepackage{blindtext}
\begin{document}
\chapter*{Preface}
\markboth{Preface}{Preface}
\blindtext[20]
\tableofcontents
\blinddocument
\end{document}
First of all this seems to produce the wanted result. But have a closer look: In
difference to the other running heads “Preface” is not in upper case letters. But
you can fix this easily:
\documentclass[headsepline]{book}
\usepackage{scrlayer-scrpage}
225
Chapter 5.
\pagestyle{scrheadings}
\usepackage{blindtext}
\begin{document}
\chapter*{Preface}
\markboth{\MakeMarkcase{Preface}}{\MakeMarkcase{Preface}}
\blindtext[20]
\tableofcontents
\blinddocument
\end{document}
Using command \MakeMarkcase results in getting the same letter case as for au-
tomatic running heads.
Now, let’s move command \tableofcontents in front of the preface. Let’s remove
the \markboth command too. You’ll realise, that the preface now has the running
head “CONTENTS”. This is because of a quirk of \chapter* (see also
section 3.16
on
page 94
). If in such cases the running head should be removed, \markboth with
two empty arguments would be useful:
\documentclass[headsepline]{book}
\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\usepackage{blindtext}
\begin{document}
\tableofcontents
\chapter*{Preface}
\markboth{}{}
\blindtext[20]
\blinddocument
\end{document}
headwidth=width :offset :offset
footwidth=width :offset :offset
By default the page head and foot are as wide as the type area. This can be changed using
these KOMA-Script options. The value width is the wanted width of the head respective
foot. The offset defines how much the head or foot should be moved towards the outer — in
single side layout to the right — margin. All three
v3.14
values are optional and can be omitted. If
you omit a value, you can also omit the corresponding colon left beside. If there is only one
offset
it is used for both, odd and even pages. Otherwise, the first offset is used for odd
and the second offset for even pages in two-side mode. If you only use one value without
colon, this will be the width .
For the width as well as the offset you can use any valid length value, L
A
TEX length, TEX
dimension or TEX skip. In addition you may use an ε-TEX dimension expression with basic
arithmetic operations +, -, *, /, and parenthesis. See [
Tea98
, section 3.5] for more information
226
Chapter 5.
on such expressions. See
section 5.1
for more information on using, e. g., a L
A
TEX length as an
option value. The width can alternatively be one of the symbolic values shown in
table 5.3
.
By default the head and the foot are as wide as the text area. The default offset depends
on the used width . In single side layout generally the half of the difference of width and the
width of the text area will be used. This results in horizontal centring the page head above
or the page footer below the text area. In difference to this, in double side layout generally a
third of the difference of offset and the width of the text area will be used. But if width is
the width of the whole text area plus the marginal note column, default offset will be zero.
If you think, this is complicated, you should simply use an explicit offset .
headtopline=thickness :length
headsepline=thickness :length
footsepline=thickness :length
footbotline=thickness :length
The KOMA-Script classes provide only a separation line below the page head and above the
page head, and you may only switch each of these lines on or off. But package scrlayer-scrpage
provides four such horizontal lines: one above the head, one below the head, one above the
foot, and one below the foot. And you can not only switch them on an off, but also configure
the length and thickness of each of these lines.
Both values are optional. If you omit the thickness , a default value of 0.4 pt will be used,
a so called hairline. If you omit the length , the width of the head respective the foot will be
used. If you omit both, you can also omit the colon. If you use only one value without colon,
this will be the thickness .
For sure, the length can be not only shorter than the current width of the page head
respectively the page foot, but also longer. See additionally options ilines, clines, and
olines
later in this section.
Beside the length and thickness also the colour of the lines can be changed. First of all the
colour depends on the colour of the head or foot. But independent from those or additional to
them the settings of the corresponding elements headtopline, headsepline, footsepline,
and footbotline will be used. You may change these using command \setkomafont or
\addtokomafont
(see
section 3.6
from
page 53
). By default those settings are empty, which
means no change of the current font or colour. Change of font in opposite to colour would not
make sense and is not recommended for these elements.
Package scrpage2 has additionally to the options that do not take any values, also four
commands \setheadtopline, \setheadsepline, \setfootsepline, and \setfootbotline.
These have a first optional argument for the length , a second mandatory argument for
the thickness , and a third optional argument for the setting of font or colour. Package
scrlayer-scrpage does also provide those commands. Nevertheless, these commands are depre-
cated and should not be used any longer. To get it clear: These commands have never been
made to switch the lines on or off. They have been made to configure already switched on
lines. Users often ignored this!
227
Chapter 5.
Table 5.3.: Possible symbolic values for the width value of options headwidth and footwidth
foot
the current width of the page foot
footbotline
the current length of the horizontal line below the page foot
footsepline
the current length of the horizontal line above the page foot
head
the current width of the page head
headsepline
the current length of the horizontal line below the page head
headtopline
the current lenght of the horizontal line above the page head
marginpar
the current width of the marginal note column including the distance between the
text area and the marginal note column
page
the current width of the page considering a binding correction of package typearea
(see option BCOR in
section 2.6
,
page 30
)
paper
the current width of the paper without considering a binding correction
text
the current width of the text area
textwithmarginpar
the current width of the text area plus the marginal note column including the
distance between them (note: in this case and only in this case the default of offset
would be zero)
228
Chapter 5.
plainheadtopline=simple switch
plainheadsepline=simple switch
plainfootsepline=simple switch
plainfootbotline=simple switch
These options can be used to inherit the settings of the lines also for the plain page style.
Possible values for simple switch can be found in
table 2.5
on
page 38
. If a option is
activated, the plain page style will use the line settings given by the options and commands
described above. If the option is deactivated, the plain will not show the corresponding line.
ilines
clines
olines
You have already been told that the horizontal lines above or below the page head or foot can
be shorter or longer than the page head or page foot itself. Only the answer to the question
about the alignment of those lines is still missing. By default all lines are left aligned at single
side layout and aligned to the inner margin of the head or foot at double side layout. This is
same like using option ilines. Alternatively, you can use option clines to centre the lines
in the head or foot, or option olines to align them right respectively to the outer margin.
229
Chapter 6.
The Day of the Week Using scrdate
With version 3.05a the functionality of this package enhanced a lot. Beside of the current day
of the week this package provides the day of the week of every date of the Gregorian calendar
now.
\CenturyPart{ year }
\DecadePart{year }
The
v3.05a
command \CenturyPart offers the value of the century digits — hundreds and thou-
sands — of a year . The command \DecadePart in difference offers the other digits which are
the units and tens. The number of digits of year does not care. The value may be assigned
to a counter or may be used for calculations, i. e., using \numexpr. For output of an Arabic
number of the value prefix it with \the .
Example: You want to calculate and output the century of the current year.
The year \the\year\ is the year \the\DecadePart{\year}
of the \engord{\numexpr\CenturyPart{\year}+1\relax} century.
The result would be:
The year 2016 is the year 16 of the 21st century.
Package engord has been used for this example. See [
Obe10
] for more information.
Please note, that within used method of counting the year 2000 is the year 0 — and therefore
the first year — of the 21st century.
\DayNumber{year }{month }{day }
\ISODayNumber{ISO-date }
These
v3.05a
two commands offers the value of the number of the day of the week of any date. The
differ only in the kind of date declaration. Command \DayNumber needs year , month , and
day
as separate parameters. Command \ISODayNumber expects an ISO-date as a single
argument. The expected format of the ISO-date is: year -month -day . It does not matter
whether month or day have one or two digits. The result of both commands may be assigned
to a counter or used for calculations, i. e., using \numexpr. For output of an Arabic number
of the value prefix it with \the.
Example: You want to know the number of the day of the week of the 1st May 2027.
The 1st~May~2027 has \the\ISODayNumber{2027-5-1}
as the number of the day of the week.
The result will be:
230
Chapter 6.
The 1st May 2027 has 6 as the number of the day of the week.
A special feature is to walk a number of days into future or past from a given date.
Example: You want to know the number of the day of the week, that will be in 12 days and
that will be 24 days before the 24th December 2027.
In 12~days the number of the day of the week
will be \the\DayNumber{\year}{\month}{\day+12} and
24~days before the 24th~December~2027 it will be
\the\ISODayNumber{2027-12-24-24}.
The result may be, e. g.:
In 12 days the number of the day of the week will be 3 and 24 days
before the 24th December 2027 it will be 2.
The days of the week are numbered: Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3,
Thursday = 4, Friday = 5, and Saturday = 6.
\DayNameByNumber{number of the day of the week }
\DayName{year }{month }{day }
\ISODayName{ISO-date }
Usually
v3.05a
you do not want to know the number of the day of the week, but the name of the
day of the week. Because of this, the command \DayNameByNumber offers the name of the day
of the week corresponding with a number. The number may be the result of \DayNumber or
\ISODayNumber
. The two commands \DayName and \ISODayName directly offer the name of
the day of the week of a given date.
Dostları ilə paylaş: |