[Tex/LaTex] Secnumdepth not working for me

sectioning

It seems that changing secnumdepth does not change anything in my document for me. I want secnumdepth to be 2, so that I can label and reference subsections.

However, subsection stay unnumbered for some reason, which has the consequence that when referencing these subsections, I get the section number instead. So if I were to reference subsection 1.1.2, I'd get section 1.1 instead. This is rather annoying, and I'm not quite sure what's going on. I've even tried changing secnumdepth to values ranging from 0 to 4, but even that does not change anything in my document. I do not receive any warnings or errors about this. My guess is that somewhere, a more dominant definition was made, but since my secnumdepth is defined at the bottom, that seems a bit unlikely.

I'm using a template from my university, and I'd like to think that I understand it fully, but somewhere I apparently don't.

\documentclass[a4paper,10pt,oneside,openright]{memoir}

\usepackage{pdfpages}                           
\usepackage{fix-cm}                             
\usepackage[breaklinks,pdfpagelabels]{hyperref} 
\usepackage[official]{eurosym}                  
\usepackage{subfig}                             
\usepackage[english]{babel}                     
\usepackage{wrapfig}
\usepackage{graphicx}                           
\usepackage{amsmath}                            
\usepackage{amssymb}                           
\usepackage{units}
\usepackage{amsmath}
\usepackage[numbers,sort&compress]{natbib}      
\usepackage{todonotes}
\usepackage{ctable}                             
\usepackage{multirow}                           
\usepackage{xfrac}                              
\usepackage{easytable}
\usepackage{gensymb}

\setcounter{topnumber}{3}           
\setcounter{bottomnumber}{1}        
\setcounter{totalnumber}{4}       
\renewcommand{\topfraction}{0.8}    
\renewcommand{\bottomfraction}{0.8} 
\raggedbottom

\settypeblocksize{*}{14cm}{1.618}
\setlrmargins{3cm}{*}{*}
\setulmargins{3cm}{*}{*}
\checkandfixthelayout

\definecolor{darkblue}{rgb}{0.0,0.0,0.3}
\definecolor{darkgreen}{rgb}{0.0,0.3,0.0}
\hypersetup{        
    colorlinks,          % links are colored
    urlcolor=blue,       % color of external links
    linkcolor=darkblue,  % color of internal links
    citecolor=darkgreen, % color of links to bibliography
    bookmarksnumbered
}
\urlstyle{rm}

\newcommand{\intd}[1]{\ensuremath{\,\textrm{d}#1}}

\setcounter{tocdepth}{1}
\setcounter{secnumdepth}{2}

I have also added my document assembly

\begin{document}
\frontmatter
\includepdf{frontpage} 
\include{abstract}
\tableofcontents

\mainmatter
\include{chapters/Introduction}
\include{chapters/Concept}
\include{chapters/Digital}
\include{chapters/Analog}
\include{chapters/Results}
\include{chapters/Discussion}
\include{chapters/Conclusion}

\backmatter
\bibliographystyle{unsrtnat}
\bibliography{icdtemplate} %requires mscthesis.bib file in your directory; use e.g. JabRef in combination with bibtex to generate it.

\appendix
\include{chapters/appendix1}
\include{chapters/appendix2}
\end{document}

Best Answer

The preferred method with memoir is to say

\settocdepth{section}
\setsecnumdepth{subsection}

instead of setting the counters tocdepth and secnumdepth. If I do it and try with a skeleton document

\begin{document}
\frontmatter
\tableofcontents

\mainmatter
\chapter{a}
\section{b}
\subsection{c}
\subsubsection{d}

\end{document}

and your very same preamble (but moving hyperref to be the last package loaded) I get

enter image description here

By the way, the definition of \intd should be

\newcommand{\intd}{\mathop{}\!\textrm{d}}

No need of \ensuremath nor of using arguments.