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?

  • I'm tempted to try something vicious like increment the chapter counter, \minitoc, decrement the chapter counter. But maybe there is a right way to do it? – Norman Ramsey Feb 6 '16 at 17:53
  • 1
    the memoir class has an openleft option. maybe that could be useful. – barbara beeton Feb 6 '16 at 18:10
  • when I saw the question title my first thought was to do exactly what you suggest in the comment, so I'd make that an answer:-) – David Carlisle Feb 6 '16 at 18:49
  • @NormanRamsey: I suggest to use jfbu's solution -- it works out of the box! – user31729 Feb 7 '16 at 15:06
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. – user4686 Feb 7 '16 at 7:37
  • 1
    @jfbu: \decrementptc before the next chapter occurs – user31729 Feb 7 '16 at 9:53
  • doesn't work for me. Can you complete your answer with how it works for you ? – user4686 Feb 7 '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) – user31729 Feb 7 '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 ;-) – user4686 Feb 7 '16 at 15:53
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

  • This looks really interesting. I think I may be able to do something very powerful with this. – Norman Ramsey Feb 8 '16 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.