6

I messed with various chapter title formats and now that I want to go back to default i.e

Chapter 1

Title

I only get

1.Title

which misses "Chapter 1" appearing before the chapter title. I tried to use titlesec like this:

\titleformat{\chapter}[display]%
{\normalfont\huge\bfseries}{%
\chaptertitlename\ \achapter
}{20pt}{\Huge\bfseries\filcenter}%

It does look similar but not the same. How can I go back to default? I am using scrbook

2
  • I wonder a little bit about that \achapter statement.
    – user31729
    Commented Feb 17, 2014 at 20:45
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Commented Feb 17, 2014 at 21:04

2 Answers 2

3

Turn on this chapter prefix by loading the class with the chapterprefix option. For details please have a look at the »KOMA-Script« user guide.

\documentclass[chapterprefix=on]{scrbook}
\usepackage[T1]{fontenc}
\usepackage{blindtext}

\begin{document}
  \blinddocument
\end{document}

enter image description here

6
  • The »blindtext« package is only used here to create the dummy document. It is not part of the solution. Commented Feb 17, 2014 at 20:57
  • +1 I was to add it in my answer. However, I can't find a way to increase the spacing between the chapter number and the chapter title Commented Feb 17, 2014 at 20:58
  • @karlkoeller: I can't see where this should be necessary here. Commented Feb 17, 2014 at 21:00
  • Just for my knowlegde. Commented Feb 17, 2014 at 21:01
  • @karlkoeller: Ask a corresponding question. Commented Feb 17, 2014 at 21:07
3

The normal behavior with scrbook is not the one you've mentioned, but this one:

enter image description here

obtained with

\documentclass{scrbook}

\begin{document}
\chapter{Test}
\end{document}

I think you want scrbook to simulate the standard book class.

Using titlesec, which is not completely advised when using KOMA classes, you can obtain something similar (respecting the font used in KOMA classes) with the following definition:

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\sffamily}{\chaptertitlename\ \thechapter}{20pt}{\Huge}

Complete MWE:

\documentclass{scrbook}

\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\sffamily}{\chaptertitlename\ \thechapter}{20pt}{\Huge}

\begin{document}
\chapter{Test}
\end{document} 

Output:

enter image description here

The right way with scrbook is to load it with the option chapterprefix=true, as stated in Thorsten's answer.

If you want to obtain almost exactly the same format as in the book class, you can add the following lines in your preamble:

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@@makechapterhead}
  {\vskip.5\baselineskip}
  {\vskip20pt}
  {}
  {}
\makeatother

\renewcommand{\chapterheadstartvskip}{\vspace*{50pt}}
\renewcommand{\chapterheadendvskip}{\vspace*{50pt}}

\addtokomafont{chapterprefix}{\huge}
\addtokomafont{chapter}{\Huge}

MWE:

\documentclass[chapterprefix=true]{scrbook}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@@makechapterhead}
  {\vskip.5\baselineskip}
  {\vskip20pt}
  {}
  {}
\makeatother

\renewcommand{\chapterheadstartvskip}{\vspace*{50pt}}
\renewcommand{\chapterheadendvskip}{\vspace*{50pt}}

\addtokomafont{chapterprefix}{\huge}
\addtokomafont{chapter}{\Huge}

\begin{document}
\chapter{Test}
\end{document} 

Result:

enter image description here

5
  • Regarding titlesec: From your user profile and avatar I see you live on Sardinia. But your name lets me tempt to assume you understand German, so take a look on Incompatibilities between KOMA-Script and titlesec. With recent KOMA-Script one will get a warning. (I see your remark in your answer.)
    – Speravir
    Commented Feb 17, 2014 at 21:26
  • @Speravir No, I don't understand a word of German... And I perfectly know that one should never use titlesec with KOMA classes. Commented Feb 17, 2014 at 21:31
  • Aha, thanks for clarification. With your name you should learn … ;-)
    – Speravir
    Commented Feb 17, 2014 at 21:33
  • @Speravir In fact it's not my real name :-) Commented Feb 17, 2014 at 21:34
  • Oh, you are mean, ;-) Back to topic: titlesec works partially, one has to test. The problem I see is, that a function that works now maybe not work in a future release of KOMA-Script.
    – Speravir
    Commented Feb 17, 2014 at 21:36

You must log in to answer this question.

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