kks32 / phd-thesis-template

A LaTeX / XeLaTeX / LuaLaTeX PhD thesis template for Cambridge University Engineering Department (CUED)
http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/ThesisStyle/
MIT License
833 stars 400 forks source link

Use of minitoc within template: minitoc not displayed #217

Open brentocarrigan opened 3 years ago

brentocarrigan commented 3 years ago

Any other user's experience with minitoc package for inserting a mini table of contents into each chapter?

I have followed CUED guidance for using minitoc with their minimal reproducible document which works fine.

However, using the template a minitoc is not displayed when requested in each chapter. I have:

In thesis.tex:

\documentclass[a4paper,12pt,times,numbered,print,index]{Classes/PhDThesisPSnPDF}
% ********************** Insert minitoc *************************
\usepackage{minitoc}

and also in thesis.tex ensure \dominitoc is called before any indexing eg table of contents or list of figures

% ******************************** Front Matter ********************************
\begin{document}
\dominitoc 

Then in each chapter eg:

\chapter{Getting started}  %Title of the First Chapter

\minitoc

Any ideas welcome!

TexStudio 3.0.1 on Mac OS Mojave using TexLive

brentocarrigan commented 3 years ago

Adding a comment in case interested for interested problem-solvers:

TexX logs include warnings W0023: It may be a consequence of the hyperref package and W0028: The \chapter command is altered after minitoc

There may be an issue with the order of packages loaded? minitoc documentation and this tex stackexchange post suggest loading minitoc before hyperref - so I have added \minitoc to the class file before \require{hyperref] but no luck.

Any ideas?

TimLoveCambridge commented 3 years ago

If I add

\usepackage{minitoc} ... \begin{document} \dominitoc

to the sample thesis.tex, add \minitoc after each chapter command, then run latex a few times, the minitoc for chapter 1 appears in chapter 3.

Looking behind the scenes, thesis.mtc, thesis.mtc0, thesis.mtc1, thesis.mtc2 are empty. thesis.mtc3 contains the code for chapter 1's minitoc, thesis.mtc4 contains the code for chapter 1's minitoc, etc. So the chapter numbering is out of sync.

http://texdoc.net/texmf-dist/doc/latex/minitoc/minitoc.pdf might explain why this is. It's 637 pages though ...

bricoletc commented 3 years ago

@brentocarrigan if I put \RequirePackage{minitoc} somewhere after \begin{document} in thesis.tex minitocs don't appear, but if I put it in PhDThesisPSnPDF.cls before the inclusion of hyperref then it appears.

@TimLoveCambridge I had the same issue and the solution is to write \adjustmtc[2] after \listoffigures and \listoftables in thesis.tex. (see https://tex.stackexchange.com/a/291744 or the manual page 34 ;)). Page 50 of the manual states this occurs because list of figures/tables appears in the TOC so gets registered as a chapter by minitoc.

It works for me now :-)

a-r-j commented 1 year ago

I had to include \usepackage{etoc} to get this to work in overleaf :shrug:.

medch1 commented 1 year ago

@bricoletc
Thank you so much you saved my life