2

Using the scrbook class, how do I place the chapter title under the chapter number? Here's a MWE

\documentclass{scrbook}
\usepackage{xcolor, graphicx}
\usepackage[showframe]{geometry}

\definecolor{chaptergrey}{rgb}{0.7,0.7,0.7}

\let\raggedchapter\raggedleft
\addtokomafont{disposition}{\normalfont}
\setkomafont{chapter}{\LARGE}

\renewcommand*{\chapterformat}{%
\scalebox{5}{\color{chaptergrey}\thechapter}%
}
\begin{document}
\chapter{A chapter}
\end{document}

The corresponding output is

enter image description here

And what I'd like to have is something like this

enter image description here

Once I can do that, how do I change the vertical space between the two?

EDIT:

\documentclass[chapterprefix]{scrbook}
\usepackage{xcolor, graphicx}
\definecolor{chaptergrey}{rgb}{0.7,0.7,0.7}

\let\raggedchapter\raggedleft
\addtokomafont{disposition}{\normalfont}
\setkomafont{chapter}{\LARGE}

\renewcommand*{\chapterformat}{%
\scalebox{5}{\color{chaptergrey}\thechapter}%
}

%\makeatletter
%\renewcommand{\@chapapp}{}
%\makeatother

\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}

\fancypagestyle{theorems}{
\renewcommand{\chaptermark}[1]{\markboth{##1}{}}
\fancyhead[LO, RE]{\itshape\nouppercase\leftmark}
\fancyhead[LE, RO]{\thepage}
\fancyfoot{}}

\pagestyle{theorems}
\begin{document}
\tableofcontents
\chapter{A chapter}
\newpage
a
\end{document}

Corresponding heading

enter image description here

5
  • Please note: \usepage[showframe]{geometry} changed the size of the text area and margins. If you don't want this, you should either use \usepackage{showframe} instead of loading geometry or add option pass. Mar 24, 2019 at 15:28
  • Usage of fancyhdr together with a KOMA-Script class is not recommended. It needs extra user work to not break several features of KOMA-Script (e.g. to respect \chaptermarkformat). See the warning message of KOMA-Script. Mar 24, 2019 at 15:35
  • Got it. Should I open another post asking how to create that heading with a KOMA-Script class or do you have a quick fix?
    – noibe
    Mar 24, 2019 at 15:37
  • Use scrlayer-scrpage as recommended by the warning in the log-file. Mar 24, 2019 at 15:44
  • Thanks for the help, I posted a new question as I'm having a few issues with scrlayer-scrpage package.
    – noibe
    Mar 24, 2019 at 16:08

1 Answer 1

2

You can use option chapterprefix if you want a chapter heading with a prefix line, that has only the formatted number:

\documentclass[chapterprefix]{scrbook}
\usepackage{xcolor, graphicx}
\usepackage[showframe]{geometry}

\definecolor{chaptergrey}{rgb}{0.7,0.7,0.7}

\let\raggedchapter\raggedleft
\addtokomafont{disposition}{\normalfont}
\setkomafont{chapter}{\LARGE}

\renewcommand*{\chapterformat}{%
\scalebox{5}{\color{chaptergrey}\thechapter}%
}
\renewcommand*{\chaptermarkformat}{\thechapter\autodot\enskip}% If you don't want the chapter name in the running head.
\begin{document}
\chapter{A chapter}
\end{document}

enter image description here

There are already examples for similar chapter headings like:

Please avoid using fancyhdr with KOMA-Script classes. As the warning message tells you, using fancyhdr breaks several features of KOMA-Script classes. Use scrlayer-scrpage instead. If you want running head aligned to the inner margin and page numbers aligned to the outer margins and if the chapter titles in the running head should be without chapter numbers, you can use:

\renewcommand*{\chaptermarkformat}{}% If you want running heads without
                                % chapter number.

\usepackage[automark]{scrlayer-scrpage}
\clearpairofpagestyles
\ihead*{\pagemark}% page number also on plain pages
\ohead{\headmark}
5
  • It works, but now the headings are 'Chapter 1 A chapter', while before they were simply '1 A chapter'. How do I fix that?
    – noibe
    Mar 24, 2019 at 15:11
  • @noibe Not with my example and KOMA-Script 3.26b, which is the current release on CTAN, in TeX Live and MiKTeX. Mar 24, 2019 at 15:25
  • I have the same version. I found a workaround through \makeatletter\renewcommand{\@chapapp}{}\makeatother
    – noibe
    Mar 24, 2019 at 15:28
  • @noibe After the shown redefinition of \chapterformat KOMA-Script cannot produce the output you are talking about. And redefining \@chapapp would not remove the space. So you are doing something you are not telling us. And note, \appendix would again redefine \@chapapp. Mar 24, 2019 at 15:30
  • That's possible. I posted an example showing my problem in my original question.
    – noibe
    Mar 24, 2019 at 15:33

You must log in to answer this question.

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