3

I'm writing a large book, using minitoc to put a small table of contents at the start of each chapter. But it looks terrible.

I would like instead to put the minitoc on the facing page before the first page of the chapter. For example, if Chapter 9 starts on page 503, then I would like the minitoc for Chapter 9 to appear on page 502.

I know how to clear to an even page. The question is what do I use instead of \minitoc to get the minitoc for the next chapter rather than the current one?


Related question: How to put a figure on the facing page of a chapter page with correct numbering?

2 Answers2

6

Well, this is a somewhat hidden feature, but minitoc provides for the \adjustmtc command, that is meant for starred chapters etc., i.e. for the case that the mtc counter is off by one.

This command can be 'misused' to provide the minitoc for the following chapter.

The \adjustmtc[n] command is documented on page 34 of the current manual of minitoc. The optional argument holds the number of minitocs to be incremented (default n=1)

\documentclass{book}

\usepackage{minitoc}
\usepackage{blindtext}


\setcounter{minitocdepth}{3}
\setcounter{secnumdepth}{3}

\dominitoc

\begin{document}
\tableofcontents
\markboth{}{}
\clearpage
\adjustmtc
\minitoc
\chapter{First}

\section{Foo}
\blindtext[2]

\subsection{FooFoo}
\blindtext[5]
\subsubsection{FooFooFoo}
\blindtext[5]
\chapter{Foobar}
\end{document}

Please note: The \setcounter... statements are just for filling up the minitoc etc. with a amount of entries -- they are not important for the functionality.

enter image description here

Update (with some the \cleartoevenpage code from `jfbu's answer!)

This works now automatically, i.e. \chapter adds the minitoc on the even page before.

\documentclass{book}

\usepackage{xparse}

\usepackage{minitoc}

\setcounter{tocdepth}{5}

\usepackage{blindtext}

\setcounter{minitocdepth}{3}
\setcounter{secnumdepth}{3}

\makeatletter
\let\latex@chapter\chapter

\newcommand*\cleartoevenpage {%
   \clearpage 
   \if@twoside \ifodd \c@page \hbox {}\newpage 
   \if@twocolumn \hbox {}\newpage \fi 
   \fi \fi 
 }

% Automatic addition of minitoc
\RenewDocumentCommand{\chapter}{som}{%
  \def\@@chaptertitlefortoc{#3}%
  \IfValueTF{#2}{%
    \def\@@chaptertitlefortoc{#2}%
  }%
  \IfBooleanTF{#1}{%
    \latex@chapter*{#3}
  }{%
    \cleartoevenpage
    \markboth{}{}%
    \ifnum\value{chapter} = 0
    \adjustmtc
    \fi
    \minitoc
    \latex@chapter[\@@chaptertitlefortoc]{#3}
  }
}



\makeatother

\dominitoc

\begin{document}
\tableofcontents
\chapter{First}

\section{Foo}
\blindtext[2]

\subsection{FooFoo}
\blindtext[5]
\subsubsection{FooFooFoo}
\blindtext[5]

\chapter{Foobar}
\blindtext[5]
\section{Foo}
\blindtext[5]


\chapter{Foobar other}
\blindtext[5]
\section{Other Foo}
\blindtext[5]

\end{document}
  • how does it work with more than one chapter ? I tried but did not succeed. –  Feb 07 '16 at 07:37
  • 1
    @jfbu: \decrementptc before the next chapter occurs –  Feb 07 '16 at 09:53
  • doesn't work for me. Can you complete your answer with how it works for you ? –  Feb 07 '16 at 10:05
  • @jfbu: Actually your \cleartoevenpage is quite important to make my solution work, in my point of view. I suggest to use your solution! (I hope you don't mind using \cleartoevenpage) –  Feb 07 '16 at 15:05
  • ok, it works. Your solution is the good one for minitoc users. \cleartoevenpage is simply \cleardoublepage with odd<->even. Thus, yes, I guess you may use it. Will consult with my legal advisor though ;-) –  Feb 07 '16 at 15:53
  • @jfbu: minitoc is nice, etoc is nice too, but your package is more up-to-date and has the better documentation of course. –  Feb 07 '16 at 15:56
  • @jfbu: Page shipping out features is not my strongest topic -- the \cleartoevenpage macro is quite nice –  Feb 07 '16 at 16:26
  • too much compliments, I have no other choice but upvoting your answer ! –  Feb 07 '16 at 21:03
  • @jfbu: I've upvoted your solution long ago :-P (thanks!) –  Feb 07 '16 at 21:04
  • of course, I knew. And guilt proved too much. I couldn't resist during the ad break during my tv movie. –  Feb 07 '16 at 21:06
5

You can use etoc for this, via its label/ref mechanism for tocs.

\documentclass{book}

\usepackage{etoc}
\usepackage{blindtext}

\makeatletter
\newcommand*\cleartoevenpage {%
   \clearpage 
   \if@twoside \ifodd \c@page \hbox {}\newpage 
        \if@twocolumn \hbox {}\newpage \fi 
   \fi \fi }
\makeatother


\begin{document}


\tableofcontents


% switch to article like style for table of contents
% (else they will start like chapters on odd numbered pages)
% would need adjustment in two-column mode

\etocarticlestyle
\renewcommand*\etocbeforetitlehook {\cleartoevenpage}


\tableofcontents\ref{toc:first}

\chapter{First}
\invisiblelocaltableofcontents\label{toc:first}

\section{Foo}
\blindtext[2]

\subsection{FooFoo}
\blindtext[5]
\subsubsection{FooFooFoo}
\blindtext[5]

\section{Foo2}
\blindtext[3]

\subsection{FooFoo2}
\blindtext[7]
\subsubsection{FooFooFoo2}
\blindtext[7]


\tableofcontents\ref{toc:bar}
\chapter{Bar}
\invisiblelocaltableofcontents\label{toc:bar}

\section{Bar}
\blindtext[2]

\subsection{BarBar}
\blindtext[5]
\subsubsection{BarBarBar}
\blindtext[5]


\tableofcontents\ref{toc:ear}
\chapter{Ear}
\invisiblelocaltableofcontents\label{toc:ear}

\section{Ear}
\blindtext[2]

\subsection{EarEar}
\blindtext[5]
\subsubsection{EarEarEar}
\blindtext[5]

\section{Ear2}
\blindtext[3]

\subsection{EarEar2}
\blindtext[7]
\subsubsection{EarEarEar2}
\blindtext[7]


\tableofcontents\ref{toc:fur}
\chapter{Fur}
\invisiblelocaltableofcontents\label{toc:fur}

\section{Fur}
\blindtext[2]

\subsection{FurFur}
\blindtext[5]
\subsubsection{FurFurFur}
\blindtext[5]


\end{document}

Screenshots:

enter image description here

enter image description here

enter image description here