Chapter 1 The minitoc package

Contents

1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.2.1 Fonts and Titles . . . . . . . . . . . . . . . . . . . 6 1.2.2 Special Features . . . . . . . . . . . . . . . . . . . 8

Horizontal Rules . . . . . . . . . . . . . . . . . . . 8 Page Numbers . . . . . . . . . . . . . . . . . . . . 9 The “Chapter 0” Problem . . . . . . . . . . . . . . 9

1.2.3 Usage with MS-DOS . . . . . . . . . . . . . . . . . 9 1.3 The minitocoff package . . . . . . . . . . . . . . . . 10

Tables

1.1 Commands for a minitoc . . . . . . . . . . . . . . . . . . 3 1.2 Commands for a secttoc . . . . . . . . . . . . . . . . . . 4 1.3 Commands for a parttoc . . . . . . . . . . . . . . . . . . 5

1.1 Introduction

This package, initially written by Nigel Ward and Dan Jurafsky, has been almost completely redesigned at CERT/ONERA by Jean-Pierre Drucbert.

It creates a mini-table of contents (a “minitoc”^{1}) at the beginning of each chapter of the document. It is also possible to have a mini-list of figures (a “minilof”) and a mini-list of tables (a “minilot”). The document class should of course define chapters (styles like book or report) or sections (styles like article). Thus, this package should not be used with document classes without sectioning commands (like letter). When the document class defines a “part” sectionning level (i.e. classes like book, report and article), you can create a “partial” table of contents (a “parttoc”) at the beginning of each part of the document. It is also possible to have a partial list of figures (a “partlof”) and a partial list of tables (a “partlot”). When the document class has no \chapter command but has a \section command, you may use section level tables of contents (“secttoc”) at the beginning of each section.

Note: you cannot use chapter level and section level table of contents in the same document. This restriction is intented to avoid documents full of local tables of contents, list of figures and tables at every sectionning level.

The current version of this package is #24.

Note: the commands relative to the part level are defined only if the document class defines \part. The commands relative to the section level are defined only if the document class does not define \chapter.

1.2 Usage

To use the minitoc package, you must introduce a command

\usepackage{minitoc}

in the preamble of your document. The mini-table of contents will appear in the chapter, after the \chapter command, at the point of the \minitoc command. The \minitoc command may occur anywhere inside a chapter. Of course, it is better to put it at the beginning of the chapter, eventually after some introductory material. But you can also decide to put it at the end of the chapter. You should use the same conventions in all chapters. If you want to add the mini-table of contents for a chapter, you must use the sequence given in Table 1.1 For each mini-table of contents, an auxiliary file

1The minitoc package introduces its own jargon, explained in this note. It should not be too difficult, however, to learn and use.

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

\setcounter{minitocdepth}{2}  default
\setlength{\mtcindent}{24pt}  default
\renewcommand{\mtcfont}{\small\rm} default
\renewcommand{\mtcSfont}{\small\bf} default

...
\begin{document}
...
\dominitoc
\dominilof
\dominilot

\tableofcontents                     or \faketableofcontents
\listoffigures                       or \fakelistoffigures
\listoftables                        or \fakelistoftables

...
\chapter{...}

\minitoc                             if you want one
\minilof                             if you want one
\minilot                             if you want one

...

             Table 1.1:  Commands for a minitoc

will be created with a name of the form ⟨document⟩.mtc⟨N ⟩, where ⟨N ⟩ is the absolute chapter number. “Absolute” means that this number is unique, and increasing from the first chapter. The suffix is .mlf⟨N ⟩ for mini-lists of figures and is .mlt⟨N ⟩ for mini-lists of tables. (If you are under MS-DOS or any operating system with short extensions to filenames, see Section 1.2.3).

The section-level table of contents will appear in the section, after the \section command, at the point of the secttoc command. The \secttoc command may occur anywhere inside a section. Of course, it is better to put it at the beginning of the section, eventually after some introductory material. You should use the same conventions in all sections. If you want to add the section-level table of contents for a section, you must use the sequence given in Table 1.2 For each section-level table of contents, an auxiliary file will be created with a name of the form ⟨document⟩.stc⟨N ⟩, where ⟨N ⟩ is the absolute section number. The suffix is .slf⟨N ⟩ for section-level lists

\documentclass[...]{article}
\usepackage{minitoc}
...

\setcounter{\secttocdepth}{2}  default
\setlength{\stcindent}{24pt}  default
\renewcommand{\stcfont}{\small\rm}  default
\renewcommand{\stcSSfont}{\small\bf} default

...
\begin{document}
...
\dosecttoc
\dosectlof
\dosectlot

\tableofcontents                      or \faketableofcontents
\listoffigures                        or \fakelistoffigures
\listoftables                         or \fakelistoftables

...
\chapter{...}

\secttoc                              if you want one
\sectlof                              if you want one
\sectlot                              if you want one

...

             Table 1.2:  Commands for a secttoc

of figures and is .slt⟨N ⟩ for section-level lists of tables. (If you are under MS-DOS or any operating system with short extensions to filenames, see Section 1.2.3).

If you want to add the partial table of contents for a part, you must use the sequence given in Table 1.3. For each partial table of contents, an auxiliary file will be created with a name of the form ⟨document⟩.ptc⟨N ⟩, where ⟨N ⟩ is the part number. The suffix is .plf⟨N ⟩ for partial lists of figures and is .plt⟨N ⟩ for partial lists of tables. (If you are under MS-DOS or any operating system with short extensions to filenames, see Section 1.2.3).

Note: the user is responsible of requiring or not requiring a mini-toc (lof or lot) for some chapter. Asking a minilof for a chapter without any figure will result in an empty and ugly mini list of figures (i.e. the title and two horizontal rules). He is also responsible of requiring or not requiring a partial

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

\setcounter{parttocdepth}{2}  default
\setlength{\ptcindent}{0pt}  default
\renewcommand{\ptcfont}{\normalsize\rm} default
\renewcommand{\ptcCfont}{\normalsize\bf} default
\renewcommand{\ptcSfont}{\normalsize\rm} default

...
\begin{document}
...
\doparttoc
\dopartlof
\dopartlot

\tableofcontents                          or \faketableofcontents
\listoffigures                            or \fakelistoffigures
\listoftables                             or \fakelistoftables

...
\part{...}

\parttoc                                  if you want one
\partlof                                  if you want one
\partlot                                  if you want one

...

             Table 1.3:  Commands for a parttoc

toc (lof or lot) for some part. Asking a partlof for a part without any figure will result in an empty and ugly part list of figures (i.e. the title alone on a page). Analogous remarks apply to section-level tables of contents (secttoc, sectlof and sectlot).

By default, the mini-tables and partial tables of contents contain only references to sections and subsections. The minitocdepth and parttocdepth counters, similar to tocdepth, allows the user to modify this behaviour. Mini or partial lists of figures or tables are not affected by the value of these counters.

Note: if you are using \chapter* and a

     \addcontentsline{toc}{chapter}{...}

command to add something in the table of contents, the numbering of minitoc files would be altered. To avoid that problem, say

     \addcontentsline{toc}{starchapter}{...}

You should not use \minitoc in a \chapter*. Similar remarks apply to the part and section level.

1.2.1 Fonts and Titles

The mini and partial tables and lists are typeset in a verse-like environment, and can be split over pages. The mini-table of contents is typeset in the \mtcfont font, which is \small\rm by default. Section entries are typeset in the \mtcSfont font, which is \small\bf by default. For subsections, subsubsections, paragraphs and subparagraphs, the commands

\mtcSSfont, \mtcSSSfont, \mtcPfont and \mtcSPfont are available (by de-

fault, \small\rm) to enable the use of various fonts. Mini lists of figures and tables are typeset in the fonts \mlffont and \mltfont, which are \small\rm by default.

Titles are typeset in the \mtifont (\large\bf by default) font and the texts of the titles are defined by \mtctitle, \mlftitle and \mlttitle, which are the strings “Contents”, “Figures” and “Tables” by default. These commands should be redefined by \renewcommand for languages other than english. The option files mtcfrench.sty and mtcenglish.sty (and others^{2}) are available. You can easily prepare a similar style for your preferred language.

The partial table of contents is typeset in the \ptcfont font, which is defined as \normalsize\rm by default. Chapter entries are typeset in the \ptcCfont font, which is \normalsize\bf by default. Section entries are typeset in the \ptcSfont font, which is \normalsize\rm by default. For subsections, subsubsections, paragraphs and subparagraphs, the commands

\ptcSSfont, \ptcSSSfont, \ptcPfont and \ptcSPfont are available (by

2The strings defined in these option files were taken from the Babel system of Johannes Braams and some were adapted. Other languages are welcome.

default, \normalsize\rm) if you want to use various fonts. Partial lists of figures and tables are typeset in the fonts \mlffont and \mltfont, which

are \normalsize\rm by default.

Titles are typeset in the \ptifont (\Huge\bf by default) font and the texts of the titles are defined by \ptctitle, \plftitle and \plttitle, which are the strings “Table of Contents”, “List of Figures” and “List of Tables” by default. These commands should be redefined by \renewcommand for languages other than english. The option files mtcfrench.sty and mtcenglish.sty (and others, see footnote 2 above) are available. You can easily prepare a similar style for your preferred language.

The section-level table of contents is typeset in the \stcfont font, which is defined as \normalsize\rm by default. Subsection entries are typeset in the \stcSSfont font, which is \normalsize\bf by default. Subsubsection entries are typeset in the \stcSSSfont font, which is \normalsize\rm by default. For subsubsections, paragraphs and subparagraphs, the commands \stcSSSfont, \stcPfont and \stcSPfont are available (by default, \normalsize\rm) if you want to use various fonts. Partial lists of figures and tables are typeset in the fonts \slffont and \sltfont, which are \normalsize\rm by default.

Titles are typeset in the \stifont (\normalsize\bf by default) font and the texts of the titles are defined by \stctitle, \slftitle and \slttitle, which are the strings “Contents”, “Figures” and “Tables” by default. These commands should be redefined by \renewcommand for languages other than english. The option files mtcfrench.sty and mtcenglish.sty (and others, see footnote 2 above) are available. You can easily prepare a similar style for your preferred language.

By default, titles are on the left. The commands \dominitoc, \dominilof and \dominilot accept an optional argument to change the default position of the corresponding title: [l] for left (default), [c] for center, [r] for right, or [e] (or [n]) for empty (no title). The change is global for all the document.

If you want to change the position of the title for only one minitoc (or minilof or minilof), just use such an optional argument with the command

\minitoc (or \minilof or \minilot).

By default, titles are on the left. The commands \doparttoc, \dopartlof and \dopartlot accept an optional argument to change the default position of the corresponding title: [l] for left (default), [c] for center, [r] for right, or [e] (or [n])for empty (no title). The change is global for all the document.

By default, titles are on the left. The commands \dosecttoc, \dosectlof and \dosectlot accept an optional argument to change the default position of the corresponding title: [l] for left (default), [c] for center, [r] for right, or [e] (or [n]) for empty (no title). The change is global for all the document.

If you want to change the position of the title for only one secttoc (or sectlof or sectlof), just use such an optional argument with the command

\secttoc (or \sectlof or \sectlot).

The mini-tables and lists, as partial and section-level tables and lists, are using some space on the first pages on each chapter, part or section, thus the page numbers are altered. After the first L^{A}TEX run, the mini-tables and lists, partial tables and lists and section-level tables and lists will be empty; after the second run, they appear, but because they modify the page numbering, page numbers are wrong; after the third L^{A}TEX run, the mini, partial and section-level tables and lists should be correct.

1.2.2 Special Features

Horizontal Rules

By default, most of minitocs and siblings have horizontal rules after their titles and at their ends. The exception is the “partoc” in a book- or reportlike document (i.e. when \chapter is defined). To activate or desactivate these rules, the following commands are available:

defaults for

           rules in  no rules in book  report  article

\ptcrule parttocs \noptcrule parttocs  N  N  Y
\mtcrule minitocs \nomtcrule minitocs  Y  Y  N-A
\stcrule secttocs \nostcrule secttocs  N-A N-A  Y

Page Numbers

By default, the page numbers are listed in each minitoc, minilof, etc. Some authors want only the section titles (with the section numbers), but not the page numbers. Hence the obvious declarations below are available:

Type  Page numbers (Default)  No page numbers

      minitoc \mtcpagenumbers            \nomtcpagenumbers
      secttoc \stcpagenumbers            \nostcpagenumbers
      parttoc \ptcpagenumbers            \noptcpagenumbers
      minilof \mlfpagenumbers            \nomlfpagenumbers
      sectlof  \slfpagenumbers            \noslfpagenumbers
      partlof \plfpagenumbers            \noplfpagenumbers
      minilot \mltpagenumbers            \nomltpagenumbers
      sectlot \sltpagenumbers            \nosltpagenumbers
      partlot \pltpagenumbers            \nopltpagenumbers

The “Chapter 0” Problem

Some documents do not begin with chapter number one, but with chapter number zero (or even a weirder number). To make the minitoc option work with such documents, you must insert the command

     \firstchapteris{⟨N ⟩}

before the \dominitoc and analogous commands. ⟨N ⟩ is the number of your first chapter. This command does not modify the numbering of chapters, you must use a \addtocounter{chapter}{-1} command to get a first chapter numbered 0. The \firstpartis and \firstsectionis commands are analogous for parts and sections with a non standard numbering.

Since version #17c, these commands are obsolete, as this problem has been solved. Thus they just give a harmless warning.

1.2.3 Usage with MS-DOS

Under MS-DOS (and other PC oriented operating systems), the filename extensions are limited to 3 characters. Thus, it is olnl necessary to edit very slightly the file minitoc.sty. You have just to uncomment the line where \SHORTEXT is defined. All other modifications will be done automatically. The .mtc⟨N ⟩ suffix will become .M⟨N ⟩, where ⟨N ⟩ is the absolute chapter number. The suffixes .mlf⟨N ⟩ and .mlt⟨N ⟩ become .F⟨N ⟩ and .T⟨N ⟩. The .ptc⟨N ⟩ suffix will become .P⟨N ⟩, where ⟨N ⟩ is the part number. The suffixes .plf⟨N ⟩ and .plt⟨N ⟩ become .G⟨N ⟩ and .U⟨N ⟩. The .stc⟨N ⟩ suffix will become .S⟨N ⟩, where ⟨N ⟩ is the absolute section number. The suffixes .slf⟨N ⟩ and .slt⟨N ⟩ become .H⟨N ⟩ and .V⟨N ⟩. Of course, this implies a limit of 99 chapters in a document, but do you really need so many chapters (or sections in an article)? The limit of 99 parts does not seem too serious.

1.3 The minitocoff package

When a document has been prepared with the minitoc package, it contains many minitoc specific commands, most of them being \faketableofcontents and \minitoc commands (and their equivalents for lists of figures and tables). If you want to typeset this document without any mini-table, you have just to replace the minitoc package by the minitocoff package, and all these commands will be ignored. At least two L^{A}TEX runs will be necessary to get a correct page numbering and correct cross references.

Chapter 2

Frequently Asked Questions

Here is a list of problems and frequently asked questions about minitoc.sty. If your version has a number less than 24, please upgrade to version #24.

1. How avoid a page break near the rules before and after the minitoc? This problem seemed solved since version #8, but version #12 adds better fixes.

2. How about implementing others layouts for the minitoc? Suggestions are welcome.

3. \\ in a contents line makes an error.

Use \protect\linebreak.

4. If you reorder chapters, havoc follows… minitocs going in wrong chapters. The best way seems to make one run with the minitocoff package replacing the minitoc package, then restore the minitoc package and re-execute L^{A}TEX three times (yes, it is time consuming…). Running with the minitocoff package ensures that auxiliary are cleared from “spurious” commands introduced by minitoc.

5. This option creates auxiliary files with extensions like .mtc⟨N ⟩. Some operating systems allow only 3 letters extensions. What to do? If you have an operating system which tolerates only short file name extensions (of 3 characters, like with MS-DOS), you must edit the file minitoc.sty: find the line containing “%\def\SHORTEXT” and remove the leading percent sign. No other modification is needed: all is automatic!

6. Do not cheat with the “chapter” counter, i.e. do not write horrible things like \setcounter{chapter}{6}. The mechanism would break. It is better to add \chapter commands, to create empty (but numbered in a legal way) chapters. Since version #10, minitoc.sty works with appendices. Version #19 allows to begin with a chapter other that number 1.

7. Some demanding users want to have minilof, minilot and minibbl. First, minibbl is an other problem, strongly related to the BibTEX’s dealing with .aux files. Look at chapterbib.sty. Version #13 has implemented basic minilofs and minilots. Minibbls are not the aim of this package.

8. This package creates a lot of auxiliary files and some users argue that it is too many. A deep redesign would be necessary to avoid that. Using only one big auxiliary file (or one for all minitocs, one for all minilofs, …) would make the reading of such file very slow, and it would be read for each \miniXXX macro!

9. How to do minitocs (minilofs and minilots) at levels other than chapter? Here also, some redesign is needed. From version #15, there are parttocs, partlofs and partlots for the part level in book-like and articlelike documents, secttocs, sectlofs and sectlots for the section level in article-like documents. Note that you can not have minitocs features at chapter and section level in the same document, because doing so would make an unreadable monster. The user must choose the main style of the document accordingly to the size of it (e.g. do not write an article of more than 130 sections: this is a report, or even a book!).

part chapter section

              book  ∗  ∗
              report  ∗  ∗
              article ∗  ∗

10. Since version #23, works with document classes resetting chapter (or section) number at each part.