# How to get \titleformat to display chapter count number?

I have the following MWE:

\documentclass[twoside]{book}

\usepackage[pagestyles]{titlesec}
\usepackage{lipsum}
\usepackage{fancyhdr}

\titleformat{\chapter}[display]
{\normalfont\bfseries}{}{10pt}{\Huge}
\newpagestyle{mystyle}{

\begin{document}

\pagestyle{mystyle}
\chapter{A chapter}
\lipsum[1-40]

\end{document}


This successfully removes the word 'chapter' from the chapter titles. However I want to include the chapter count number as well. Something like '1. Introduction'. How do I do this using titlesec?

• Do you want chapter number and chapter title on separate lines? – Bernard Jun 30 '17 at 12:52

You shouldn't use the display style if you want the chapter label on the same line as the chapter title. Use the default hang style, or blockif you want to centre it. Note twoside isn't necessary: it's the default in the book class. Also don't load fancyhdr if you want to use titlesec with the pagestyles option, which loads titleps, and it may conflict with fancyhdr.

Here is a code:

\documentclass{book}

\usepackage[a4paper, width=150mm, vmargin=25mm, headheight=28pt, bindingoffset=6mm]{geometry}
\usepackage[pagestyles]{titlesec}
\usepackage{lipsum}

\titleformat{\chapter}%
{\normalfont\bfseries\Huge}{\thechapter.}{10pt}{}
\newpagestyle{mystyle}{
\setfoot{}{\thepage}{}}

\begin{document}

\pagestyle{mystyle}
\chapter{A Chapter}
\lipsum[1-5]
\section{A First Section}
\lipsum[6-20]

\end{document}


• Thanks. I want all the page numbers centered at the bottom. Also I want the custom heading to be centered, on both odd and even pages. – user131526 Jun 30 '17 at 13:53
• I've updated my answer. Is it like you want? – Bernard Jun 30 '17 at 14:07
• thanks! I am trying to achieve the same result using fancyhdr, which i find easier to tweak and more intuitive. Stay tuned for my next question! – user131526 Jun 30 '17 at 14:18
• You find the \leftmark/rightmark:\markboth system more intuitive that \sectiontitleand \chaptertitle?!!! – Bernard Jun 30 '17 at 14:21
• ok. Maybe not, these are all equally confusing! – user131526 Jun 30 '17 at 16:32

Include \thechapter.\quad as part of your title setting:

\documentclass{book}

\usepackage{titlesec}

\titleformat{\chapter}[display]

• @PintoDoido: Use \thechapter~\chaptertitle in the header setting. – Werner Jun 30 '17 at 12:50
• @Werner: For your code, the default [hand] style is enough. [display] is to be used when chapter label and chapter title are on separate lines. – Bernard Jun 30 '17 at 12:52