# Partial ToC over the chapter title

I want to create something similar to that on a chapter page:

  _____________________________
|                            |
|         Section 1 .... 3   |
|         Section 2 .... 5   |
|                            |
|                            |
|   Chapter Title            |
|                            |
|____________________________|

• Which document class are you using? – Gonzalo Medina May 5 '14 at 16:28
• a combination of titlesec and titletoc (using its commands for partial tocs) should help here; as Gonzalo mentions, the documentclass is important – cmhughes May 5 '14 at 16:36
• I'm using extreport. – jlanza May 6 '14 at 6:56

Here's one possibility using the titletoc package to generate the partial ToCs; a boolean switch \partialtoc is provided to activate/deactivate the partial ToCs at will (in the example below \partialtocfalse was used just before the appendix to prevent the partial ToC):

\documentclass[openany]{book}
\usepackage{titletoc}
\usepackage{etoolbox}

\newif\ifpartialtoc
\partialtoctrue

\makeatletter
{\vspace*{50\p@}}
{\ifpartialtoc
\vspace*{0\p@}%
\hfill\smash{\raisebox{\height}{%
\begin{minipage}{.8\textwidth}
\printcontents{}{1}{\section*{\contentsname}}
\end{minipage}%
}%
}\vskip50pt\par
\else
\vspace*{50pt}%
\fi%
}
{}
{}
\pretocmd{\chapter}{\startcontents}{}{}
\makeatother

\begin{document}

\chapter{Test chaper one}
\section{Test section one one}
\section{Test section one two}
\section{Test section one three}
\section{Test section one four}

\chapter{Test chaper one}
\section{Test section two one}
\section{Test section two two}
\section{Test section two three}

\appendix
\partialtocfalse
\chapter{Test Appendix}

\end{document}


The output:

A zoomed-in image for the first page of chapter one:

## Update:

In a comment, it has been requested to get a similar result using titlesec and its \titleformat command; here's one possibility:

\documentclass[openany]{book}
\usepackage{titlesec}
\usepackage{titletoc}

\newif\ifpartialtoc
\partialtoctrue

\titleformat{\chapter}[display]
{\startcontents\normalfont\huge\bfseries}
{\PartialToc\chaptertitlename\ \thechapter}
{20pt}
{\Huge}

\newcommand\PartialToc{%
\begingroup
\ifpartialtoc
\normalsize\normalfont
\vspace*{0pt}%
\hfill\smash{\raisebox{\height}{%
\begin{minipage}{.8\textwidth}
\printcontents{}{1}{\textbf{\large\contentsname}\vskip10pt}
\end{minipage}%
}%
}\vskip50pt\par
\else
\vspace*{50pt}%
\fi%
\endgroup
}

\begin{document}

\chapter{Test chapter one}
\section{Test section one one}
\section{Test section one two}
\section{Test section one three}
\section{Test section one four}

\chapter{Test chapter two}
\section{Test section two one}
\section{Test section two two}
\section{Test section two three}

\appendix
\partialtocfalse
\chapter{Test Appendix}

\end{document}

• Would it be possible to do the same just by using titleformat and a PartialToC command? And in the titlesec I will include the minipage code. I ask so cause I spent some time trying. – jlanza May 6 '14 at 7:05
• @jlanza Sure. Please see my updated answer (just at the end). Is it something like that what you had in mind? – Gonzalo Medina May 6 '14 at 13:26
• Thanks. That was what I was looking for. Actually I almost got it ;) Except I didn't use the minipage and that was my problem. – jlanza May 7 '14 at 7:07