0

After I've been doing several modification to my master my document, I just discovered the word "Chapter" has disappeared from chapter headings (\chapter{}). There's also no space between the chapter number and title as illustrated below.

Example of how a chapter heading now looks like.

The problem is I have no idea what I changed in the document for that to happen. Any ideas?

My master document has the following formatting:

%Document class used is report from the koma script
\documentclass[twoside, openright, fontsize=13pt]{scrreprt}

%Packages
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
\usepackage{graphicx}
\usepackage{fontspec}
\usepackage{sectsty}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{fancyhdr}
\usepackage[backend=biber, style=apa]{biblatex}
\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{pdfpages}
\usepackage{setspace}

%Paths
\graphicspath{ {images/} }
\addbibresource{paperpile.bib}

%Styles
\setmainfont{Calibri}
\onehalfspacing 
\pagestyle{fancy}
\fancyhead{}
\fancyhead[RO,LE]{Supporting Language Learners in Science Education}
\fancyfoot{}
\fancyfoot[LE,RO]{\thepage}
\fancyfoot[LO,CE]{Chapter \thechapter}
\fancyfoot[CO,RE]{Author}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\raggedbottom


%Thesis information
\title{Thesis Title}
\author{Author Name}
\date{\today}

%Document start
\begin{document}

2
  • 2
    Why are you using fancyhdr with a KOMA class? You should get warnings about that.
    – Johannes_B
    Commented Feb 21, 2020 at 4:36
  • As to why, I recently changed document class from from regular report to scrreprt. I had already added fancyhdr, and I have no idea how to set header and footer without it. Yes, I do get a warning, but I seem to get a normal output. I tried commenting out fancyhdr library and commands, but it does not affect the chapter headings. Still the same. :-/ Commented Feb 21, 2020 at 4:45

1 Answer 1

2

You have to enable the chapter prefix using either option chapterprefix=true or headings=chapterprefix.

Do not use package sectsty with a KOMA-Script class. Additionally I have replaced package fancyhdr by scrlayer-scrpage which is part of the KOMA-Script bundle.

\documentclass[twoside, open=right, fontsize=13pt,
  DIV=calc,% to avoid a warning
  chapterprefix=true% <- added
]{scrreprt}
%\providecommand*\Ifnumbered{\ifnumbered}% needed up to and including KOMA-Script version 3.27, see https://komascript.de/faq_deprecatedif


%Packages
\usepackage[width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
\usepackage{graphicx}
\usepackage{fontspec}
\usepackage{subcaption}% loads package caption
\usepackage[footsepline,headsepline,manualmark]{scrlayer-scrpage}% sets page style scrheadings automatically
\usepackage[backend=biber, style=apa]{biblatex}
\usepackage[english]{babel}
\usepackage{csquotes}% added
\usepackage{xcolor}
\usepackage{pdfpages}
\usepackage{scrhack}% added
\usepackage{setspace}
\usepackage{microtype}% added
\usepackage{blindtext}% only for dummy text in the MWE

%Paths
\graphicspath{ {images/} }
\addbibresource{paperpile.bib}

%Styles
\usepackage{lmodern}
\setmainfont{Calibri}
\setsansfont{Calibri}% added

\onehalfspacing
\renewcommand*\chaptermark[1]{\markboth{\Ifnumbered{chapter}{\chaptermarkformat}{}}{}}
\AfterTOCHead{\markboth{}{}}
\clearpairofpagestyles
\ohead{Supporting Language Learners in Science Education}
\ofoot*{\pagemark}
\lofoot{\leftmark}
\cofoot{Author}
\cefoot{\leftmark}
\refoot{Author}
\setkomafont{pageheadfoot}{\normalfont\normalcolor}

\raggedbottom

%Thesis information
\title{Thesis Title}
\author{Author Name}
\date{\today}

%Document start
\begin{document}
\maketitle
\tableofcontents
\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument
\end{document}

enter image description here

8
  • This seems to do the trick. However, \Ifnumbered, \AfterTOCHead, \clearpairofpagestyles apparently are unrecognized commands... I also get the follwing error message for all numbered chapter headings. (E.g. Undefined control sequence. \chapter{Introduction}.) Commented Feb 21, 2020 at 12:06
  • Which KOMA-Script version do you use? If it is a version before 3.28 you have to add \providecommand*\Ifnumbered{\ifnumbered} (I have corrected this line in the MWE). But \clearpairofpagestyles and \AfterTOCHead should be known.
    – esdd
    Commented Feb 21, 2020 at 12:23
  • I didn't actively install Koma, it was just part of the bundle. How do I check version? ..and alternatively install the newest version? Commented Feb 21, 2020 at 12:35
  • The used class and package versions can be found in the log file. You can also print the KOMA-Script version in the document using command \KOMAScriptVersion. Current KOMA version on CTAN and in MiKTeX and TexLive2019 is 3.29
    – esdd
    Commented Feb 21, 2020 at 13:42
  • I have TexLive2019 installed on Ubuntu 19.10. Apparently, I still had v3.26 of KOMA-script, so I installed the latest version (v3.29). The \chapter error messages is now gone, and \clearpairofpagestyles is no longer unknown. However, \Ifnumbered and \AfterTOCHead still are not recognized. I added \providecommand*\Ifnumbered{\ifnumbered} in the beginning, but this shouldn't be necessary with 3.29, right? As a sidenote, I noticed you didn't include the packages caption and subcaption in your example. Are these packages I no longer need? Commented Feb 21, 2020 at 20:35

You must log in to answer this question.

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