## LaTeX forum ⇒ Page Layout ⇒ Clearing Headers and Adding Basic Chapter Names in Scrbook

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
ck2018
Posts: 8
Joined: Wed Oct 17, 2018 12:21 pm

I'm trying to:

• clear the header in order to stop the names of my chapters appearing in the header of every page after the first;
• make the chapter name appear centered on the first page of the chapter as a single Roman numeral in the same font as the body text (but in bold).
I've tried numerous ways (e.g. fancyhdr) of changing the header, but they all seem to have incompatibilities with other things that I'm using (e.g. koma fonts).


My latest attempt to fix this involves calling \pagestyle{plain}, which did suppress the headers but also removed the page numbers (which I would have expected from {empty}) and resulted in error message:

Package scrpage2' is obsolete.\MessageBreak
You should not longer use package scrpage2'.\MessageBreak
You should replace usage of package scrpage2'\MessageBreak
by scrlayer-scrpage'}

The chapter headings (i.e. the Roman numerals) look the way I want them to in terms of size and font, but they are indented (because I've suppressed the number that appears automatically) and are not centered. I'm currently using XeTex, but everything seems to work in LuaTex as well (with the same error message). After hours of experimenting with various options only to find that they are either incompatible with other elements or generate problems of their own, I'd appreciate any help.
Last edited by ck2018 on Thu Oct 18, 2018 5:37 pm, edited 1 time in total.

Stefan Kottwitz
Posts: 9392
Joined: Mon Mar 10, 2008 9:44 pm
Welcome to the forum!

The error is actually just a warning. It means that you should remove \usepackage{scrpage2}. Add instead:

\usepackage{scrlayer-scrpage}\pagestyle{scrplain}

Forget fancyhdr. scrlayer-scrpage is the suitable replacement for the scrbook class and KOMA-Script in general. You can read about it in the scrguien manual.

This

is strange. It breaks things, actually it seems you don't want automatically numbered chapters at all, but you want big Roman numbers as centered kind of headings, right? So perhaps do it without chapters, especially if you don't need references to chapters and no table of contents with chapters.

Stefan

ck2018
Posts: 8
Joined: Wed Oct 17, 2018 12:21 pm
Stefan Kottwitz wrote:Welcome to the forum!

Thanks!

Stefan Kottwitz wrote:The error is actually just a warning. It means that you should remove \usepackage{scrpage2}. Add instead:

\usepackage{scrlayer-scrpage}\pagestyle{scrplain}

Forget fancyhdr. scrlayer-scrpage is the suitable replacement for the scrbook class and KOMA-Script in general. You can read about it in the scrguien manual.

Being overcautious, I usually treat a warning as being as good as an error!

That works, but the page numbers are now falling off the page; only the top half of each number is visible. I had actually just stumbled across a workaround: changing the document class and compiling in XeLaTex.

\documentclass[twoside]{report}

This removes the header but retains the page-numbering. It evens removes the white space before the Roman numerals, which was a consequence of suppressing the auto-generating chapter-number. It doesn't center the numerals, and the 50pt space above them is annoying, but it's certainly a big improvement.

...actually it seems you don't want automatically numbered chapters at all, but you want big Roman numbers as centered kind of headings, right? So perhaps do it without chapters, especially if you don't need references to chapters and no table of contents with chapters.

You're right that I want centered Roman numerals as headings; however, I would like to have a contents page. I'll get there...

EDIT:

This kind of works for the chapter headings.

\usepackage{etoolbox}\makeatletter\patchcmd{\@makechapterhead}{50\p@}{-50pt}{}{}\patchcmd{\@makeschapterhead}{50\p@}{-50pt}{}{}\makeatother

It doesn't center them, and I'll have to find out how to remove the space below at some point. Ideally, the chapter-heading should appear on the line below the top margin and skip only line below. There's no need for all this extra space.

SECOND EDIT:

This works even better.

\usepackage{titlesec}\titleformat{\chapter}[display]    {\normalfont\filcenter\large\bfseries}{\chaptertitlename\ \thechapter}{0pt}{\Large}\titlespacing*{\chapter}{0pt}{0pt}{0pt}

It centers the chapter and removes the unnecessary space below it, but despite what I read in the manual, it doesn't seem to remove the space above it. Still, it's an improvement.