# Chapter and Section format

I want my chapter titles to look as they would with the code below.

\documentclass[12pt]{book}
\pagestyle{plain}
\usepackage{amssymb,latexsym}
\usepackage{amsmath}
\usepackage{amsthm}
\begin{document}
\centering
CHAPTER II \\
SUBSQUARES

\end{document}



\renewcommand{\chapter}{\uppercase{CHAPTER} {\Roman{chapter}}  \\}

• Look at the sectsty package, or look on this site for examples of titlesec usage. Since you are using the book class, you might consider switching to memoir, which provides its own interface for adjusting the headings (or a KOMA class for the same reason). There is too much built-in code (for spacing, font, counters, etc.) in the original definition of the section headings to alter them simply with a \renewcommand. – musarithmia Jan 20 '15 at 19:08
• Do you want the same (centering + CAPITAL LETTERS) for \section? What about \subsection...? – Werner Jan 20 '15 at 19:48

I think that using the sectsty package is simpler.

\usepackage{sectsty}

\renewcommand{\thechapter}{\Roman{chapter}}
\chapterfont{\centering\MakeUppercase}


MWE

\documentclass[12pt]{book}
\pagestyle{plain}
\usepackage{amssymb,latexsym}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{sectsty}

\renewcommand{\thechapter}{\Roman{chapter}}
\chapterfont{\centering\MakeUppercase}

\begin{document}

\chapter*{Unnumbered Chapter}

\chapter{Numbered Chapter}

\appendix

\chapter{An Appendix}

\end{document}


Output

Here is a crude way of implementing your requirement. It uses etoolbox to patch the macros responsible for creating the chapter headings. There are two macros, one for \chapter and one for \chapter*. In each of these macros, an adjustment is made to the chapter title (argument #1) as well as the horizontal alignment - changing from \raggedright to \centering. As such, a total of 4 patches are made.

\documentclass{book}
\usepackage{etoolbox}

\makeatletter
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\@chapapp}{\MakeUppercase{Chapter}}
% \patchcmd{<cmd>}{<search>}{<replace>}{<succes>}{<failure>}

The other changes to \thechapter sets the output to print a \Roman format of the chapter counter, while an adjustment to \@chappapp sets the Chapter prefix in CAPITAL LETTERS. This may need some minor adjustments if you also have an Appendix chapter.