# Theorem numbering when using memoir

I have the following template which uses memoir:

\documentclass[a4paper, 10pt, onecolumn, openany]{memoir}

\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[final]{microtype}
\usepackage{amsmath,amssymb,mathtools} % Math
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{textcomp}
\usepackage[svgnames]{xcolor}
\usepackage{amsthm}
\usepackage{thmtools}

\setlrmarginsandblock{0.15\paperwidth}{*}{1} % Left and right margin
\setulmarginsandblock{0.2\paperwidth}{*}{1}  % Upper and lower margin
\checkandfixthelayout

\maxsecnumdepth{subsection} % Subsections (and higher) are numbered
\setsecnumdepth{subsection}

\makeatletter

\makechapterstyle{standard}
{
\setlength{\beforechapskip}{0\baselineskip}
\setlength{\midchapskip}{1\baselineskip}
\setlength{\afterchapskip}{3\baselineskip}
\renewcommand{\chapnamefont}{\centering\normalfont\Large}
\renewcommand{\printchaptername}{\chapnamefont \@chapapp}
\renewcommand{\chapnumfont}{\normalfont\Large}
\renewcommand{\printchapternum}{\chapnumfont \thechapter}
\renewcommand{\afterchapternum}{\par\nobreak\vskip \midchapskip}
\renewcommand{\printchapternonum}{\vspace*{\midchapskip}\vspace*{5mm}}
\renewcommand{\chaptitlefont}{\centering\bfseries\LARGE}
\renewcommand{\printchaptertitle}[1]{\chaptitlefont ##1}
\renewcommand{\afterchaptertitle}{\par\nobreak\vskip \afterchapskip}
}
\makeatother

\chapterstyle{standard}

\makeatletter
\renewcommand\fps@figure{htbp}
\renewcommand\fps@table{htbp}
\makeatother

\captiondelim{\space }
\captionnamefont{\small\bfseries}
\captiontitlefont{\small\normalfont}

\changecaptionwidth
\captionwidth{1\textwidth}

\renewcommand{\abstractnamefont}{\normalfont\small\bfseries}
\setlength{\absleftindent}{0.1\textwidth}
\setlength{\absrightindent}{\absleftindent}

\makepagestyle{standard}

\makeatletter
\makeevenfoot{standard}{}{}{}
\makeoddfoot{standard}{}{}{}

\makeatother

\makeatletter
\makepsmarks{standard}{
\createplainmark{toc}{both}{\contentsname}
\createplainmark{lof}{both}{\listfigurename}
\createplainmark{lot}{both}{\listtablename}
\createplainmark{bib}{both}{\bibname}
\createplainmark{index}{both}{\indexname}
\createplainmark{glossary}{both}{\glossaryname}
}
\makeatother

\makepagestyle{chap}

\makeatletter
\makeevenfoot{chap}{}{\small\bfseries\thepage}{}
\makeoddfoot{chap}{}{\small\bfseries\thepage}{}

\makeatother

\pagestyle{standard}
\aliaspagestyle{chapter}{chap}

\settocdepth{subsection}

\author{author name}
\title{Title}
\date{June}%delete date

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\renewcommand{\thedefinition}{\thesection$\text{.}$\arabic{definition}}

\theoremstyle{theorem}
\newtheorem{theorem}[definition]{Theorem}

\begin{document}

\frontmatter

\maketitle

\newpage
\pagenumbering{arabic}

\begin{abstract}
test
\end{abstract}
\clearpage

\tableofcontents*
\clearpage

\setsecnumdepth{subsection}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\chapter{Title of chapter}

This is a text

\begin{theorem}
this is a theorem.
\end{theorem}

\appendix
\backmatter
\end{document}


My problem with it is the Theorem numbering. The theorem numbering should have three parts: chapter number, section number and theorem number. But, it seem the chapter number ans section number is zero.

How can I fix it?

• Where is the \mainmatter command? – juanuni Aug 26 '16 at 5:00
• @juanuni I'm not so familiar with the template. However, I tested adding \mainmatter. It seems it fixes chapter numbering. where is the correct position for adding \mainmatter? – nano Aug 26 '16 at 5:09
• Yes, add \mainmatter before \chapter command ... you need add a section before a first theorem – juanuni Aug 26 '16 at 5:12
• Also this isn't really related to the memoir class, you would have the same results in the book class. – daleif Aug 26 '16 at 7:00
• You want \mainmatter instead of \newpage\pagenumbering{arabic}. You also need a \section if you want the middle number to increase. – egreg Aug 26 '16 at 10:30