0

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.

Johannes_B
  • 24,235
  • 10
  • 93
  • 248

2 Answers2

1

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} 

enter image description here

Bernard
  • 271,350
0

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

Try adding these lines to your preamble:

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


\chapter{Your title}


\end{document}
qwertxyz
  • 542