2

In a chapter of a volume I have a local ToC. I would like to remove the chapter itself from that ToC, or, if that's a good way to do that, any \chapter level division, so that only \sections and lower subdivision appear in it. I don't want to use \chapter*, as I want the chapter to appear in the ToC of the book, and to keep its numbering.

A simple example:

\documentclass{memoir}
\begin{document}
\chapter{My Chapter}
\tableofcontents*
\section{A Section}
Some text.
\section{Another Section}
Some more text.
\end{document}

ToC

Edit: Maybe the word "volume" was a bit misleading. The bigger project is only one book, an edited volume with contributions from different authors, each of them in its own file. So far I've mostly worked on the individual chapters and a shared style file, but soon I'll also have to see how I put it all together. I have a preliminary "global" ToC for the book which I created manually, eventually it would be good to replace it with something automatically generated when compiling the whole book, and this somewhat odd local ToC in one contribution, shifting which to etoc might indeed remove one problem in the process of glueing the book together.

6
  • 4
    \tableofcontents* doesn't produce a local table of contents. If you have another chapter and then further sections they will also appear in this table.
    – cgnieder
    Jul 24, 2015 at 19:59
  • can you make your question more clear? what do you exactly want?
    – touhami
    Jul 24, 2015 at 20:01
  • \tableofcontents* just omits Contents in ToC -- it's a special command from memoir that deviates from standard document classes features here
    – user31729
    Jul 24, 2015 at 20:02
  • How is the bigger document constructed? Removing "all chapter" entries may work for your volume, but would certainly affect other components of the book.
    – Werner
    Jul 24, 2015 at 20:07
  • 2
    @muk.li: You need to also provide information regarding the bigger scope, as some solutions here might only work for the smaller use-case. It may be too late to salvage it in this question, but for your next one, remember that.
    – Werner
    Jul 24, 2015 at 21:32

2 Answers 2

7

If you want a local ToC at section level consider loading etoc and use

\etocsettocdepth.toc{section}
\localtableofcontents*

MWE:

\documentclass{memoir}
\usepackage{etoc}
\begin{document}
\chapter{My Chapter}
\etocsettocdepth.toc{section}
\localtableofcontents*
\section{A Section}
Some text.
\section{Another Section}
Some more text.
\end{document} 

Output:

enter image description here

3
  • Just looking into it. Actually the author had a ToC of up to paragraph level, so I changed it accordingly. I get two pages of ToC, the first page with normal inter line spacing, but the second page with double spacing.
    – muk.li
    Jul 24, 2015 at 20:48
  • I got it to work now, after closing the second page of the ToC with a \newpage it rendered fine. Only that I'm still getting a warning in my logfile, which doesn't really seem to make sense: Package etoc Warning: package tocvsec2 detected and its modification of \tableofcontents reverted. Use \etocsettocdepth.toc as a replacement for the tocvsec2 toc-related commands on input line 65.
    – muk.li
    Jul 25, 2015 at 7:46
  • @muk.li The strange warning will be removed from etoc version 1.08g.
    – user4686
    Aug 29, 2015 at 21:07
2

This is only for non-hyperref usage. And I don't recommend it all. Temporarily redefine \addcontentsline with 3 arguments to catch them within a \begingroup...\endgroup pair and issue the \chapter then.

\documentclass{memoir}
\begin{document}
\begingroup
\renewcommand{\addcontentsline}[3]{}% Do nothing
\chapter{My Chapter}
\endgroup
\tableofcontents*
\section{A Section}
Some text.
\section{Another Section}
Some more text.
\end{document}

You must log in to answer this question.

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