Here's one possible solution using titletoc
for both the main and the partial ToCs; the titlesec
package was also used so that \chapter
will start and print its partial ToC automatically:
\documentclass{book}
\usepackage{titlesec}
\usepackage{titletoc}
\newcommand\partialtocname{\contentsname}
\begin{document}
\tableofcontents
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
[\vspace*{2pc}\titlerule\vspace*{1pc}%
\startcontents\vbox{\Large\partialtocname}\vskip1ex
\printcontents{l}{1}{\setcounter{tocdepth}{1}}\vspace*{1pc}\titlerule]
\titlecontents*{lsection}[0pt]
{\small\normalfont}{\thecontentslabel\space}{}
{,~\itshape\thecontentspage}[\space\textbullet\space][.]
\titlecontents*{lsubsection}[0pt]{}{}{}{}
\chapter{Chapter One}
\section{Section One One}
\subsection{Subsection One One One}
\subsection{Subsection One One Two}
\section{Section One Two}
\subsection{Subsection One Two One}
\subsection{Subsection One Two Two}
\section{Section One Three}
\subsection{Subsection One Three One}
\subsection{Subsection One Three Two}
\chapter{Chapter Two}
\section{Section Two One}
\subsection{Subsection TwoOne One}
\subsection{Subsection Two One Two}
\section{Section Two Two}
\subsection{Subsection Two Two One}
\subsection{Subsection Two Two Two}
\end{document}
The main ToC:
The partial ToCs:
and
Of course, your thesis will have some chapters that won't require a partial ToC such as those of the front and backmatter sections (Acknowledgements, Preface, Main ToC, possibly Appendices and the Bibliography). I did a improvement to my initial code defining a boolean to let you easily activate and deactivate the partial ToCs; initially the boolean is set to false, so the frontmatter chapters won't have partial ToCs; once you begin the mainmatter (in fact, whenever you want to start using partal ToCs) all you have to do is to set the boolean to true using \chapterwithtoctrue
. For the backmatter (or, in general, to deactivate the partial ToCs) all you have to do is to set the boolean to false using \chapterwithtocfalse
; a complete example:
\documentclass{book}
\usepackage{titlesec}
\usepackage{titletoc}
% The name to be used as title for the partialToCs
% initially set to be equal to \contentsname
\newcommand\partialtocname{\contentsname}
% depending on this boolean, \chapter will create or not a partial ToC
\newif\ifchapterwithtoc
\chapterwithtocfalse
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
[\ifchapterwithtoc
\vspace*{2pc}\titlerule\vspace*{1pc}%
\startcontents\vbox{\Large\partialtocname}\vskip1ex
\printcontents{l}{1}{\setcounter{tocdepth}{1}}\vspace*{1pc}\titlerule%
\else\fi%
]
\titlecontents*{lsection}[0pt]
{\small\normalfont}{\thecontentslabel\space}{}
{,~\itshape\thecontentspage}[\space\textbullet\space][.]
\titlecontents*{lsubsection}[0pt]{}{}{}{}
\begin{document}
\frontmatter
\chapter*{Acknowledgements}
\chapter*{Preface}
\tableofcontents
\mainmatter
\chapterwithtoctrue
\chapter{Chapter One}
\section{Section One One}
\subsection{Subsection One One One}
\subsection{Subsection One One Two}
\section{Section One Two}
\subsection{Subsection One Two One}
\subsection{Subsection One Two Two}
\section{Section One Three}
\subsection{Subsection One Three One}
\subsection{Subsection One Three Two}
\chapter{Chapter Two}
\section{Section Two One}
\subsection{Subsection TwoOne One}
\subsection{Subsection Two One Two}
\section{Section Two Two}
\subsection{Subsection Two Two One}
\subsection{Subsection Two Two Two}
\backmatter
\chapterwithtocfalse
\chapter{Appenix One}
\chapter{Appenix Two}
\end{document}
This can be improved even more by appropriately patching (wuth the help of the etoolbox
package, for example) \frontmatter
, \mainmatter
and \backmatter
.
This is known problem because of starred chapters. Here are two ways:
1 (not recommended) Replace \setcounter{mtc}{9}
with \setcounter{mtc}{6}
(well try to find the correct value)
2 Remove \setcounter{mtc}{9}
and redefine \addtotoc
\renewcommand\addtotoc[1]{%
\refstepcounter{dummy}%
\addstarredchapter{#1}% or \mtcaddchapter[#1]%
\markboth{#1}{}}
Best Answer
minitoc
produces a file<jobname>.mtc?
for each of the chapter-level sectioning commands in the thesis template (here?
denotes the current chapter-level section). So, if<jobname>
isThesis
,Thesis.mtc1
corresponds to "Declaration of Authorship"Thesis.mtc2
corresponds to "Abstract"Thesis.mtc3
corresponds to "Acknowledgements"Thesis.mtc4
corresponds to "List of Figures"Thesis.mtc5
corresponds to "List of Tables"Thesis.mtc6
corresponds to "Abbreviations"Thesis.mtc7
corresponds to "Physical Constants"Thesis.mtc8
corresponds to "Symbols"Thesis.mtc9
corresponds to "1 Chapter Title Here"Thesis.mtc10
corresponds to "A Appendix Title Here"Thesis.mtc11
corresponds to "Bibliography"These files are created with a call to
\dominitoc
, which cycles through the chapter-level commands and extracts the relevant ToC entries associated with each chapter. The thesis documentclassThesis.cls
defines a commandused throughout to add elements to the ToC at the chapter-level. As such,
minitoc
mistakenly mixes up the chapter numbering, as given above in the files generated after issuing\dominitoc
.To help
minitoc
in choosing the appropriate.mtc?
file, we can set theminitoc
ToC counter, ormtc
, to the appropriate number before the chapter so that the extraction for the actual\minitoc
associated with Chapter 1 is used. As such, usesince
mtc
is incremented with\chapter
.On a side note, one can see that only
Thesis.mtc9
has a file size greater than 0 bytes, while all others are empty, since they produce no sub-chapter-level ToC entries.