0

When compiling a document using the scrbook Koma class, the running headers on the left side of the page do not vary with the content on the page and instead uniformly read simply, "Content" throughout a 200+ page document. How can I change this behavior to display either a chapter number or those sections on the page?

I looked at the KOMA manual (pgs.73,86) and while there is a good deal of information about formatting the headers, there is very little about the contents of the headers. chapterprefix=true has no effect, i.e.,

\KOMAoptions{headings=small,chapterprefix=true}

The right side running headers are fine.

I hesitate to post a MWE because my code is a mess and I have a feeling that there is a simple answer unrelated to the code.

  • 1
    It is very unlikely that there is an answer, simple or not, unrelated to the code. However, if I had to hazard a guess, I'd guess that you do not use \chapter in your document. If not, try scrartcl. – cfr Oct 11 '15 at 12:42
  • I used sections instead. I can't really use the article class because this is book, i.e., needing two-sided facing pages, binding correction, Koma-calculated text block, etc. – user26732 Oct 11 '15 at 12:53
  • Well, you can have those things with scrartcl as well. But if it is a book, then scrbook is more appropriate but you should use \chapter rather than \section. – cfr Oct 11 '15 at 13:05
  • Adding \chapter {text} indeed eliminates the repeating leftmark "Contents" which refers to the Table of Contents. The problem with using scrartcl is that the text then immediately starts throwing other errors, such as halting on \frontmatter. And identifying chapters alters the page count substantially because the first page of a chapter is formatted with a good deal of white space. Is there a way to have the leftmark in scrbook contain text referring to the particular section on a particular page? – user26732 Oct 12 '15 at 10:02
  • As I say in my other comment, that's a bad solution: you are going to have all kinds of other issues as well. – cfr Oct 12 '15 at 10:32
2

The problem is almost certainly not 'unrelated to the code'. This is a blind guess. It this isn't the problem, please provide a proper minimal example (not your whole document - the minimum needed to reproduce the problem).


If you use a book-type class, then the class expects your document to use chapters and the table of contents will be an unnumbered chapter, by default. The default content of headers will include the chapter on the left and the section on the right.

book headers

\documentclass{scrbook}
\KOMAoptions{headings=small}
\usepackage{kantlipsum}
\begin{document}
\tableofcontents
\chapter{A chapter}
\kant[1]
\section{A section}
\kant[2]
\section{Another}
\kant[3-4]
\section{A section}
\kant[5-9]
\chapter{Another chapter}
\kant[10]
\section{Another}
\kant[11-15]
\end{document}

If you do not include any \chapters, then the headers on the left never change. Since \tableofcontents updates the header, but nothing else does, the title of the contents will persist throughout:

persistent contents

\documentclass{scrbook}
\KOMAoptions{headings=small}
\usepackage{kantlipsum}
\begin{document}
\tableofcontents
\section{A section}
\kant[1-3]
\section{Another one}
\kant[4-6]
\section{And another}
\kant[7-9]
\end{document}

A book-style class is not appropriate for a document without chapters. If your document has only sections, try scrartcl instead.

|improve this answer|||||
  • Is there a way to mirror on the left side of the page the content in the right chapter mark in the scrbook class? – user26732 Oct 12 '15 at 10:05
  • @user26732 Yes... See the documentation for KOMA covering scrlayer-scrpage, for example. But that's a bad solution because other things here are going to be wrong. (E.g. the fact that all your sections are part of chapter 0 and that the ToC is alone in being a chapter.) – cfr Oct 12 '15 at 10:30
  • As to the book class being inappropriate for a book without chapters, what about a dictionary? While a dictionary might have chapters, these are not really an aid in navigation. The same is true for many law texts--there the section numbers take the place of alphabetization in a dictionary. Perhaps Koma's scjura package\class could be used for this, but unfortunately it has not been translated. – user26732 Oct 14 '15 at 9:39
  • A dictionary is really a special case requiring a specialised format of its own. I wouldn't use scrbook but I wouldn't use scrartcl either. – cfr Oct 14 '15 at 15:03
  • Legal texts are sometimes similar to dictionaries which is why I thought scrjura might be a possible solution, but without access to the manual, who can tell? – user26732 Oct 15 '15 at 16:12
1

As @cfr already mentioned you have to use chapters with scrbook. But with KOMA-script version 3.18 or newer (current ist 3.19a) you could change the behavior of chapter titles to be section like.

Code:

\documentclass{scrbook}
\RedeclareSectionCommand[
  style=section,
  indent=0pt,
  font=\Large,
  afterskip=2.3ex plus .2ex,
  beforeskip=-3.5ex plus -1ex minus -.2ex
]{chapter}

\usepackage[automark]{scrlayer-scrpage}
\lehead{\leftfirstmark}
\rohead{\leftbotmark}

\usepackage{kantlipsum}
\begin{document}
\begin{titlepage}
Title
\end{titlepage}
\tableofcontents
\chapter{A chapter}
\kant[1]
\section{A section}
\kant[2]
\section{Another}
\kant[3-4]
\section{A section}
\kant[5-9]
\chapter{Another chapter}
\kant[10]
\section{Another}
\kant[11-15]
\end{document}

enter image description here


Disclaimer: I do not recommend the following code but if you really would like to use scrbook without chapters you could try the following (needs at KOMA-Script version 3.16 or newer):

\documentclass[listof=leveldown,headings=optiontotocandhead]{scrbook}
\deftocheading{toc}{\addsec[tocentry={}]{\contentsname}}

\usepackage{chngcntr}
\counterwithout{section}{chapter}

\usepackage{scrlayer-scrpage}
\automark{section}
\lehead{\leftfirstmark}
\rohead{\leftbotmark}

\usepackage{kantlipsum}
\begin{document}
\begin{titlepage}
Title
\end{titlepage}
\tableofcontents
\section{A section}
\kant[1]
\subsection{A subsection}
\kant[2]
\subsection{Another}
\kant[3-4]
\subsection{A subsection}
\kant[5-9]
\section{Another section}
\kant[10]
\subsection{Another}
\kant[11-15]
\end{document}
|improve this answer|||||
  • \RedclareSectionCommand threw this error message: "!Undefined control sequence. %new line% <recently read> \RedclareSectionCommand I can't get past this error ( or for that matter, paste code in a comment). – user26732 Oct 12 '15 at 12:15
  • And if there's a way past the \RedeclareSectionCommand error (and I assume there is) there is still the problem of manually adding 200+ pages of leftmark headers, i.e., \chapter{section text 1}, \chapter {section text 2}, etc. Is there an off the shelf package that might work? – user26732 Oct 12 '15 at 12:18
  • As I have mentioned you need KOMA-Script version 3.18 or newer to run the code. Current verison on CTAN and in TeXLive and MiKTeX is 3.19a. – esdd Oct 12 '15 at 13:52
  • While this is not a solution, it's a work around: I can add \chaptermark {name of book} after the Table of Contents without defining a new chapter. Adding \let\chaptermarkformat\relax (from this source: latex-community.org/forum/viewtopic.php?f=47&t=9368) eliminates the chapter number. The result is not functional but only decorative, but at least the typeset page doesn't look like it is displaying a mistake. – user26732 Oct 14 '15 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.