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}
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}
minitoc
is a nice package. Do you need it just for this occurence?\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.