[Tex/LaTex] Undefined control sequence and \chapter error

sectioning

I’m getting an “undefined control sequence” error with the following code, using TeXstudio:

\documentclass[11pt]{article}
\begin{document}
\begin{center}
\chapter{CHAPTER 6}
\end{center}
\end{document}

Best Answer

The article class doesn't define the \chapter command, because articles don’t have chapters. Instead they have sections, subsections, etc. If you really want to use article, then you might want to consider using \section, \subsection and so on.

If you really want to use the \chapter command, then I’d suggest using the book or report document classes.

Separately, you generally shouldn’t use \begin{center} … \end{center} for headings. It’s really better used to make lists or similar. A better way to centre your title headings is to use the titlesec package, which is described in another question on TeX.se.