# How do I remove spacing from before the table of contents in memoir class?

I am using memoir class to create a collection of short stories, and the default space before the table of contents and chapter titles is quite large. I have seen several posts on this site that show how to remove this space for all chapters, but I want to remove it just for the table of contents, keeping it for the chapters. How would I do this?

-

## 2 Answers

An improvement of Brent's answer might be in avoiding to look for the value of \beforechapskip:

\frontmatter
\begingroup
\setlength{\beforechapskip}{0pt} % or any other dimension
\tableofcontents*
\endgroup

\mainmatter


That value of \beforechapskip will be used only inside the group and will be restored to the previous one when the group ends.

Notice the * after \tableofcontents, that will remove the table of contents entry from the table of contents (it's unclear to me why the default is to include the entry).

-

This should do what (I think) you want:

...
\setlength{\beforechapskip}{0pt}
\tableofcontents
...
\mainmatter
\setlength{\beforechapskip}{12pc}
...


To help you in finding a good chapter style, and to avoid "existential design anguish", you may find it worthwhile spending fifteen minutes reading the memoir manual section 6.5, under "Chapter Styles".

You may also want to read Memoir Chapter Styles.

Memoir includes a set of pre-built chapter styles, which you could use either alone, or in conjunction with the previous solution.

You can even switch chapter styles in the middle of the document (or, more specifically for your case, between the TOC and the remainder).

-
Why not putting the setting of \beforechapskip and \tableofcontents in a group, so as to avoid resetting the parameter? –  egreg Feb 16 '12 at 11:54
@egreg: I considered that option, but as I don't have a firm grasp of exactly how groups work, nor their relationship to \setlength, I thought I would have been BS-ing to use it. I have no objection to your writing an answer with groups. –  Brent.Longborough Feb 16 '12 at 12:28
According to p. 81 of the manual for the memoir class, one should set \setlength\beforechapskip{-\baselineskip} to "avoid any space before the first text in the chapter heading". Alternatively, one could also set \let\chapterheadstart\relax. Wrap this in a group (delimited by \begingroup and \endgroup) to keep this change local to the setting of the Header of the table of contents. By the way, memoir's default value of the \beforechapskip parameter is 50pt. –  Mico Feb 16 '12 at 13:52