LaTeX forum ⇒ Page LayoutClearing 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

Clearing Headers and Adding Basic Chapter Names in Scrbook

Postby ck2018 » Wed Oct 17, 2018 1:05 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).

  1. \documentclass[12pt,openany]{scrbook}
  2. \usepackage{fontspec}
  3. \setmainfont{FreeSerif}
  4. \setsansfont{FreeSans}
  5. \setmonofont{FreeMono}
  6. \addtokomafont{disposition}{\rmfamily}
  7. \author{author}
  8. \date{date}
  9. \title{title}
  10.  
  11. \sloppy
  12. \usepackage[none]{hyphenat}
  13. \renewcommand{\chaptername}{}
  14. \renewcommand{\thechapter}{}
  15. \usepackage{paracol}
  16. \usepackage{microtype}
  17. \usepackage[
  18. paperwidth=6in,
  19. paperheight=9in,
  20. inner=0.6in,
  21. outer=0.6in,
  22. bindingoffset=0.15in,
  23. top=0.6in,
  24. bottom=0.6in,
  25. twoside]{geometry}
  26. \usepackage{scrpage2}
  27. \pagestyle{plain}
  28.  
  29.  
  30. \begin{document}
  31. \setlength{\columnsep}{3em}
  32. \setlength{\parskip}{\baselineskip}
  33. \maketitle
  34.  
  35. \chapter{I}
  36.  
  37. \begin{paracol}{2}
  38. \begin{leftcolumn}
  39. bla
  40. \end{leftcolumn}
  41. \begin{rightcolumn}
  42. bla
  43. \end{rightcolumn}
  44. \enddocument

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. :D
Last edited by ck2018 on Thu Oct 18, 2018 5:37 pm, edited 1 time in total.

User avatar
Stefan Kottwitz
Site Admin
Posts: 9392
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Thu Oct 18, 2018 2:53 pm

Welcome to the forum!

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

  1. \usepackage{scrlayer-scrpage}
  2. \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
  1. \renewcommand{\chaptername}{}
  2. \renewcommand{\thechapter}{}


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
Site admin

ck2018
Posts: 8
Joined: Wed Oct 17, 2018 12:21 pm

Postby ck2018 » Thu Oct 18, 2018 6:00 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:

  1. \usepackage{scrlayer-scrpage}
  2. \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! :D

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.

  1. \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.

  1. \usepackage{etoolbox}
  2. \makeatletter
  3. \patchcmd{\@makechapterhead}{50\p@}{-50pt}{}{}
  4. \patchcmd{\@makeschapterhead}{50\p@}{-50pt}{}{}
  5. \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.

  1. \usepackage{titlesec}
  2. \titleformat{\chapter}[display]
  3. {\normalfont\filcenter\large\bfseries}{\chaptertitlename\ \thechapter}{0pt}{\Large}
  4. \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.


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 4 guests