I am currently nearing the end of writing my thesis, and I am using the aucklandthesis class, since it seems to be the closest thing to an official class/template for my institution. Probably importantly, this is based upon the memoir class. The relevant regulations governing my thesis stipulate that page numbering before the first chapter must in Roman numerals, and then everything after in Arabic numerals. Ordinarily, this wouldn't be an issue, since this seems to be precisely what the memoir class does using the \frontmatter
and \mainmatter
commands.
When using the aucklandthesis class, however, I seem to be experiencing a strange conflict between it and the cleveref package, but only when the \frontmatter
command is used. If the \frontmatter
command isn't issued, then the cleveref commands work fine, but I do not get the necessary pagination. If \frontmatter
is used, then I get warnings along the line of:
LaTeX Warning: Cref reference format for label type `' undefined on input line 40.
wherever I use the \cref
or \Cref
commands, and the relevant spot in the document just gets question marks. Moreover, when I use \cref
and include more than one cross-reference in it, e.g. \cref{chap1,chap2}
, I get an error like
Missing number, treated as zero. < l.43 ...Conclusion, building on \cref{chap1,chap2}
The below MWE seems to demonstrate what I am seeing:
\documentclass[11pt]{aucklandthesis}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\urlstyle{same}
\usepackage{cleveref}
\begin{document}
\title{[thesis title]}
\subtitle{[subtitle]}
\author{[candidate's name]}
\degreesought{[degree]}
\degreediscipline{[discipline]}
\degreecompletionyear{[year]}
\maketitle
\frontmatter
\begin{abstract}
Apparently, some people refer to category theory as ``abstract nonsense.''
\end{abstract}
\chapter{Acknowledgements}
I want to thank the Academy, and my enormous ego, I mean talent.
\chapter{Hyperlink}
Hey, check out this neat website: \url{https://www.auckland.ac.nz/en.html}
It's totally not phishing or rickrolling, really...
\settocdepth{section}
\cleardoublepage\tableofcontents
\mainmatter
\chapter{Hello}\label{chap1}
Beginnings and Introductions
\clearpage
\chapter{The Middle}\label{chap2}
Shocking revelations. \Cref{chap1} has the details!
\clearpage
\chapter{This is the end, my friend}
Thrilling Conclusion, building on \cref{chap1,chap2}.
\backmatter
\cleardoublepage
\appendixpage*
\chapter{Appendix 1}
The Deadly Dénouement
\end{document}
For comparison's sake, I tried to compile the same thing, but just using memoir as the class instead of the aucklandthesis class (they're not completely identical, since the first one uses a few commands that are custom to aucklandthesis):
\documentclass[11pt]{memoir}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\urlstyle{same}
\usepackage{cleveref}
\begin{document}
\title{[thesis title]}
\author{[candidate's name]}
\maketitle
\frontmatter
\begin{abstract}
Apparently, some people refer to category theory as ``abstract nonsense.''
\end{abstract}
\chapter{Acknowledgements}
I want to thank the Academy, and my enormous ego, I mean talent.
\chapter{Hyperlink}
Hey, check out this neat website: \url{https://www.auckland.ac.nz/en.html}
It's totally not phishing or rickrolling, really...
\settocdepth{section}
\cleardoublepage\tableofcontents
\mainmatter
\chapter{Hello}\label{chap1}
Beginnings and Introductions
\clearpage
\chapter{The Middle}\label{chap2}
Shocking revelations. \Cref{chap1} has the details!
\clearpage
\chapter{This is the end, my friend}
Thrilling Conclusion, building on \cref{chap1,chap2}.
\backmatter
\cleardoublepage
\appendixpage*
\chapter{Appendix 1}
The Deadly Dénouement
\end{document}
This version seems to build fine, and give the correct pagination results, while working with cleveref. I checked the memoir documentation and couldn't find anything about interactions with cleveref. Memoir apparently defines its own \Cref
command, but I'm guessing cleveref overwrites it. All of this leads me to conclude that there is almost certainly an issue with the aucklandthesis class, but my knowledge of memoir and related is far too limited to be able to work out what is going on.
Is there some (reasonably simple) thing I can do to fix this? Preferably one which doesn't involve dropping cleveref. Unfortunately, the original author of the class seems to be long gone from my institution, so I can't ask them about it, and there doesn't seem to be anyone else responsible for maintaining it these days. I find this all perplexing, since the aucklandthesis class doesn't even seem to do anything to the \frontmatter
command. I have noticed that sometimes the results from a given run of pdflatex can vary somewhat based on what was or wasn't commented-out in the previous run, but ultimately in the end I cannot get the necessary result no matter what.
Oh, I should probably also mention that I'm working in Overleaf, just in case that makes a difference. I figure maybe someone would suggest some sort of wizardry with the build system, but I doubt that's an option here, I'm afraid. And I probably also should point out that the aucklandthesis class hasn't been updated in some years, so possibly the problem stems from some change to more recent versions of memoir that hasn't been accounted for in aucklandthesis.
\makeatletter \@mainmattertrue \makeatother
after\mainmatter
.\setcounter{secnumdepth}{\value{maxsecnumdepth}}
to the mix suggested by Ulrike.