3

I have been receiving this error on multiple documents recently. The first and third section headers render correctly, but the second produces an error.

\documentclass{report}

\begin{document}

\begin{center}
\section*{\normalsize{SECTION ONE}}
\end{center}

\begin{center}
\section*{\normalsize{SECTION TWO}}
\end{center}

\begin{center}
\section*{\normalsize{SECTION THREE}}
\end{center}

\end{document}

1 Answer 1

5

To easily change the formatting for sectional units, use the titlesec package:

\documentclass{report}
\usepackage[explicit]{titlesec}
\usepackage{lipsum}% just to generate text for the example

\titleformat{\section}
  {\normalfont\normalsize\bfseries\centering}{}{0em}{\MakeUppercase{#1}}

\begin{document}

\section{Section one}
\lipsum[4]
\section{Section two}
\lipsum[4]
\section{Section three}
\lipsum[4]

\end{document}

enter image description here

I assumed you wanted your \sections to be unnumbered; let me know if this is not the case, the definition would look like this:

\documentclass{report}
\usepackage[explicit]{titlesec}
\usepackage{lipsum}% just to generate text for the example

\titleformat{\section}
  {\normalfont\normalsize\bfseries\centering}{\thesection}{1em}{\MakeUppercase{#1}}

\begin{document}

\section*{Section one}
\lipsum[4]
\section*{Section two}
\lipsum[4]
\section*{Section three}
\lipsum[4]

\end{document}

Without packages, you could redefine the \section command as defined in report.cls:

\documentclass{report}
\usepackage{lipsum}% just to generate text for the example

\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\normalsize\bfseries\centering\MakeUppercase}}
\makeatother

\begin{document}

\section*{Section one}
\lipsum[4]
\section*{Section two}
\lipsum[4]
\section*{Section three}
\lipsum[4]

\end{document}
2
  • Perfect. This solved my problem and also helped make some other formatting a little easier. Thank you! Jan 22, 2014 at 1:47
  • @AmishHacker You're welcome! Glad I could help. Don't forget that, after a sensible wait, you can mark answers that best solved your problems by clicking the checkmark to the left of the answer. Jan 22, 2014 at 2:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.