2

I'm typesetting a long text, divided (so far) in three parts.

Consider this MWE:

\documentclass{memoir}

\begin{document}
    \maxsecnumdepth{subsection}
    \maxtocdepth{subsection}
    \part{First part}
    \tableofcontents

    \chapter{First chapter}
    \section{A section}
    \section{Another section}
    \subsection{With a subsection}

    \chapter{Second chapter}
    \section{A section}
    \section{Another section}
    \subsection{With a subsection}

    \part{Second part}
    \tableofcontents

    \chapter{Third chapter}
    \section{A section}
    \section{Another section}
    \subsection{With a subsection}

    \chapter{Fourth chapter}
    \section{A section}
    \section{Another section}
    \subsection{With a subsection}  

    \part{Third part}
    \tableofcontents

    \chapter{Fifth chapter}
    \section{A section}
    \section{Another section}
    \subsection{With a subsection}

    \chapter{Sixth chapter}
    \section{A section}
    \section{Another section}
    \subsection{With a subsection}  
\end{document}

I want a table of contents in every part. It should show the chapters, sections and subsections of that part, but I also want it to show the chapters of the other parts.

So, for example, the toc's in the MWE should look like these: what i want

Is something like this possible? I have no idea where to start.

2

You can do this with package etoc. cf 44. Using depth tags in the documentation.

\documentclass{memoir}

\usepackage{etoc}% cf 44. Using depth tags section of manual

\begin{document}
    \maxsecnumdepth{subsection}
    \maxtocdepth{subsection}
    \part{First part}
\etocdepthtag.toc{PARTI}

\etocsettagdepth{PARTI}{all}
\etocsettagdepth{PARTII}{chapter}
\etocsettagdepth{PARTIII}{chapter}

    \tableofcontents

    \chapter{First chapter}
    \section{A section}
    \section{Another section}
    \subsection{With a subsection}

    \chapter{Second chapter}
    \section{A section}
    \section{Another section}
    \subsection{With a subsection}

    \part{Second part}
\etocdepthtag.toc{PARTII}

\etocsettagdepth{PARTI}{chapter}
\etocsettagdepth{PARTII}{all}
\etocsettagdepth{PARTIII}{chapter}


    \tableofcontents

    \chapter{Third chapter}
    \section{A section}
    \section{Another section}
    \subsection{With a subsection}

    \chapter{Fourth chapter}
    \section{A section}
    \section{Another section}
    \subsection{With a subsection}  

    \part{Third part}
\etocdepthtag.toc{PARTIII}

\etocsettagdepth{PARTI}{chapter}
\etocsettagdepth{PARTII}{chapter}
\etocsettagdepth{PARTIII}{all}

    \tableofcontents

    \chapter{Fifth chapter}
    \section{A section}
    \section{Another section}
    \subsection{W[![enter image description here][1]][1]ith a subsection}

    \chapter{Sixth chapter}
    \section{A section}
    \section{Another section}
    \subsection{With a subsection}  
\end{document}

Produces


FIRST TOC

enter image description here


SECOND TOC

enter image description here


THIRD TOC

enter image description here


Note: the collision IIIThird is as in your images and is not etoc-related. You can solve it I guess using the memoir commands.

  • Lovely, thanks a lot! Regarding your note: yeah I know, it doesn't look like that in the real document. Thanks! – titto Sep 13 '17 at 11:06

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.