# Centering chapter number and title

I'm new to latex and I've been experimenting on some.

This question is kind of similar to this Centering chapter titles, but it only centers the chapter title. (I tried using \chapter*{\centering Title}, but this removes chapter number and only centers the "Title".)

I also tried \chapter{\centering Title}, but this gives me an error:

If you say, e.g., \def\a1{...}', then you must always
put 1' after \a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.


Am I missing something? If you need elaboration, I could reply.

You can manage to do it using the \titlesec package in order to print the chapter centered with the title.

\usepackage{titlesec}
\titleformat{\chapter}
{\huge\bfseries\centering}
{\thechapter}
{10pt}
{}


Here is an MWE:

\documentclass{report}

\usepackage{titlesec}
\titleformat{\chapter}
{\huge\bfseries\centering}
{\thechapter}
{10pt}
{}

\begin{document}

\chapter{title}

\end{document}


Obviously you can add other options to change the appearance of the title.

EDIT:

here is an MWE for centering a title on two lines:

\documentclass{report}

\usepackage[T1]{fontenc}
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\huge\centering}
{Chapter \thechapter}    %  <------ "\thechapter" is chapter number, it is preceded by the text you want to insert berfore chapter number, i.e. "Chapter"
{0ex}
{
\vspace{1ex}%
\begin{minipage}{\textwidth}\centering}
[\end{minipage}]

\begin{document}

\end{document}

• This gave "1 Title". How about "Chapter 1 \\ Title"? Note: \\ means end line. My document class is report. Apr 18, 2020 at 17:27
• So you could use a minipage: see the MWE in the modified post Apr 18, 2020 at 17:37

Here is a simple code, using the display style (chapter number and title on separate lines and the 3rd argument is a distance which for this style is the vertical distance between chapter number and chapter title. I also made the chapter title page header and footer empty, as is traditional in typography. The centring is obtained with the titlesec directive \filcenter.

\documentclass{report}

\usepackage[T1]{fontenc}
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\bfseries\filcenter}
{\huge\chaptername~\thechapter} %
{6ex}
{\Huge\thispagestyle{empty}}

\begin{document}

\chapter{Looking-Glass House}

\end{document}
`