# [Tex/LaTex] way to center align chapter titles

chaptershorizontal alignmentmemoir

I tried using

\begin{\centerline{Chapter Title}}


\tableofcontents's entries for chapters to be center aligned as well.

Is there a better way to center align chapter's title, without disturbing the document?

I am using \documentclass[12pt,a4paper,oneside]{memoir}.

This answer assumes you are using the report or book document classes. i.e. \documentclass[...]{report} or \documentclass[...]{book} is at the top of your document.

# The Easy Way

The easiest way to achieve what you are looking for is to use the expanded form of the chapter command:

% ## Expanded \chapter command ##
% Format: \chapter[<shorttitle>]{<title>}
%         where <shorttitle> is used in the ToC

\chapter[Chapter Title]{\centering Chapter Title}


Obviously, this must be used where you would use \chapter.

This method is not recommended.

# The titlesec Way

The more professional way of doing what you ask is to use the titlesec package.

This is more powerful and is defined as follows:

\titleformat{<command>}[<shape>]{<format>}{<label>}{<sep>}{<before-code>}[<after-code>]


This may look daunting at first, but is simple when you've read Page 4 of the titlesec Documentation.

## The default layout

For the default look of the chapter number above the title, use the following snippet in the preamble. Makes the chapter number line the size 'huge', the actual title 'Huge', bolds it, centers it and prints "Chapter X:\\<1 line of space>\\Some Title" when used.

\titleformat{\chapter}[display]{\bfseries\centering}{\huge Chapter \thechapter}{1em}{\Huge #1}


## The side-by-side layout

To have the chapter number adjacent to the title, use the following snippet in the preamble. It affects \chapter and makes it the size 'Huge', bolds it, centers it and prints in the format "Chapter X:<1em of space>Some Title" when used.

\titleformat{\chapter}{\Huge\bfseries\centering}{Chapter \thechapter}{1em}{#1}


## Further notes

• The sizes can be changed by substituting \huge and \Huge.
• Changing <format> affects the whole heading, whereas <label> is only for the label and <before-code> for the title.
• #1 is required in <before-code> (it's the title text) when \usepackage[explicit]{titlesec} is used.

# MWE

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

\titleformat{\chapter}[display]{\bfseries\centering}{\huge Chapter \thechapter}{1em}{\Huge #1}

\begin{document}

\chapter{Some Chapter}
\lipsum[1]

\chapter*{Unnumbered Chapter}
\lipsum[1]

\end{document}