[Tex/LaTex] Minitoc of wrong chapter

minitoctable of contents

I'm writing my Thesis and I want the general table of contents at the beginning of the document and the toc for every chapter at beginning of every chapter. For doing so I use the minitoc package.

If I put the \tableofcontents command at the end of the document all goes right. If instead I put it at the begin of the document the minitoc of first Chapter is not printed and the next ones are shifted. The second chapter has the minitoc of the first one, the third of the second and so on so forth.

\documentclass[a4paper,11pt,twoside]{memoir}
\usepackage{minitoc}

\dominitoc

\begin{document}

\tableofcontents
\listoffigures

\chapter{first}
\minitoc
\section{first first}
\section{first second}

\chapter{second}
\minitoc
\section{second first}
\section{second second}

\chapter{third}
\minitoc
\section{third first}
\section{third second}


\end{document}

Best Answer

memoir does some redefinitions of ToC features and apparently minitoc is confused by this.

However, there is a solution for this: minitoc provides the \adjustmtc[...] command, the optional argument is meant for adjusting the number of the minitoc, defaulting to one.

Saying \adjustmtc before the first \minitoc appears cures the problem.

I found this nice command hidden in the minitoc documentation when I tried to find a solution for this question: How can I put a minitoc before a chapter, on the facing page?.

Please note that minitoc is a package that is basically unmaintained since its author, J.P. Drucbert, died in 2009.

\documentclass[a4paper,11pt,twoside]{memoir}
\usepackage{minitoc}

\dominitoc

\begin{document}

\tableofcontents
\adjustmtc
\listoffigures
\adjustmtc
\chapter{first}

\minitoc
\section{first first}
\section{first second}

\chapter{second}
\minitoc
\section{second first}
\section{second second}

\chapter{third}
\minitoc
\section{third first}
\section{third second}


\end{document}

enter image description here