[Tex/LaTex] Chapter number before Chapter name in LaTeX

chapterstitlesec

I am trying to get this at the page where my Chapter 1 starts. I am using standard book class. How to get 1. before ChapterName.

enter image description here

Best Answer

Use command titleformat in package titlesec. For more informations chapter 3 of documentation.

\titleformat{hcommandi}[hshapei]{hformati}{hlabeli}{hsepi}{hbefore-codei}[hafter-codei]

A minimal exemple.

\documentclass{book}
\usepackage{titlesec}
\titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter{. }}{0pt}{\Huge\bfseries}

\begin{document}
\chapter{Chapter Name}
test
\end{document}

enter image description here

with Chapter 1 should also be there

\documentclass{book}
\usepackage{titlesec}

\titleformat{\chapter}[display]{\bfseries\Large}{\chaptertitlename \hspace{2ex}\thechapter}{4ex}{\thechapter \hspace{2ex}}[]

\begin{document}
\chapter{Chapter Name}
test
\end{document}

enter image description here

or in Memoir class

\documentclass{memoir}
\chapterstyle{crosshead}
\begin{document}

\chapter{Chapter Name}   
    test 
\end{document}