7

I have implemented the following code.

\documentclass[12pt]{book} 
\usepackage{etoc}

\begin{document}

\chapter{First Chapter}

\renewcommand{\contentsname}{}
\setcounter{tocdepth}{2}
\etocsettocstyle{\subsection*{\contentsname}\hrule\smallskip
\begin{minipage}{\linewidth}}
{\end{minipage}\medskip\hrule}

\localtableofcontents

\section{Section 1}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 2}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 3}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 4}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 5}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 6}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 7}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 8}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}

\end{document}

Basically, it generates that the etoc starts on the second page instead of the first page.

etoc

How do I ensure that it starts from the first page and continues on the second?

1 Answer 1

10

Why are you putting it inside a minipage?

I think

\etocsettocstyle{\bigskip\hrule\medskip}{\medskip\hrule\vfill}

should do what you want without re-defining the meaning of \contentsname.

MWE

\documentclass[12pt]{book}
\usepackage{etoc}

\begin{document}

\chapter{First Chapter}

\setcounter{tocdepth}{2}
\etocsettocstyle{\bigskip\hrule\medskip}{\medskip\hrule\vfill}

\localtableofcontents

\section{Section 1}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 2}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 3}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 4}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 5}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 6}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 7}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}
\section{Section 8}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsection{Subsection 3}

\end{document} 

Output:

enter image description here

You must log in to answer this question.

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