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


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

\chapter{CHAPTER 6}

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.