In the MWE below. What is the most convenient way to center the titles Preface and Abstract, rather than setting them flush left?
\documentclass{book}
\begin{document}
\chapter*{Preface}
\chapter*{Abstract}
\chapter{Introduction}
\chapter{Body}
\chapter{Conclusion}
\end{document}
Best Answer
Since this about the
\chapter*
command for two titles (Abstract and Preface) only, it's sufficient to say\chapter*{\centering Abstract}
etc. as command. This is grouped inside the internal command\@makeschapterhead
-- it does not have a side effect on other implicitly used\chapter*
commands, such as in\tableofcontents
.(The
\blindtext
as well asSome text
aren't centered, so the\centering
inside the\chapter*
argument is safe, as long as no entry to the ToC is necessary (which is not the case, as we are talking about\chapter*
)If all
\chapter*
or\chapter
titles should be centered horizontally, an\xpatchcmd
approach is more useful. (See the edit at the bottom of this answer)Edit
This code centers all chapter titles (regardless whether
\chapter*
or\chapter
) horizontally