# Custom university thesis .cls and minitoc compatibility

I suspect that the custom university thesis class which is linked to below might include something prohibiting implementation of a basic minitoc call.

The .cls can be found here

The code made available at this url also includes an mwe for employing the .cls. I very quickly inserted the commands: \usepackage{minitoc} (placed in the usual spot), \dominitoc (placed before where I think \tableofcontents will be called) and \minitoc (placed after a \chapter{} call) as suggested by the minitoc documentation.

I don't observe a minitoc. I am compiling with PdfLaTeX.

I recognize that the thesis class is designed to achieve standard formatting and that minitoc's may be unwanted. I see it's implementation as useful for structuring the document and easy enough to disable.

% simple.tex -- a very simple thesis document for demonstrating %   dalthesis.cls class file \documentclass[12pt]{dalthesis}

\usepackage{minitoc}

\begin{document}

\title{The title} \author{Noah Body}

% The following degrees are included in the current dalthesis.cls % class file: \mcs  % options are \mcs, \macs, \mec, \mhi, \phd, and \bcshon

% If you degree is not included, you can set several options manually. % The following example shows the parameters for the \mcs degree. % However, if you need to set these parameters manually, please check % the correct names with the Faculty of Graduate Studies, and let the % maintainer of this class file know (Vlado Keselj, vlado@cs.dal.ca). % MCS Example:

\degree{Doctor of Mixology} %\degreeinitial{M.C.Sc.} \faculty{Science} \dept{Contemporary Home Economics}

% Month and Year of Defence \defencemonth{June}\defenceyear{2013}

\dedicate{Optionally, the thesis can be dedicated to someone, and the  student can enter the dedication content here.}

% This sample thesis contains no tables nor figures, so there is no % need to include lists of tables and figures in the front matter: \nolistoftables \nolistoffigures

\dominitoc

\frontmatter

\begin{abstract} This is a test document. \end{abstract}

\begin{acknowledgements} Thanks to all the little people who make me look tall. \end{acknowledgements}

\mainmatter

\chapter{Introduction}

Get it done!  Use reference material by Lamport~\cite{latex-by-lamport} or Gooses, Mittelback, and Samarin~\cite{latex-companion}.

\chapter{Doing It}

\minitoc

Get all the parts that I need.  I can throw in a whole pile of terms like preparation, methodology, forethought, and analysis as examples for me to use in the future.

\section{Next Step}

Do it!

Of course, you have to have pictures to show how you did it to make people understand things better.

\chapter{Conclusion}

Did it!

\bibliographystyle{plain} \bibliography{simple}

\end{document}

I note that I do see a file called mwe.mtc4 the content of which looks like:

{\reset@font\mtcSfont\mtc@string\contentsline{section}{\noexpand \leavevmode \numberline {2.1}Getting Ready}{\reset@font\mtcSfont 2}}
{\reset@font\mtcSfont\mtc@string\contentsline{section}{\noexpand \leavevmode \numberline {2.2}Next Step}{\reset@font\mtcSfont 2}}

A series of these files are being generated: mwe.mtc, mwe.mtc0, mwe.mtc1, mwe.mtc2, mwe.mtc3, mwe.mtc4, mwe.mtc5 most of which have size 0 KB, while only mwe.mtc4 has content. Encouraging, but I don't understand why the minitoc does not appear after the chapter call.

Disclaimer: This is most likely not a complete solution. Both dalthesis and minitoc redefine a lot of internal commands related to chapters, formatting of the various lists etc. I tried to fix at least the most obvious problems in your example.

The main problem with dalthesis and minitoc is that the minitoc numbering gets out of sync because both files redefine or patch \chapter or its internal macros. So the first step is to correctly chain all the patched commands together. (minitoc detects redefinitions and issues a warning which has to be suppressed too.)

As minitoc creates .mtc* files based on \contentsline entries in the .toc file, the numbering is still wrong when a chapter appears in the ToC but isn't numbered. The reading process for all minitoc files then doesn't find the correct file. This is why you don't get a minitoc for chapter 2, because the contents is written to the .mtc4 file. To adjust the numbering for starred chapters, minitoc provides a \chapterbegin command which is written to the .toc file to signal that the minitoc counter should be decremented. However, the current implementation doesn't work on its own, so it needs a fix too.

The final step is to write this \chapterbegin marker to the .toc file whenever a starred chapter occurs together with a ToC entry. This happens in dalthesis in the \nonumchapter, \prefacesection and \frontmatter macros. In the latter the writing has to go to the .lot and .lof files, respectively.

With all the patches applied the numbering seems to correctly work with \chapter, \chapter*, the list of tables and figures, and the bibliography if it occurs last in the document.

Full updated example (relevant changes occur only in the preamble):

\documentclass[12pt]{dalthesis}

\begin{filecontents}{\jobname.bbl}
\begin{thebibliography}{1}
\bibitem[1]{latex-by-lamport}\LaTeX\ by Lamport
\bibitem[2]{latex-companion}\LaTeX\ companion
\end{thebibliography}
\end{filecontents}

\usepackage{minitoc}

\makeatletter

% Link redefinitions for normal chapters
\let\sv@chapter\dal@chapter
\def\dal@chapter[#1]#2{%
\stepcounter{mtc}%
\sv@chapter[{#1}]{#2}\relax%
\ignorespaces
}

% Link redefinitions for starred chapters
\let\orig@schapter\mtc@schapter
\let\mtc@schapter\dal@schapter
% TODO: Is this @@@ thing ever used?
\let\@schapter\orig@schapter

% To suppress redefinition warning
\let\mtc@hints@@schapter\@schapter

% Marker to adjust minitoc numbering in .toc file
\def\chapterbegin{\chapterbegin@}
\let\chapterbegin@\relax

% Correct minitoc numbering for starred chapters with ToC entry
\def\nonumchapter#1{%
\chapter*{#1}%
}
\def\prefacesection#1{%
\chapter*{#1}%
}

% Correct minitoc numbering for LoT/LoF
\let\orig@frontmatter\frontmatter
\def\frontmatter{%
\orig@frontmatter
\ifdal@tables@page
\fi
\ifdal@figures@page
\fi
}

\makeatother

\begin{document}

\title{The title} \author{Noah Body}

% The following degrees are included in the current dalthesis.cls % class file: \mcs  % options are \mcs, \macs, \mec, \mhi, \phd, and \bcshon

% If you degree is not included, you can set several options manually. % The following example shows the parameters for the \mcs degree. % However, if you need to set these parameters manually, please check % the correct names with the Faculty of Graduate Studies, and let the % maintainer of this class file know (Vlado Keselj, vlado@cs.dal.ca). % MCS Example:

\degree{Doctor of Mixology} %\degreeinitial{M.C.Sc.} \faculty{Science} \dept{Contemporary Home Economics}

% Month and Year of Defence
\defencemonth{June}\defenceyear{2013}

\dedicate{Optionally, the thesis can be dedicated to someone, and the  student can enter the dedication content here.}

% This sample thesis contains no tables nor figures, so there is no % need to include lists of tables and figures in the front matter:
%\nolistoftables \nolistoffigures

\dominitoc

\frontmatter

\begin{abstract} This is a test document. \end{abstract}

\begin{acknowledgements} Thanks to all the little people who make me look tall. \end{acknowledgements}

\mainmatter

\chapter{Introduction}

Get it done!  Use reference material by Lamport~\cite{latex-by-lamport} or Gooses, Mittelback, and Samarin~\cite{latex-companion}.

\chapter{Doing It}

\minitoc

Get all the parts that I need.  I can throw in a whole pile of terms like preparation, methodology, forethought, and analysis as examples for me to use in the future.

\section{Next Step}

Do it!

Of course, you have to have pictures to show how you did it to make people understand things better.

\chapter{Conclusion}

Did it!

\bibliographystyle{plain}
\bibliography{\jobname}

\end{document}

outputs

• I'm grateful for this fix. When deployed in a non-mwe document, it works well as far as I can tell. – John Chris Oct 7 '19 at 16:17