30

This is what I want:

Chapter 1 : Introduction

but I always get:

Chapter 1

Introduction

How do I do this?

doncherry
  • 54,637
Verly
  • 939

2 Answers2

33

You don't say which document class you are using, but for the standard classes, you can adjust these parameters easily with the titlesec package.

\documentclass{book}
\usepackage{titlesec}
\titleformat{\chapter}[hang] 
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter:}{1em}{} 

\begin{document}
\chapter{A chapter}
\section{A section}
\end{document}

output of code

You can change the font size as needed, and if you need to change the spacing, there is also a command for that.

Alan Munn
  • 218,180
  • If I am using scrbook, and I need the prefix to be CHAPTER \thechapter: Title on the same line without line break, how can I do it without loading titlesec? – Diaa Nov 29 '16 at 09:32
  • @DiaaAbidou see the other answer. scrbook is part of the KOMA classes. – Alan Munn Nov 29 '16 at 13:29
  • @AlanMunn Thanks for your response, but I had a problem when using this approach as shown in my question. – Diaa Nov 29 '16 at 13:31
  • How can one reduce the gap between chapter and section? – Adam Jun 09 '19 at 07:40
  • 1
    @Adam You can use \titlespacing*{\chapter}{<leftsep>}{<beforesep>}{<aftersep>}. So e.g. \titlespacing*{\chapter}{0pt}{0pt}{0pt} would reduce the space after the title to zero. For chapters, this only works if you have also used the \titleformat command to define the chapter format. – Alan Munn Jun 09 '19 at 14:48
10

If you use a KOMA-class you will not need the package titlesec:

\documentclass[chapterprefix=false]{scrreprt}
\makeatletter
\renewcommand*{\chapterformat}{%
  \mbox{\chapapp~\thechapter\autodot:\enskip}%
}
\makeatother
\begin{document}
\chapter{A chapter}
\section{A section}
\end{document}
Marco Daniel
  • 95,681