[Tex/LaTex] Remove chapter number from minitoc

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 …..

instead of :

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}

enter image description here

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}}

Best Answer

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}}
\newcommand{\minitocsection}{\begingroup\renewcommand{\filterminitoc}[1]{}\minitoc\endgroup}

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}}
\newcommand{\minitocsection}{\begingroup\renewcommand{\filterminitoc}[1]{}\minitoc\endgroup}

\begin{document}
\dominitoc
\tableofcontents

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

Result: the result

Related Question