3

I'm working on a book, in whose design I have empty header and all information is on foot. I'm using the scrbook class for this work.

So, on the outside part of the foot I have the page numbers, while on the left page (verso) I have the title of the book, and on the right (recto) I have the name of the chapter in which I am.

I think I could do this using the scrlayer-scrpage package, but I'm confused with several issues.

I know I can use \ofoot{\pagemark} to place the page numbers in position, but if I use \cfoot I can't differentiate the odd page content from the even page.

I have reviewed several similar questions here and I am confused about the use of options in the case of \ofoot, by example. I think I understand the use of \chaptermark and \sectionmark but not \headmark. I'm also not clear when it is convenient to use \clearpairofpagestyles.

My MWE could be something like this:

\documentclass{scrbook}    
\usepackage[automark]{scrlayer-scrpage} 
\automark{section}
\clearpairofpagestyles 
\ofoot{\pagemark} 
\lcfoot{Book Title}
\rcfoot{\sectionmark} 
\usepackage{lipsum}

\title{Book Title}

\begin{document} 
\maketitle 
\chapter{First chapter} 
\lipsum[1-5]
\section{A section} 
\lipsum[1-20] 
\section{Another section}
\lipsum[1-20] 
\section{Another} 
\lipsum[11-15] 
\end{document}
3

2 Answers 2

7

\clearpairofpagestyles removes the predefined content of both pagestyle scrheadings and plain.scrheadings. There are also the commands \clearmainofpairofpagestyles and \clearplainofpairofpagestyles to clean scrheadings and plain.scrheadings respectively.

Note that with package scrlayer-scrplain pagestlye headings is an alias for scrheadings and plain is an alias for plain.scrheadings.

Twosided document: \headmark uses \rightmark for odd pages and \leftmark for even pages. Option automark is the same as \automark[section]{chapter}. Then the a new chapter sets a left mark and cleans the right mark. A new section sets a right mark.

Onesided document: There are only recto (odd) pages. \headmark uses \rightmark. Option automark is the same as \automark{chapter}. Then a new chapter sets the left and the right mark. The optional argument of \automark would be ignored until you are set autooneside=false.

To set the content in the center of the footer you can use:

  • \cfoot{<content for scrheadings>}
  • \cfoot[<content for plain>]{<content for scrheadings>}
  • \cfoot*{<content for both plain and scrheadings>}
  • \cefoot{<content for scrheadings on even pages>}
  • \cofoot{<content for scrheadings on odd pages>}
  • \cefoot[...]{...} and \cofoot[...]{...}
  • \cefoot*{...} and \cofoot*{...}

Note that chapter pages usese page style plain by default. This can be changed by redefining \chapterpagestyle.


Regarding your example:

If the book title should be in the center of the footer on all odd pages including chapter pages use

\cofoot*{Book Title}

If the chapter should be in the center of the footer on even pages use

\cefoot{\headmark}% or \leftmark

If the section should be in the center of the footer on even pages use

\cefoot{\rightmark}

Example with chapters in the footer:

\documentclass{scrbook}
\usepackage[automark]{scrlayer-scrpage}
\clearpairofpagestyles 
\ofoot*{\pagemark}
\cofoot*{Book Title}
\cefoot{\headmark}% or \leftmark
\usepackage{lipsum}

\title{Book Title}
\author{Book Author}
\begin{document} 
\maketitle 
\chapter{First chapter} 
\lipsum[1-5]
\section{A section} 
\lipsum[1-20] 
\section{Another section}
\lipsum[1-20] 
\section{Another} 
\lipsum[11-15] 
\end{document}

\chaptermark and \sectionmark are called by \chapter and \section to set the left and right marks depending on option automark or command \automark. This can be disabled using manualmark or \manualmark.

If you use \automark{section} a new section sets both the left and the right mark while chapter does not set any mark.

So in the following example \headmark prints the section in the footer:

\documentclass{scrbook}
\usepackage{scrlayer-scrpage}
\automark{section}
\clearpairofpagestyles 
\ofoot*{\pagemark}
\cofoot*{Book Title}
\cefoot{\headmark}% or \leftmark
\usepackage{lipsum}

\title{Book Title}
\author{Book Author}
\begin{document} 
\maketitle 
\chapter{First chapter} 
\lipsum[1-5]
\section{A section} 
\lipsum[1-20] 
\section{Another section}
\lipsum[1-20] 
\section{Another} 
\lipsum[11-15] 
\end{document}
6

Why and when \clearpairofpagestyles?

scrlayer-scrpage defines two new page styles scrheadings and plain.scrheadings. Together they build a pair of page styles similar to headings and plain in most classes. Both scrheadings and plain.scrheadings are predefined with page numbers (\pagemark). scrheadings is also predefined with running head elements (\headmark). Where these are placed depend on the pagestyleset and whether oneside or twoside layout. The default of pagestyleset depends on whether or not using a KOMA-Script class. See the manual for more information about pagestyleset and defaults for the the page styles.

If you only want to move, e.g., the page number from, e.g., the outer foot element of a twosided scrbook document, to the centre foot element, you could use

\ofoot*{}% or \ofoot[]{}
\cfoot*{\pagemark}% or \cfoot[\pagemark]{\pagemark}

The first line defines the outer foot element to be empty of both scrheadings and plain.scrheadings. The second line defines the centre foot element of both scrheadings and plain.scrheadings to be \pagemark, the page number element. If you omit the first line, you will nevertheless get a page number in the centre foot element, but the page number in the outer foot element will still be there.

If you want to define scrheadings from scratch, you can first clean it up defining all the elements empty using \clearmainofpairofpagestyles. This is defined as \ihead{}\chead{}\ohead{}\ifoot{}\cfoot{}\ofoot{}.

If you want to define plain.scrheadings from scratch, you can clean it up defining all the elements empty using \clearplainofpairofpagestyles. This command cannot be replaced by \ihead etc. because \ihead cannot be used to redefine the plain page style without the main page style.

If you want to define plain.scrheadings and scrheadings from scratch use \clearpairofpagestyles. It is the same like \ihead[]{}\chead[]{}\ohead[]{}\ifoot[]{}\cfoot[]{}\ofoot[]{}.

The names \clearmainofpairofpagestyles, \clearplainofpairofpagestyles, \clearpairofpagestyles are somehow general instead of specific for scrheadings and plain.scrheadings, because scrlayer-scrpage can be used to define additional pairs. In this case the commands are related to the current pair instead of the pair scrheadings + plain.scrheadings. scrheadings + plain.scrheadings is the default pair only.

What is \ifoot, \cfoot, \ofoot?

\ifoot[foo]{bar} is a shortcut of \refoot[foo]{bar}\lofoot[foo]{bar}. \ifoot means inner foot elements. \refoot means right foot element of even pages. \lofoot means left foot element of odd pages. Only twoside documents distinguish even and odd pages. With oneside documents you have only odd pages.

\cfoot[foo]{bar} is a shortcut of \cefoot[foo]{bar}\cofoot[foo]{bar}. It defines the centre foot element of both even and odd pages. So if you want to distinguish the centre foot elements of odd and even pages, you can use \cefoot and \cofoot.

\ofoot[foo]{bar} is a shortcut of \lefoot[foo]{bar}\rofoot[foo]{bar}.

There is a picture in the KOMA-Script manual to visualize the meaning of these commands:

from scrguien

What is \headmark?

\headmark is \rightmark on odd pages and \leftmark on even pages. There's not magic. It makes it easier to place the running head, e.g, in the outer margin, because you can simply use \ohead{\headmark} instead of \lehead{\leftmark}\rohead{\rightmark}.

LaTeX handles running heads by a pair of marks. The low level commands to set them are \markboth{left mark}{right mark} and \markright{right mark}. \leftmark and \rightmark are used to get these marks. Usually book and report classes use \chaptermark{…} and \sectionmark{…} to set these marks automatically for the headings page style inside the headings commands \chapter and \section. scrlayer-scrpage extends this, e.g, by a command \markleft and by \automark. \automark is used to redefine \partmark, \chaptermark, \sectionmark etc. to add automatic running heads to the given levels. See the KOMA-Script manual for more information about \automark and the other commands.

Currently there is nothing like \titlemark{…} and also no title element for \automark. So the title cannot be used as automatic running head element. You have to set it as a static or manual element. In your example, you've tried to use a static element and I will do so in the final section too.

Final

\documentclass{scrbook}    
\usepackage{scrlayer-scrpage} 
\automark[chapter]{chapter}
\clearpairofpagestyles 
\ofoot*{\pagemark}% pagemark at outer foot element of plain.scrheadings and scrheadings 
\cefoot{Book Title}% book title at centre foot element of scrheadings on even pages
\cofoot{\headmark}% head mark at centre foot element of scrheadings on odd pages
\usepackage{lipsum}

\title{Book Title}

\begin{document} 
\maketitle 
\chapter{First chapter} 
\lipsum[1-5]
\section{A section} 
\lipsum[1-20] 
\section{Another section}
\lipsum[1-20] 
\section{Another} 
\lipsum[11-15] 
\end{document}

Will produce:

enter image description here

But on the first page of a chapter page style plain.scrheadings is used and therefore the centre foot element will be empty. If you want the chapter their too, you have to replace

\cofoot{\headmark}

by

\cofoot*{\headmark}

or the equal

\cofoot[\headmark]{\headmark}

This will add the mark to the plain page style plain.scrheadings too. If you don't want the mark on all plain pages but on the chapter page, you can instead use

\renewcommand*{\chapterpagestyle}{headings}

to tell scrreprt that is has to use the headings page style instead of the plain page style for the chapter pages. Note: If you use scrlayer-scrpage the headings page style is the main page style of the current pair of page styles. By default this is scrheadings.

Instead of \headmark you can use \leftmark or \rightmark at the example above, because I've used \automark[chapter]{chapter} to make both the chapter title.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .