3

I'm using minitoc and I want to adjust the vertical space between the title and the contents, shown in the image below:

Spacing between minitoc title and contents

Here's my MWE:

\documentclass{book}    
\usepackage{minitoc}    
\nomtcrule
\begin{document}    
  \dominitoc
  \faketableofcontents    
  \chapter{Minimum}
    \minitoc
    \section{Working}
    \section{Example}    
\end{document}
4
  • minitoc is a nice package. Do you need it just for this occurence?
    – user31729
    Commented Aug 6, 2015 at 14:36
  • Well I'm writing a thesis with 4 chapters in it, but yes I guess I only need it for this one document. I've tried redefining \mtctitle to include a line break and even some \vspace at the end — these give the desired effect but throw some LaTeX errors, which I would like to avoid. Commented Aug 6, 2015 at 14:41
  • To be honest I'm surprised it hasn't been asked before... I appreciate the help! Commented Aug 6, 2015 at 14:59
  • @JohnJ.Camilleri answer edited
    – touhami
    Commented Aug 6, 2015 at 23:17

2 Answers 2

5

Use \mtcsetfeature{minitoc}{open}{\vspace{1cm}}

\documentclass{book}   
\usepackage{minitoc}    

\mtcsetfeature{minitoc}{open}{\vspace{1cm}}
\nomtcrule
\begin{document}    
  \dominitoc
  \faketableofcontents    
  \chapter{Minimum}
    \minitoc
    \section{Working}
    \section{Example}    
\end{document}
1
  • Your last solution using \mtcsetfeature works perfectly, thanks! (Didn't need to try the other solutions...) Commented Aug 7, 2015 at 5:45
3

Well, \minitoc is a strange command ;-)

I would like have provided a cleaner way, but xpatch does not work here (or I've not found it so far), so it's down to redefining \minitoc@, the base command of \minitoc.

The title itself is set in tabular environment -- if there's no mtc@rule, the upper part of the conditional is used, leaving almost no space -- I've added a new length and replaced \\ with \\[\mymtcaftertitleskip] then.

        \ifx\mtc@rule\relax
         \begin{tabular}{@{}p{\columnwidth}@{}}
           \reset@font\mtifont\do@mtitc{\mtc@v\mtctitle}\\[\mymtcaftertitleskip]%
         \end{tabular}%
        \else
         \begin{tabular}{@{}p{\columnwidth}@{}}
           \reset@font\mtifont\do@mtitc{\mtc@v\mtctitle}\\\hline
         \end{tabular}%
        \fi

Don't be afraid of the long \def\minitoc@ -- it's from minitoc.sty.

\documentclass[]{book}    
\usepackage{minitoc}    


\newlength{\mymtcaftertitleskip}
\setlength{\mymtcaftertitleskip}{2ex} % For example

\makeatletter

\def\minitoc@[#1]{%
\global\@minitoc@used@true
\if@mtc@longext@
   \def\@tocfile{mtc\The@mtc}%
\else
   \def\@tocfile{M\The@mtc}%
 \fi
        \mtc@CkFile{\jobname.\@tocfile}
        \if@mtc@FE
        \mtcPackageInfo[I0006]{minitoc}%
           {\jobname.\@tocfile\space is empty}
        \@mtc@empty@minitoc@true
        \else
        \thispageminitocstyle
%%        \mtc@markboth{\MakeUppercase{\mtctitle}}{\MakeUppercase{\mtctitle}}%
        \beforeminitoc
        \relax\begin{samepage}%
        \if #1e\let\do@mtitc\e@mti
         \else\if #1n\let\do@mtitc\n@mti
         \else\if #1c\let\do@mtitc\c@mti
         \else\if #1l\let\do@mtitc\l@mti
         \else\if #1r\let\do@mtitc\r@mti
         \else\if #1d\let\do@mtitc\df@mtitc
        \fi\fi\fi\fi\fi\fi
        \mtc@CkStr{\mtctitle}\if@mtc@FE \let\do@mtitc\e@mti\relax\fi
        \raggedright
        \parskip=\z@%
        \reset@font\mtcfont%
        \parindent=\z@%
        \nopagebreak[4]%
        \kern-0.8\baselineskip\nopagebreak[4]%
        \par\noindent %%
        \ifx\mtc@rule\relax
         \begin{tabular}{@{}p{\columnwidth}@{}}
           \reset@font\mtifont\do@mtitc{\mtc@v\mtctitle}\\[\mymtcaftertitleskip]%
         \end{tabular}%
        \else
         \begin{tabular}{@{}p{\columnwidth}@{}}
           \reset@font\mtifont\do@mtitc{\mtc@v\mtctitle}\\\hline
         \end{tabular}%
        \fi
        \nopagebreak[4]\null\leavevmode\mtc@zrule\\\mtc@BBR
        \leftmargin\mtcindent \rightmargin\mtcindent
        \itemindent=\z@\labelwidth=\z@%
        \labelsep=\z@\listparindent=\z@%
        \begin{mtc@verse}{\mtcoffset}%
        \c@tocdepth=\c@minitocdepth
        \leavevmode\\\mtc@BBR\vskip -.5\baselineskip
\begingroup
  \makeatletter
  \@ifundefined{mtc@pgno}%
  {\let\@dottedtocline\@undottedtocline}{}
  \@fileswfalse\mtc@hook@beforeinputfile
  \mtc@setform%
  \openminitoc \global\inminitoctrue
  \@input{\jobname.\@tocfile}%
  \global\inminitocfalse\closeminitoc
  \vspace{-1ex} \vspace{-\baselineskip}
  \leavevmode\mtc@strut
  \global\@nobreakfalse\endgroup
        \end{mtc@verse}%
        \kernafterminitoc
        \nopagebreak[4]\mtc@bottom@rule\null\leavevmode\\%
        \vskip-1.0\baselineskip\mtc@zrule\end{samepage}%
        \par\pagebreak[1]\vspace*{-1ex}\afterminitoc\fi}

\makeatother





\nomtcrule
\begin{document}    
  \dominitoc
  \faketableofcontents    
  \chapter{Minimum}
    \minitoc
    \section{Working}
    \section{Example}    
\end{document}

enter image description here

Edit Now the much shorter solution, with the help of egreg and Heiko Oberdiek:

\minitoc uses \minitoc@ internally, which is actually later on copied to \sv@minitoc@ by a \let statement. So it's necessary to patch \sv@minitoc@ then:

\documentclass[]{book}    
\usepackage{minitoc}    


\usepackage{xpatch}
\newlength{\mymtcaftertitleskip}
\setlength{\mymtcaftertitleskip}{2ex} % For example

\makeatletter
\xpatchcmd{\sv@minitoc@}{%
  \begin{tabular}{@{}p{\columnwidth}@{}}
    \reset@font\mtifont\do@mtitc{\mtc@v\mtctitle}\\
  \end{tabular}%
}{%
  \begin{tabular}{@{}p{\columnwidth}@{}}
    \reset@font\mtifont\do@mtitc{\mtc@v\mtctitle}\\[\mymtcaftertitleskip]%
  \end{tabular}%
}{\typeout{Patch success}}{\typeout{Patch failed}}  

\makeatother

\nomtcrule
\begin{document}    
  \dominitoc
  \faketableofcontents    
  \chapter{Minimum}
    \minitoc
    \section{Working}
    \section{Example}    
\end{document}
2
  • Really appreciate your help, but @touhami's solution using \mtcsetfeature works like a charm, so I have made that the accepted answer. Commented Aug 7, 2015 at 5:48
  • @JohnJ.Camilleri: No worries. I learned some crucial points about xpatch through this
    – user31729
    Commented Aug 7, 2015 at 8:10

You must log in to answer this question.

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