1

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?

1 Answer 1

1

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.

4
  • Thank you, @Norman Gray. This solves my problem! It also appears to avoid the tediousness of fitting {textblock} elements from textpos exactly to the margins of the document. Commented Nov 26, 2021 at 11:34
  • There is probably a smart way of fitting {textblock} to the geometry margins but it is beyond my comprehension of the package. Thank you again! Commented Nov 26, 2021 at 11:42
  • Actually, although absolutely correct, I experienced a few hiccups in the frontmatter and backmatter. Since everything is shifted down with this solution (although correct for the MWE), is it possible to distinguish between numbered chapters in the mainmatter and unnumbered ones in the frontmatter and backmatter? Thank you again. Commented Nov 26, 2021 at 15:58
  • That is indeed possible – see the edited version (not tested). It should be possible, by the way, to create a {textblock*} with width \textwidth Commented Nov 26, 2021 at 16:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .