chapters – How to Fix Absolute Position of Minitoc on Chapter Title Page

chaptersminitoctextpos

I am using minitoc below every chapter title in my document. However, depending on the size of the chapter title, minitoc shifts down. This does not look great since my chapter titles differ in size, and therefore when you go through the document minitoc appears at different positions on the chapter title page. This problem is exemplified in the MWE below:

\documentclass[pdftex,10pt,b5paper,twoside]{book}
\usepackage[lmargin=25mm,rmargin=25mm,tmargin=27mm,bmargin=30mm]{geometry}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage{quotchap}
\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{mdframed}
\usepackage[nohints,tight]{minitoc} 
    \setcounter{minitocdepth}{1} 

\begin{document}

\dominitoc

\tableofcontents

\chapter[ONE]{RATHER LONG TITLE THAT OCCUPIES MORE THAN ONE LINE AND THUS SHIFTS THE MINITOC BELOW DOWN} \label{chap:1}

\minitoc

\vfill

\begin{mdframed}

Comments on Chapter~\ref{chap:1} also varying in size.

\end{mdframed}

\clearpage

\section{SECTION ONE}

\lipsum[1-2] \cite{lipsum}.

\section{SECTION TWO}

\lipsum[1-2] \cite{lipsum}.

\section{SECTION THREE}

\lipsum[1-2] \cite{lipsum}.

\cleardoublepage

\chapter[TWO]{SHORT TITLE} \label{chap:2}

\minitoc

\vfill

\begin{mdframed}

Comments on Chapter~\ref{chap:2} which also may vary in size but should not influence the position of the \texttt{minitoc}.

\end{mdframed}

\clearpage

\section{SECTION ONE} 

\lipsum[1-2] \cite{lipsum}.

\section{SECTION TWO}

\lipsum[1-2] \cite{lipsum}.

\section{SECTION THREE}

\lipsum[1-2] \cite{lipsum}.

\section{SECTION FOUR}

\lipsum[1-2] \cite{lipsum}.

\subsection{SUBSECTION FOUR ONE}

\lipsum[1-4] \cite{lipsum}.

\cleardoublepage

\begin{thebibliography}{9}
\bibitem{lipsum} 
Patrick Happel.
lipsum -- Easy access to the Lorem Ipsum dummy text.
2014
\end{thebibliography}

\cleardoublepage

\end{document}
  • Is there a way to fix the absolute position of minitoc so that it is consistent on all chapter pages?

  • Should I consider textpos or is that mainly used for beamers or posters?

Best Answer

I think there are two ways to address this.

One is indeed to use textpos, which can be used in all sorts of documents. If you were to include textpos with the [absolute] option, that causes the {textblock} elements to be located at absolute positions on the page, so that putting your \minitoc in there should position it at the same point each time.

The other way – which appeals more, to me, but which is rather disreputable – is to hack \chapter.

The macro \chapter calls \@makechapterhead internally, both in standard book.cls and also, it seems, after {quotchap} redefines it. We can peek at {quotchap}'s definition, and then redefine it:

\makeatletter
\let\@makechapterhead@fmbm\@makechapterhead % save default
\def\@makechapterhead@mainmatter#1{
  \vbox to 10cm{% or whatever size you prefer
    \chapterheadstartvskip
    \size@chapter\sectfont
    \raggedleft
    \ifnum \c@secnumdepth >\m@ne
      {\chapnumfont\thechapter\par\nobreak}
    \fi
    \advance\leftmargin 10em
    \interlinepenalty \@M
    #1\par
    %\hrule %uncomment to see the result of the spacing
    \vss}
  %\hrule %ditto
  \nobreak}
\def\@makechapterhead{
  % use our new one in the mainmatter
  \if@mainmatter
    \let\next\@makechapterhead@mainmatter
  \else
    % and the original in the front- and back-matter
    \let\next\@makechapterhead@fmbm
  \fi
  \next}
\makeatother

That sets the chapter heading in a box of a fixed size. You could even append \minitoc after the \nobreak, and save yourself the terrible labour of typing that out each chapter!

I'm not saying that this is necessarily good practice, but it's probably what I'd find myself doing in this situation (but I have a fairly high pain threshold when it comes to hacking LaTeX). Incidentally, you have a careful set of packages there. In your situation, I might well dump them in a file mybook.cls (perhaps along with a definition such as that above), and start using \documentclass{mybook} in the various documents I use it.