1

I'm getting a weird behavior with the memoir class and the titletoc package. I'm printing a partial TOC after each chapter (works perfectly), but for the last chapter, the appendices are also added into that toc. The following code shows a MWE of the problem:

\documentclass[openright,twoside]{memoir}
\usepackage{titletoc}

\begin{document}

\chapter{chap1}
\startcontents[chapters]
\maxtocdepth{section}
\printcontents[chapters]{}{1}{\small}

\section{chap1sec1}
\section{chap1sec2}

% chap 2

\chapter{chap2}

\startcontents[chapters]
\maxtocdepth{section}
\printcontents[chapters]{}{1}{\small}

\section{chap2sec1}
\section{chap2sec2}

\stopcontents[chapters] % adding this command avoid having appendices in previous partial toc

\appendix

\chapter{Appendix1}
\chapter{Appendix2}

\end{document}

Maybe I'm doing something wrong. How can I avoid having the Appendix1 et Appendix2 in the partial table of content from chapter 2 ?

Thanks for any advice, Fabian

5
  • Isn't there a \stopcontents command? I remember somehow...
    – user31729
    Sep 16, 2014 at 12:05
  • Thanks for the hint. Works perfectly. I edited the MWE with right way to do it.
    – Fabian
    Sep 17, 2014 at 9:58
  • Alternatively you could use minitoc for small tocs inside of chapters/sections...
    – user31729
    Sep 17, 2014 at 14:21
  • @ChristianHupfer Wanna write up an answer?
    – Johannes_B
    Nov 9, 2014 at 16:30
  • @Johannes_B: Old, but I've done so :-D
    – user31729
    Oct 4, 2015 at 12:05

1 Answer 1

2

As proposed to the O.P. and to close this question: \stopcontents[chapter] will close the ToC file and any further sectioning command won't appear in the ToC.

I doubt that titletoc and memoir should be used together, however.

\documentclass[openright,twoside]{memoir}
\usepackage{titletoc}

\begin{document}

\chapter{chap1}
\startcontents[chapters]
\maxtocdepth{section}
\printcontents[chapters]{}{1}{\small}

\section{chap1sec1}
\section{chap1sec2}

% chap 2

\chapter{chap2}

\startcontents[chapters]
\maxtocdepth{section}
\printcontents[chapters]{}{1}{\small}

\section{chap2sec1}
\section{chap2sec2}

\stopcontents[chapters] % adding this command avoid having appendices in previous partial toc

\appendix

\chapter{Appendix1}
\chapter{Appendix2}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .