# Remove chapter number from minitoc

I'm using minitoc with a book class. At each chapter I print a minitoc using the minitoc package.

Is there any way to print it without the chapter number at each line. Something like

Chapter 2

minitoc :

1. section one .....

2. section two .....

2.1. section one .....

2.2. section two .....

I couldn't find the right command to redefine which customize the \numberline part on the mtc files!

MWE:

\documentclass{book}
\usepackage{minitoc}

\begin{document}
\dominitoc
\tableofcontents

\chapter{Introduction}
\chapter{chapter two}
\minitoc
\section{section one}
\section{section two}
\section{section three}

\end{document}


EDIT :

I'm not sure but it is some thing related to this macro. I don't figure how to change the value of #2 :

\def\MTC@contentsline#1#2#3#4{%
\gdef\themtc{\arabic{mtc}}%
\expandafter\ifx\csname #1\endcsname\chapter
\stepcounter{mtc}%
\if@mtc@longext@%
\mtcPackageInfo[I0033]{minitoc}%
{Writing\space\jobname.mtc\themtc\@gobble}%
\def\mtcname{\jobname.mtc\themtc}%
\else
\mtcPackageInfo[I0033]{minitoc}%
{Writing\space\jobname.M\themtc\@gobble}%
\def\mtcname{\jobname.M\themtc}%
\fi
\immediate\closeout\tf@mtc
\immediate\openout\tf@mtc=\mtcname
\fi
\expandafter\ifx\csname #1\endcsname\appendix
\stepcounter{mtc}%
\if@mtc@longext@%
\mtcPackageInfo[I0033]{minitoc}%
{Writing\space\jobname.mtc\themtc\@gobble}%
\def\mtcname{\jobname.mtc\themtc}%
\else
\mtcPackageInfo[I0033]{minitoc}%
{Writing\space\jobname.M\themtc\@gobble}%
\def\mtcname{\jobname.M\themtc}%
\fi
\immediate\closeout\tf@mtc
\immediate\openout\tf@mtc=\mtcname
\fi
\mtc@toks{\noexpand\leavevmode #2}%
\expandafter\ifx\csname #1\endcsname\section
\MTC@WriteContentsline{#1}{mtcS}{#3}{#4}%
\fi
\expandafter\ifx\csname #1\endcsname\subsection
\MTC@WriteContentsline{#1}{mtcSS}{#3}{#4}%
\fi
\expandafter\ifx\csname #1\endcsname\subsubsection
\MTC@WriteContentsline{#1}{mtcSSS}{#3}{#4}%
\fi
\expandafter\ifx\csname #1\endcsname\paragraph
\MTC@WriteContentsline{#1}{mtcP}{#3}{#4}%
\fi
\expandafter\ifx\csname #1\endcsname\subparagraph
\MTC@WriteContentsline{#1}{mtcSP}{#3}{#4}%
\fi
\expandafter\ifx\csname #1\endcsname\coffee
\MTC@WriteCoffeeline{#1}{#3}%
\fi
\expandafter\ifx\csname #1\endcsname\starchapter
\stepcounter{mtc}%
\if@mtc@longext@
\mtcPackageInfo[I0033]{minitoc}%
{Writing\space\jobname.mtc\themtc\@gobble}%
\def\mtcname{\jobname.mtc\themtc}%
\else
\mtcPackageInfo[I0033]{minitoc}%
{Writing\space\jobname.M\themtc\@gobble}%
\def\mtcname{\jobname.M\themtc}%
\fi
\immediate\closeout\tf@mtc
\immediate\openout\tf@mtc=\mtcname
\fi
\expandafter\ifx\csname #1\endcsname\starsection
\MTC@WriteContentsline{#1}{mtcS}{#3}{#4}%
\fi
\expandafter\ifx\csname #1\endcsname\starsubsection
\MTC@WriteContentsline{#1}{mtcSS}{#3}{#4}%
\fi
\expandafter\ifx\csname #1\endcsname\starsubsubsection
\MTC@WriteContentsline{#1}{mtcSSS}{#3}{#4}%
\fi
\expandafter\ifx\csname #1\endcsname\starparagraph
\MTC@WriteContentsline{#1}{mtcP}{#3}{#4}%
\fi
\expandafter\ifx\csname #1\endcsname\starsubparagraph
\MTC@WriteContentsline{#1}{mtcSP}{#3}{#4}%
\fi
}


This produces for example lines like this one:

{\reset@font\mtcSfont\mtc@string\contentsline{section}{\noexpand \leavevmode \numberline {2.1}section one .}{\reset@font\mtcSfont 5}}

• Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Jun 25 '14 at 11:41
• Using \renewcommand{\thesection}{\arabic{section}}, you get the expected result, but it will remove the chapter number everywhere the section is numbered (toc, titles ...). – TonioElGringo Jun 25 '14 at 12:55
• @TonioElGringo -- "burying" that command in a group that otherwise contains only the minitoc should have the desired effect. so \begingroup \renewcommand{\thesection}{\arabic{section}} \minitoc \endgroup should do it. (test it, and make it an answer if it works as proposed.) localizing things like this in a group is often a useful tactic. – barbara beeton Jun 25 '14 at 13:42
• @barbara-beeton Actually this doesn't work. I think because minitoc append the section command to write some information on the mtc files, then just uses these information when calling minitoc – Sohaib Afifi Jun 25 '14 at 14:01
• @SohaibAfifi -- good catch. thank you. (obviously, i didn't try it out.) so what would be needed is alteration of what is written out to be used by the minitoc. if that's just the same "line" in the .aux file as is written out for the regular toc, then the situation becomes much more complicated. but this is a really nice question, and i'd like to see a good answer. (i'm surprised it hasn't gotten many upvotes.) – barbara beeton Jun 25 '14 at 14:15

One way to remove the chapter numbering only in the minitoc is to add a command in the section number, which definition will be altered during the minitoc rendering.

Consider the following code to be put in your preamble:

\newcommand{\filterminitoc}[1]{#1}
\renewcommand{\thesection}{\csname filterminitoc \endcsname{\arabic{chapter}.}\arabic{section}}


The first line defines a command that will do nothing, to avoid altering the result outside the minitoc. The second line redefines the section numbering, so that the chapter part of the number is passed to the command \filterminitoc. The last line defines a new command that will call \minitoc with a modified command for \filterminitoc, preventing the rendering of the chapter number.

You can now call \minitocsection to render the correct minitoc.

Complete code:

\documentclass{book}
\usepackage{minitoc}

\newcommand{\filterminitoc}[1]{#1}
\renewcommand{\thesection}{\csname filterminitoc \endcsname{\arabic{chapter}.}\arabic{section}}

\begin{document}
\dominitoc
\tableofcontents

\chapter{Introduction}
\chapter{chapter two}
\minitocsection
\section{section one}
\section{section two}
\section{section three}
\end{document}


Result: