0

I'm writing my thesis and for easy reading and structures, I'm using the minitoc package to display a ToC for each chapter.

When I get to the appendices however, the \minitoc doesn't work anymore (it displays nothing, but also doesn't give any errors). It works fine before the \begin{appendices} or \appendix (i.e. in regular chapters, as displayed below).

As a fix, I've tried using the titletoc package to recreate the minitoc's style for appendices. I've gotten quite close but I'm not there yet.

Can you help me finish it? I think I'm still lacking:

  • increasing margins left and right
  • decreasing vertical line spacing
  • optionally, stretching the horizontal lines by about 2 pixels. Since I'm only noticing because I have them side-by-side, nobody will notice when I use only one in the final document.

MWE minitoc vs titletoc

MWE

    \documentclass[11pt]{report}

    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{float}
    \usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
    \usepackage{lipsum}
    \usepackage{parskip}


    \usepackage{titlesec}
    \titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge} 

    \renewcommand{\familydefault}{\sfdefault} %Use sans-serif font.
    \usepackage{minitoc}
    \renewcommand{\mtctitle}{Inhoudsopgave}
    \renewcommand{\mtifont}{\large\sffamily}
    \renewcommand{\mtcfont}{\small\sffamily}
    \renewcommand{\mtcSfont}{\small\sffamily}
    \renewcommand{\mtcSSfont}{\small\sffamily}
    \renewcommand{\mtcSSSfont}{\small\sffamily}
    % Add MiniToC package. 
    % Translate 'Contents' to 'Inhoudsopgave'
    % Change all fonts from default (serif) to sans serif - to equal the regular document font

    \setcounter{minitocdepth}{2} %show subsec's (2) up to this level in minitoc's. Paragraphs ("3*sub"sections) and lower don't show up
    \setcounter{secnumdepth}{3} %number subsubsec's (3) up to this level. paragraphs don't get a number.
    \setcounter{tocdepth}{1} %show up to level 1 (sections), hide subsections (2) and lower in ToC. (used in combination with minitoc to show ToC's per chapter)

    \usepackage{titletoc}
    % What styling do I need here?


    \begin{document}
    \dominitoc
    \tableofcontents

    \chapter{Introduction}
    \minitoc

    % My Solution
    \startcontents[sections] {\large Inhoudsopgave} \vspace{-15pt}\par
    \noindent\hrulefill \vspace{-5pt} 
    {\small \printcontents[sections]{}{1}{\setcounter{tocdepth}{2}} } 
    \vspace{-10pt} \noindent\hrulefill 
    % My Solution

    \section{One}
    \lipsum[1]
    \subsection{One One}
    \subsection{One Two}
    \section{Two}
    \subsection{Two One}
    \subsection{Two Two}
    \section{Three}
    \subsection{Three One}
    \subsection{Three Two}
    \subsection{Three Three}

    % My Solution
    \stopcontents[sections]
    % My Solution

    \end{document}
0

I've found the reason \minitoc wasn't working in my Appendix chapters: if I included chapters before the command \printbibliography[heading=bibintoc, title=MyBibliography] then nothing was off. Including chapters after that command stopped \minitoc from printing anything, however.

From minitoc not appear? I found the solution to add \mtcaddchapter afther the \chapter{Chapter Title} declaration (and before \minitoc).

Note: the command should only be entered once for every time \minitoc forgets a chapter.

Excerpt from https://wiki.lyx.org/Examples/Minitoc:

Note: Sometimes minitoc does not notice that a new chapter has been added, so that it writes the wrong minitoc's to the wrong chapters. For example, this is the case of \addcontentsline and \listoffigures. To avoid this, you can inform minitoc about the "new chapter" by adding the command \mtcaddchapter.

So:

\documentclass[11pt]{report}
\usepackage[backend=biber, citestyle=apa, urldate=short, style=apa, sorting=none]{biblatex}
\addbibresource{sources.bib}
\usepackage{appendix}

\begin{document}
\dominitoc
%
% Insert document contents here
%
\printbibliography[heading=bibintoc, title=MyBibliography]

% \appendix % < = = Doesn't show "Appendix A: SomeAppendix" but "A: SomeAppendix", though offtopic.

\begin{appendices}
    \chapter{SomeAppendix} \mtcaddchapter % < = = THIS COMMAND < = =
    \minitoc
    \section{About}

    \chapter{DifferentAppendix} % < = = NOT REPEATED HERE
    \minitoc
    \section{Introduction}

\end{appendices}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.