1

I've got a problem with my tables of contents (both local and global...)

I want to include a section line in my main toc that does not appear in the minitoc of the previous chapter. Also I would like this line to be separated from the sections of the previous chapter in the main toc by at least one empty line.

I tried to make a minimum working example, in which you'll see that the "Figures" line is added to the minitoc of chapter 2 and seems to belong to chapter 2 in the main toc.

\documentclass[a4paper, 12pt, twoside]{report}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{minitoc}
    \setcounter{minitocdepth}{2}

\begin{document}

    \dominitoc

    \tableofcontents

    \chapter{The important things}
        \minitoc
        \section{foo}
        \section{bar}

    \chapter{Minor stuff}
        \minitoc
        \section{foo}
        \section{bar}

    \listoffigures
    \addcontentsline{toc}{section}{Figures}

\end{document}
1

By saying \addcontentsline{toc}{section}{Figures}, the OP is adding a "Figures" section to the existing chapter, which is chapter 2. Thus, it shows up in the toc and minitoc under chapter 2. The fix is to add the figure-list to the toc as its own chapter, not a section, which is accomplished with \addcontentsline{toc}{chapter}{Figures}.

Here is the MWE:

\documentclass[a4paper, 12pt, twoside]{report}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{minitoc}
    \setcounter{minitocdepth}{2}

\begin{document}

    \dominitoc

    \tableofcontents

    \chapter{The important things}
        \minitoc
        \section{foo}
        \section{bar}

    \chapter{Minor stuff}
        \minitoc
        \section{foo}
        \section{bar}

    \listoffigures
    \addcontentsline{toc}{chapter}{Figures}

\end{document}

Of course, that places the "Figures" in the toc in the style of a chapter:

enter image description here

One can manually force it to look like a section with the following:

\documentclass[a4paper, 12pt, twoside]{report}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{minitoc}
    \setcounter{minitocdepth}{2}
\makeatletter
\newcommand \Dotfill {\leavevmode \cleaders \hb@xt@ .79em{\hss .\hss }\hfill \kern \z@}
\makeatother
\begin{document}

    \dominitoc

    \tableofcontents

    \chapter{The important things}
        \minitoc
        \section{foo}
        \section{bar}

    \chapter{Minor stuff}
        \minitoc
        \section{foo}
        \section{bar}

    \listoffigures
%    \addcontentsline{toc}{chapter}{Figures}
    \addcontentsline{toc}{chapter}{\mdseries\hspace{1.5em}Figures\Dotfill}

\end{document}

enter image description here

For the \Dotfill, I employed the answer at How to change dot spacing in \dotfill?

  • I understand the logic and to be honest I tried this before. But if it's possible I would like the "Figures" line to appear indented and formatted as a section in the main table of contents. Maybe I should add it as a chapter (so that minitoc knows not to take it into account) and then change its individual formatting in the table of contents ? – Antoine G. Jul 29 '15 at 17:07
  • @AntoineG. Please see revision. – Steven B. Segletes Jul 29 '15 at 17:46
  • (+1): One should keep in mind, that minitoc is unmaintained basically for years now, which is quite sad, because it has very good features – user31729 Jul 29 '15 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.