2

When the number of sections and subsections goes into the double digits the chapter number and title in the minitoc start to overlap: enter image description here

\documentclass{book}

\usepackage{minitoc}

\setcounter{chapter}{9}
\begin{document}

\dominitoc% Initialization
\faketableofcontents

\chapter{bla}
\minitoc% Creating an actual minitoc

\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One

\end{document}

Any idea how to prevent this? Since I have a whole batch of documents like this it would be good to automate the width instead of applying a fixed width. Packages like tocstyle that offer settings like tocindentauto don't seem to affect mintoc.

1
  • This is actually rather a \l@subsection or \l@section issue, in my point of view.
    – user31729
    Apr 14, 2016 at 18:49

1 Answer 1

1

As far as I can see, minitoc does not provide settings for horizontal settings, i.e. the numwidth under concern here. This is either set within commands such as \l@section and \l@subsection etc or use tocloft to add some spacing to the \cftsubsecnumwidth length register.

(I am unsure whether tocloft and minitoc are always compatible!)

The numwidth box is to small here and must be extended, the indentation has no effect on the width of this box -- it just shifts the box (to the right, usually)

\documentclass{book}

\usepackage{tocloft}

\addtolength{\cftsubsecnumwidth}{10pt}
\usepackage{minitoc}

\setcounter{chapter}{9}
\begin{document}

\dominitoc% Initialization
\faketableofcontents

\chapter{bla}
\minitoc% Creating an actual minitoc

\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\section{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One
\subsection{One}
One

\end{document}

enter image description here

5
  • Thanks, is there anyway to auto indent rather than simply fixing the width to the widest known number of chapter numbers? Apr 14, 2016 at 18:56
  • @ADarkDividedGem: This would require some testing of the width of the largest chapter number. \addtolength is normally a good way, better than \setlength{...}
    – user31729
    Apr 14, 2016 at 18:57
  • 1
    And actually it's not the indent that causes the problem -- the numwidth is the problem. The indent just shifts the 'number' box to the right
    – user31729
    Apr 14, 2016 at 18:59
  • Sorry wasn't familiar with the technical term but if no one can provide an automated way of increasing the number I will accept this as the answer and just pre-process the document counting the number of subsections to determine the width needed. Apr 14, 2016 at 19:23
  • @ADarkDividedGem: It's possible, I think, but requires much more work. If you want to the total numbers of subsections you can apply xassoccnt (a package I've written), but it's more work to do
    – user31729
    Apr 14, 2016 at 19:25

You must log in to answer this question.

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