[Tex/LaTex] Undefined control sequence error when trying to add \frontmatter and \mainmatter commands

document-classesfront-matter

I am writing a book, and dividing the book's chapters into separate .tex files. I would like to do the same for my appendices, but when I try to do so I get an error message. First, here is my preamble file:

\documentclass[fontsize=12pt]{scrreprt}
\usepackage{lipsum}
\usepackage{tabularx}
\usepackage{xcolor,fix-cm}

\usepackage{lmodern}
\usepackage[left=1.50cm,
 right=1.50cm,
 top=1.95cm,
 bottom=2.50cm]{geometry}

\usepackage{amssymb}
\usepackage{framed}
\usepackage{indentfirst}
\usepackage{changes}
\usepackage[pagestyles]{titlesec}

And now, here is the 'main' file: prayerbook:

\input{preamble}

\begin{document}

\frontmatter
\include{toc}

\mainmatter
\include{chapter4}
\include{chapter5}
\include{chapter6}
\include{chapter7}

\backmatter
\include{appendix7}
\end{document}

When I omit the commands \frontmatter, \mainmatter, etc; I do not get the error message which is the following:

Undefined control sequence

at the line with the command.

Best Answer

The scrreprt class (like the report class) does not feature \frontmatter, \mainmatter, and \backmatter. If you want to use these commands (be aware that they tinker with page and chapter numbering!), switch to the scrbook (or book) class. To mimic scrreprt/report's headers and page breaking, add the oneside and openany class options.