7

I am writing a long document and want to include local tables of contests after each chapter. This is easily achieved with the package etoc and the command \localtableofcontents being introduced just after the chapter definition \chapter{Chapter One}. However, I get the chapter's title in one page and the local table of contents on the next one. Is there are a way to anchor the LToC to the same page as the chapter's title?

Here is a minimum working example:

\documentclass[a4paper, 11pt, oneside]{report}
\usepackage{etoc}
\usepackage{titlesec}
\titleformat{\chapter}{\Huge}{\thechapter}{1.5em}{\MakeUppercase}{}
\begin{document}
\chapter{Chapter One}
\localtableofcontents
\section{Section One}
\subsection{Subsection One Point One}
\section{Section Two}
\end{document}

2 Answers 2

5

You want to use etoc's features such as \etocsettocstyle

\documentclass[a4paper, 11pt, oneside]{report}

\usepackage{etoc}
\usepackage{titlesec}

\titleformat{\chapter}
  {\Huge}
  {\thechapter}
  {1.5em}
  {\MakeUppercase}

\begin{document}

\tableofcontents
\etocsettocstyle{}{} % from now on only local tocs

\chapter{Chapter One}

\localtableofcontents

\section{Section One}
\subsection{Subsection One Point One}
\section{Section Two}

\end{document}

The first and second arguments to \etocsettocstyle contain respectively what we want before and after the local TOC. Customize at will.

enter image description here

1
  • +1 and as alternative one can also issue \etocarticlestyle (after the main TOC) to instruct etoc to use the display style from article, not book class. Then it would use \section*, not \chapter* for the TOC headings and there would be no new page.
    – user4686
    Sep 10, 2016 at 13:36
2

As pointet out by egreg, \clearpage is not in this class added by \chapter, but by \localtableofcontents. This could be disabled locally, with adding \let\clearpage\relaxin front of it, within a group.

Also, his answer is probably better for this package. But this solution could work as a more general way.

\documentclass[a4paper, 11pt, oneside]{report}
\usepackage{etoc}
\usepackage{titlesec}
\titleformat{\chapter}{\Huge}{\thechapter}{1.5em}{\MakeUppercase}{}
\begin{document}
\begingroup
\chapter{Chapter One}
\let\clearpage\relax
\localtableofcontents
\endgroup
\clearpage
\section{Section One}
\subsection{Subsection One Point One}
\section{Section Two}
\end{document}

enter image description here

3
  • Shouldn't you disable \clearpage just before \localtableofcontents?
    – egreg
    Jun 19, 2016 at 8:55
  • @egreg Of course, you are right. Added some info reflecting this.
    – Runar
    Jun 19, 2016 at 10:08
  • just to be precise the \clearpage is not explicitely added by the etoc code; it comes from a \chapter* which the document class (report) inserts as part of its code for the table of contents, and this code is inherited by etoc. The command \etocarticlestyle would tell etoc to use \section* rather, hence no \clearpage.
    – user4686
    Sep 10, 2016 at 13:34

You must log in to answer this question.

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