# Minitoc in Supplement - renewcommand causes problems?

I cannot get the minitoc package to create a mini table-of-contents for my Supplementary Material section.

Note that I renewcommand a few things so that my Supplementary Material sections, tables, & figures have an S in front of them (S denotes Supplement).

The minitoc commands work fine for other sections (before the Supplementary Material section). But when I place them after \section{Supplementary Material}, it doesn't do anything (no table-of-contents is created).

\documentclass[11pt]{article}
...
\usepackage{minitoc}
\setcounter{secttocdepth}{5}
...
% when called, the following will include an "S" in
% the numbering system to denote "Supplement".
\newcommand{\beginsupplement}{%
\renewcommand{\thetable}{S\arabic{table}}%
\renewcommand{\thefigure}{S\arabic{figure}}%
\renewcommand{\thesection}{S\arabic{section}}%
\renewcommand{\thesubsection}{S\arabic{section}.\arabic{subsection}}%
}
...
...
\begin{document}

\dominitoc
\dosecttoc
\dosectlof
\dosectlot

\tableofcontents   % works great.  Includes supplement in toc, as it should.
...
...
...
\newpage
\beginsupplement    % renews a few commands (see above)

\section{Supplementary Material}

\secttoc  % does nothing
\sectlof  % does nothing
\sectlot  % does nothing


Clearly the \renewcommands for \beginsupplement are causing issues. But how/why? And what can I do about it?

• Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – jub0bs Jun 25 '14 at 16:55
• Perhaps the easiest way is to make the supplement a separate document with its own toc. You can use pdfpages to copy the original document (completed pdf) into the new one. – John Kormylo Jun 27 '14 at 15:23
• As to why it doesn't work, I would have to get into the intertices of minitoc. As a debug hint, examine the contents of the toc, lof and lot files. – John Kormylo Jun 27 '14 at 15:44

Admitted, the manual of minitoc isn't a little bit unclear about this, but \secttoc will do nothing if there's no \subsection etc, because it should provide a section - toc, not a ToC about sections.

The \sectlof and \sectlot commands require the usage of the insection option to minitoc, otherwise figures etc. are entered in the global LoF and LoT.

\dominitoc does not apply for article class since it's designed to operate on a per-chapter base.

The \renewcommand does not cause problem here!

\documentclass[11pt]{article}
% when called, the following will include an "S" in
% the numbering system to denote "Supplement".

\newcommand{\beginsupplement}{%
\renewcommand{\thetable}{S\arabic{table}}%
\renewcommand{\thefigure}{S\arabic{figure}}%
\renewcommand{\thesection}{S\arabic{section}}%
\renewcommand{\thesubsection}{S\arabic{section}.\arabic{subsection}}%
}

\usepackage[hints,insection]{minitoc}
\mtcsetdepth{secttoc}{2}
\begin{document}
\dosecttoc
\dosectlof
\dosectlot

\tableofcontents   % works great.  Includes supplement in toc, as it should.
\fakelistoftables
\fakelistoffigures
\section{foo}
\subsection{Foo subsection}

\beginsupplement
\section{Supplementary Material}
\secttoc
\sectlof
\sectlot

\subsection{Foo subsection of Supplements}
\subsection{Other subsection of Supplements}

\begin{figure}
\caption{A figure in supplements}
\end{figure}

\begin{table}
\caption{A table in supplements}
\end{table}

\end{document}