\documentclass{article}
\usepackage{xcolor}
\usepackage[linktocpage,colorlinks,bookmarksnumbered]{hyperref}
\usepackage{booktabs}
\usepackage[!nominitocs]{aeb-minitoc}
\usepackage{ifthen}

\let\db\mtocgobble

\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}


\makeatletter
% redefinitions necessitated by the special bullet glyph for the subsubsection level
% see the file manual-exmpls-nobullets.tex to see this file using normal numbering
\renewcommand*{\thesubsubsection}{\texorpdfstring{$\bullet$}{\textbullet}}
\renewcommand*{\theparagraph}{\texorpdfstring{\protect\P}{\textparagraph}}
\renewcommand*{\thesubparagraph}{\texorpdfstring{\protect\P\protect\P}{\textparagraph\textparagraph}}
\let\section@mtocSAVE\section
\renewcommand\section{\renewcommand{\@seccntformat}[1]{\thesection\space}%
  \section@mtocSAVE}
\let\subsection@mtocSAVE\subsection
\renewcommand\subsection{\renewcommand{\@seccntformat}[1]{\thesubsection\space}%
  \subsection@mtocSAVE}
\let\subsubsection@mtocSAVE\subsubsection
\renewcommand\subsubsection{\renewcommand{\@seccntformat}[1]{\thesubsubsection\space}%
  \subsubsection@mtocSAVE}
\renewcommand{\paragraph}
  {\renewcommand{\@seccntformat}[1]{\theparagraph\space}%
  \@startsection{paragraph}{4}{0pt}{6pt}{-3pt}{\bfseries}}
\renewcommand*\l@paragraph{\@dottedtocline{4}{5.0em}{1em}} %{7.0em}{4.1em}}
\renewcommand{\subparagraph}
  {\renewcommand{\@seccntformat}[1]{\thesubparagraph\space}%
  \@startsection{subparagraph}{5}{\parindent}{6pt}{-3pt}{\bfseries}}
\def\cs#1{\texttt{\@backslashchar#1}}
\makeatother

\title{Examples from the aeb-minitoc manual}
\author{D. P. Story}

\begin{minitocfmt}{\minitocFmtFullToc}
% we can declare toc fmtting for section level, but
% in the main toc, sections have special formatting, we leave it alone.
\declaretocfmt{subsection}{\@W{2em}\@D{1.55em}}
\declaretocfmt{subsubsection}{\@W{1em}\@D{3.55em}}
\end{minitocfmt}


\begin{minitocfmt}{\minitocFmt}
\declaretocfmt{subsection}{\@W{2.5em}\@D{0em}}
\declaretocfmt{subsubsection}{\@W{1em}\@D{2.5em}}
\end{minitocfmt}

\begin{minitocfmt}{\minitocFmti}
\@A{\def\@linkcolor{blue}\@PW{1.5em}}%
\declaretocfmt{subsection}{\@R{1.55em\@plus 2em}\@W{2.5em}\@D{0em}}
\declaretocfmt{subsubsection}{\@W{1em}\@D{2.5em}}
\end{minitocfmt}

\begin{minitocfmt}{\minitocFmtii}
\declaretocfmt{subsection}{\@W{2.5em}\@D{0em}\@N{\textbf}}
\declaretocfmt{subsubsection}{\@W{1em}\@D{2.5em}}
\end{minitocfmt}

\begin{minitocfmt}{\minitocFmtvii}
\declaretocfmt{subsection}{\@W{2.5em}\@D{0em}\@F{\bfseries}}
\declaretocfmt{subsubsection}{\@W{1em}\@D{2.5em}\@F{\color{blue}}}
\end{minitocfmt}

\begin{minitocfmt}{\minitocFmtiv}
\@A{\FmtTOCEntry}
\declaretocfmt{subsection}{\@W{2.5em}\@D{0em}}
\declaretocfmt{subsubsection}{\@W{1em}\@D{2.5em}}
\end{minitocfmt}

\begin{minitocfmt}{\minitocFmtv}
\declaretocfmt{paragraph}{\@W{1em}\@D{0em}}
\declaretocfmt{subparagraph}{\@W{1.5em}\@D{1em}}
\end{minitocfmt}

\begin{minitocfmt}{\minitocFmtvi}
\@A{\@PW{1em}}
\declaretocfmt{subsection}{\@W{2em}\@D{0em}}
\declaretocfmt{subsubsection}{\@W{1em}
  \@R{1.55em plus 2em}\leftskip2em\relax
  \rightskip\@tocrmarg\relax{#1},\nobreak{ #2}\enspace\allowbreak} %\allowbreak
\end{minitocfmt}

\newcommand{\insMinitoc}[2][]{%
  \begin{center}#2
  \begin{minipage}[c]{0.8\linewidth}
  \insertminitoc[#1]
  \end{minipage}
  \end{center}
}

\newcommand{\insMinitoci}[2][]{%
  \begin{center}#2
  \begin{minipage}[c]{0.8\linewidth}
  Contents of Section~\ref*{CandM}: \nameref*{CandM}
  \par\kern2pt
  \insertminitoc[#1]
  \end{minipage}
  \end{center}
}

\newcommand{\insMinitoctab}[2][]{%
  \begin{center}#2
  \begin{tabular}{c}\toprule
  \begin{minipage}[c]{0.8\linewidth}
  \insertminitoc[#1]
  \end{minipage}\\ \bottomrule
  \end{tabular}
  \end{center}
}

\newcommand{\insMinitocfbox}[2][]{%
  \begin{center}#2
  \fbox{\begin{minipage}[c]{0.8\linewidth}
  \insertminitoc[#1]
  \end{minipage}}
  \end{center}
}



\begin{document}

\maketitle

\bgroup
\value{secnumdepth}=3
\value{tocdepth}=3
\minitocFmtFullToc
\tableofcontents
\egroup

\newpage

\section{Introduction}

Content removed

\section{Required packages and options}

Content removed

\section{Commands and methods}\mtoclabel{CandM}

\insMinitoci{\minitocFmt}

\subsection[\protect\miniorfulltoc{\protect\textbf}{Setting the top and bottom levels}]{Setting the top and bottom levels}

Content removed

\subsubsection{Automatically setting the levels}

Content removed

\subsubsection{Manually setting the levels}

Content removed

\subsection{The \texorpdfstring{\protect\cs{insertminitoc}}{\textbackslash{insertminitoc}} command}\mtoclabel{insertminitoc}

Content removed

\subsubsection{The \texttt{minitocfmt} environment}

Content removed

\subsubsection{Some examples that illuminate}\mtoclabel{SExmpls}

Content removed

\goodbreak

\paragraph{Some basic examples} \leavevmode

\subparagraph{First Example}  \leavevmode

\insMinitoc[CandM]\minitocFmt

\subparagraph{The TOC listing on page~\pageref*{SExmpls}} \leavevmode

\insMinitoc[SExmpls]{\TOCLevels{subsubsection}{subparagraph}\minitocFmtv}

\subparagraph{Color the page numbers} \leavevmode

\insMinitoc[CandM]\minitocFmti

\subparagraph{Make section numbers bold} \leavevmode

\insMinitoc[CandM]\minitocFmtii

\subparagraph{Make section headings some bold, some blue} \leavevmode

\insMinitoc[CandM]\minitocFmtvii

\paragraph{Some more advanced examples} \leavevmode

\subparagraph{Formatting sections with no section number} \leavevmode

\begin{minitocfmt}{\minitocFmtstar}
\declaretocfmt{subsection*}{\@W{0em}\@D{0em}}
\end{minitocfmt}
\insMinitoctab[myRetirement]{\TOCLevels{section}{subsection}\minitocFmtstar}

\subparagraph{Formatting individual title headings} \leavevmode

\insMinitoc[CandM]\minitocFmtiv


\subparagraph{A custom entry for \protect\cs{subsubsection}} \leavevmode

\insMinitoc[CandM]\minitocFmtvi

\subparagraph{Using \texorpdfstring{\protect\cs{@E}}{\textbackslash{@E}} for greater formatting control} \leavevmode

\begin{minitocfmt}{\minitocFmtF}
\declaretocfmt{subsection}
  {\@W{2.5em}\@D{0em}
   \ifthenelse{\@E=\mtocref{insertminitoc}}{\@F{\bfseries}}{}}
\declaretocfmt{subsubsection}
  {\@W{1em}\@D{2.5em}
   \ifthenelse{\@E > \mtocref{insertminitoc}\and\@E < \mtocref{MPW}}
   {\@F{\color{blue}}}{}}
\end{minitocfmt}
\insMinitoc[CandM]{\TOCLevels{section}{subsubsection}\minitocFmtF}

\subparagraph{No leaders using \texorpdfstring{\protect\cs{@B}}{\textbackslash{@B}}} \leavevmode

\begin{minitocfmt}{\minitocFmtB}
\declaretocfmt{subsection}
  {\vspace{6pt}\@W{2.5em}\@B{0em}\@F{\bfseries}\@N{\bfseries}\@P{\bfseries}}
\declaretocfmt{subsubsection}
  {\@W{1em}\@D{2.5em}}
\end{minitocfmt}

\insMinitoc[CandM]\minitocFmtB

\subparagraph{Using the
  \texorpdfstring{\protect\cs{@L} and \protect\cs{@Pg}}{\textbackslash{@L}
    and \textbackslash{@Pg}} commands} \leavevmode

\begin{minitocfmt}{\minitocFmtPara} % Para
\@A{\@PW{2.5em}\@R{3.8em}}
\declaretocfmt{paragraph}
  {
    \@W{1em}\@D{0em}
    \ifthenelse{\arabic{page}=\@Pg}
      {\@P{\small\hyperlink{\@L}{this page}\mtocgobble}}
      {}
  }
\declaretocfmt{subparagraph}
  {
    \@W{1.5em}\@D{1em}
    \ifthenelse{\arabic{page}=\@Pg}
      {\@P{\small\hyperlink{\@L}{this page}\mtocgobble}}
      {}
  }
\end{minitocfmt}

\insMinitoc[SExmpls]{\TOCLevels{subsubsection}{subparagraph}\minitocFmtPara}

\paragraph{Using \texorpdfstring{\texttt{minitocfmt} with \protect\cs{tableofcontents}}
  {minitocfmt with \textbackslash{tableofcontents}}}\leavevmode

\subsubsection{Alternate presentations of the mini-toc}

Content removed

\paragraph{Predefined presentations} \leavevmode

Defined in preamble

\subparagraph{Enclose the mini-toc in an \cs{fbox}} \leavevmode

\insMinitocfbox[CandM]{\TOCLevels{section}{subsubsection}\minitocFmt}

\subparagraph{Enclose the mini-toc in a ruled tabular environment} \leavevmode

\insMinitoctab[CandM]{\minitocFmt}


\section{Methodology}\mtoclabel{MPW}

Content removed

\section{My retirement}\mtoclabel{myRetirement}

\subsection*{Time to get back to it, dps}
\addcontentsline{toc}{subsection}{Time to get back to it, dps}

\end{document} 