2

Using code from Remove "chapter #" from the chapter title but keep chapter number in the table of contents

This removes the Chapter # from the header, however can I have the chapter number inserted within the chapter name? I.e 1 - Introduction etc. To match the table of contents.

1 Answers1

4

Here's one possible solution using the titlesec package:

\documentclass{report}
\usepackage{titlesec}

\titleformat{\chapter}[block]
  {\normalfont\huge\bfseries}{\thechapter}{1em}{}

\begin{document}

\chapter{Test Chapter}

\end{document}

enter image description here

If the dash between the number and title is desired:

\documentclass{report}
\usepackage[explicit]{titlesec}

\titleformat{\chapter}[block]
  {\normalfont\huge\bfseries}{}{0em}{\thechapter\,--\,#1}

\begin{document}

\chapter{Test Chapter}

\end{document}

enter image description here

Or, without the titlesec package, redefining \@makechapterhead:

\documentclass{report}
\usepackage[explicit]{titlesec}

\makeatletter
\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries\thechapter\,--\,%
    \fi
    \interlinepenalty\@M
    \huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\makeatother

\begin{document}

\chapter{Test Chapter}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128