# minitoc per sections with memoir

I want to make a minitoc for each section with the subsections with the memoir class. But it doesn't works, only \minitoc per chapters are working.

How can I do that ?

-
Duplicate of Memoir and minitoc. You can use titletoc instead. –  Alan Munn Jul 5 '12 at 18:34
@AlanMunn The linked question doesn't seem to handle the case of per-section ToCs. –  lockstep Jul 5 '12 at 18:38
@lockstep Well to the extent that getting section TOCs just involves replacing 'chapters' with 'sections' and putting the commands after each \section instead of after each \chapter in my answer, I think they're pretty much the same. I can post an almost duplicate answer here if you like. –  Alan Munn Jul 5 '12 at 18:45
@AlanMunn I tried \dosecttoc and \secttoc, and they worked with the article class, but not with memoirs article option. I 'd upvote a working solution for the latter case. –  lockstep Jul 5 '12 at 18:50
@lockstep Well my solution doesn't use minitoc. So maybe it's better to have a clearer answer here. –  Alan Munn Jul 5 '12 at 19:13

There are well-known incompatibilities between memoir and minitoc. However, the titltoc package can also produce section and chapter contents lists. Here's an example based on my answer to this question: Minitoc and memoir which shows how you can use titletoc to do section TOCs.

\documentclass[oneside]{memoir}
\setsecnumdepth{subsubsection}
\settocdepth{subsubsection}
\usepackage{titletoc}
\usepackage{kantlipsum}
\begin{document}
\tableofcontents
\chapter{A chapter}
\kant[1]
\section{Section}
\startcontents[sections]
\printcontents[sections]{}{2}{}
\subsection{A subsection}
\kant[2]
\subsection{Another subsection}
\kant[3]
\section{Section 2}
\startcontents[sections]
\printcontents[sections]{}{2}{}
\subsection{A subsection}
\kant[4]
\subsection{Another subsection}
\kant[5]
\section{Section 3}
\startcontents[sections]
\printcontents[sections]{}{2}{}
\subsection{A subsection}
\kant[6]
\subsection{Another subsection}
\kant[7]
\end{document}


-
Unfortunately, it bugs with hyperref. –  benlaug Jul 6 '12 at 8:45
@benlaug Your comment isn't very explicit. Adding hyperref to this example works properly, so if you are having a problem with hyperref you should ask a separate question about that. Did you remove all the auxiliary files? Did you load hyperref as the last package in the loading order? –  Alan Munn Jul 6 '12 at 11:59
It seems that putting hyperref as the last package is working ! Thank you very much for your help :). –  benlaug Jul 6 '12 at 13:11
@benlaug Yes, hyperref has to modify the behaviour of a lot of packages and so should almost always be the last package you load. (There are a few exceptions in the case of other packages that affect hyperref itself, but generally loading it last is the best strategy.) –  Alan Munn Jul 6 '12 at 13:16