# [Tex/LaTex] How to get \titleformat to display chapter count number

chaptersformattingtitlesec

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?

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[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}