[Tex/LaTex] titlesec: How to get current chapter number when using [hang]

titlesec

I'm using the titlesec package so my chapter heading looks like:

1. METHODOLOGY

According to this package documentation, I must use [hang] to get the chapter number and title in the same line. However, I cannot get the number to appear (only the chapter label is displayed).

This is my code:


\documentclass{book}
\usepackage{lipsum}
\usepackage{titlesec}

\titleformat{\chapter}[hang]{\normalfont\bfseries\huge\uppercase}{\thechapter. }{15pt}{}

\begin{document}

 \chapter{Methodology}
 \lipsum[2]

 \chapter{Results}

 \lipsum[2]

\end{document}

Do you see anything wrong with it?

Best Answer

There is nothing wrong, apart from \uppercase that should never be used.

\documentclass{book}
\usepackage{lipsum}
\usepackage{titlesec}

\titleformat{\chapter}[hang]
  {\normalfont\bfseries\huge\raggedright}
  {\thechapter. }
  {15pt}
  {\MakeUppercase}

\begin{document}

 \chapter{Methodology}
 \lipsum[2]

 \chapter{Results}

 \lipsum[2]

\end{document}

enter image description here

If you don't get the chapter number, you probably have an outdated version of titlesec, see titlesec: loss of section numbering with the new update (2016/03/15)