I fixed the problem, but I don't know why it works. Please see comment at the end for followup question.

I have found several similar questions, but none that quite line up (or seem to work). However, if this is a failure of my Google-fu, simply link to the relevant question please.

I am trying to write a guide that includes a FAQ at the end. The most natural way I thought to do an FAQ was to use the hyperref package and a minitoc to let people read the question and click to the answer. Unfortunately this clutters the top table of contents of the guide with all the FAQ questions. There must be a way to suppress the FAQ questions in the table of contents, but still show them in the minitoc. I tried the \addstarredsection command in the minitoc package documentation, but I can't even get it to compile right, let alone do what I want. Any suggestions?

A MWE (including all the packages I intend to use as of right now):

\documentclass{article}

\usepackage{hyperref}
\hypersetup{%               %           Setup the coloring of the links.
urlcolor     = blue,    %           Colour for external hyperlinks
citecolor    = blue     %           Colour of citations, could be red''
}

\usepackage[
margin=1in,%            All 4 margins need to be one inch.
paperheight=11in,%      We want 11in tall paper.
paperwidth=8.5in%       And 8.5in wide paper.
]{geometry}%            Geometry package is the easiest way to deal with margins.

\usepackage{fancyhdr}
\usepackage{indentfirst}
\pagestyle{fancy}
\usepackage{titlesec}%          Use this for the actual header styling
\title{A guide to Stuff}
\author{Me}
\date{}

\begin{document}
\maketitle
\newpage
\section*{Introduction}

\newpage
\doparttoc\tableofcontents
\newpage

\part{Part 1}
\newpage

\section{Subsection of Part 1}
\newpage

\section{Second Subsection of Part 1}

\newpage
\part{Part 2}
\newpage

\section{Subsection of Part 2}
\newpage

\section{Second Subsection of Part 2}

\newpage
\part{FAQ}
% Every section (or subsection) below this should appear in the minitoc but NOT the main table of contents. Bonus points for being able to show *only* sections and not subsections, although this should simply be a matter of setting the toc depth in theory.
\parttoc
\section*{Question One}
Q1
\section{Question Two}
Q2
\subsection{Subquestion of Question Two}
SubQ1
\subsection{Another subquestion of Question Two}
SubQ2
\section{Question Three}
Q3
\end{document}


As a footnote, I wanted to use titletoc and titlesec packages for other reasons, and I had seen a few posts about how to use titletoc to get a minitoc without using the minitoc package. I tried these suggestions as well, but couldn't get any of the suggested answers to compile; even copy/pasting the answers in the threads as a litmus test. In fairness, those posts seemed to be very old, so I imagine it's an issue with updates to LaTeX and/or the titletoc package. I also abandoned the attempts early as I knew minitoc did more or less what I wanted already and I had wanted to learn how to use minitoc better anyway.

Edit:

I fixed the problem by inserting \addtocontents{toc}{\protect\setcounter{tocdepth}{0}} right after the \part{FAQ} line. I know this is setting the toc depth to no longer counter the section (or lower) for the table of contents, thus I would expect (and it's true) that the top table of contents has nothing after the FAQ part.

What I'm not sure about, is why the minitoc is still populating all the sections correctly, when those sections aren't showing up in the top table of contents. If the tocdepth doesn't effect the minitoc, what does? I thought that minitoc parsed the .toc file to get it's contents, thus anything that isn't in the toc would have trouble being in the minitoc... but apparently this is not true. Anyone able to provide insight as to what is going on here?

• minitoc adds the counter minitocdepth, plus other counters such as partocdepth and secttocdepth. It also saves the tocdepth as macro \mtc@sv@tocdepth, and is constatly using \addtocontents to change or restore the tocdepth counter. – John Kormylo Aug 5 '19 at 18:29

Here is a way based to the post:

How to add a custom TOC (automated "Section Break-down") after each \chapter command?

\documentclass{article}

\usepackage{hyperref}
\hypersetup{%               %           Setup the coloring of the links.
urlcolor     = blue,    %           Colour for external hyperlinks
citecolor    = blue     %           Colour of citations, could be red''
}

\usepackage[
margin=1in,%            All 4 margins need to be one inch.
paperheight=11in,%      We want 11in tall paper.
paperwidth=8.5in%       And 8.5in wide paper.
]{geometry}%            Geometry package is the easiest way to deal with margins.

\usepackage{fancyhdr}
\usepackage{indentfirst}
\pagestyle{fancy}
%\usepackage{titlesec}%          Use this for the actual header styling

\usepackage{pgffor}
%\newcounter{mychapter}

%\renewcommand\thepart{\Alph{part}}
%\newcommand\thechapter{\thepart.\arabic{mychapter}}

%\renewcommand\thesection{\thechapter.\arabic{section}}
%\renewcommand\thesubsection{\thesection.\arabic{subsection}}

\let\oldpart\part
%\def\part#1{\oldpart{#1}\setcounter{mychapter}{0}\refstepcounter{mychapter}}

\let\oldsection\section
\let\oldsubsection\subsection
%\let\olldchapter\chapter
%\def\oldchapter{\stepcounter{mychapter}\olldchapter}
\makeatletter

\newcounter{mysection}
\newcounter{mysubsection}

\def\section{%
\@ifstar{\@Starred}{\@nonStarred}%
}
\def\@Starred{%
\@ifnextchar[%
{\GenericWarning{}{Warning: A starred section can not have parameters. I am going to ignore them!}\@StarredWith}%
{\@StarredWithout}%
}
\def\@StarredWith[#1]#2{%
\oldsection*{#2}\refstepcounter{mysection}\label{Sec:\arabic{mysection}}%
}
\def\@StarredWithout#1{
\oldsection*{#1}\refstepcounter{mysection}\label{Sec:\arabic{mysection}}%
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\oldsection[#1]{#2}\refstepcounter{mysection}\label{Sec:\arabic{mysection}}%
}
\def\@nonStarredWithout#1{%
\oldsection{#1}\refstepcounter{mysection}\label{Sec:\arabic{mysection}}%
}

\def\subsection{%
\@ifstar{\@StarredS}{\@nonStarredS}%
}
\def\@StarredS{%
\@ifnextchar[%
{\GenericWarning{}{Warning: A starred section can not have parameters. I am going to ignore them!}\@StarredSWith}%
{\@StarredSWithout}%
}
\def\@StarredSWith[#1]#2{%
\oldsubsection*{#2}\refstepcounter{mysubsection}\label{SubSec:\arabic{mysection}:\arabic{mysubsection}}%
}
\def\@StarredSWithout#1{%
\oldsubsection*{#1}\refstepcounter{mysubsection}\label{SubSec:\arabic{mysection}:\arabic{mysubsection}}%
}
\def\@nonStarredS{%
\@ifnextchar[%
{\@nonStarredSWith}%
{\@nonStarredSWithout}%
}
\def\@nonStarredSWith[#1]#2{%
\oldsubsection[#1]{#2}\refstepcounter{mysubsection}\label{SubSec:\arabic{mysection}:\arabic{mysubsection}}%
}
\def\@nonStarredSWithout#1{%
\oldsubsection{#1}\refstepcounter{mysubsection}\label{SubSec:\arabic{mysection}:\arabic{mysubsection}}%
}

%\MakeRobust{\ref}

\newcommand{\labeltext}[2]{%
\immediate\write\@auxout{%
\string\newlabel{#2}{{1}{\thepage}{\unexpanded{#1}}{#2}{}}%
}%
}

\newcommand\stopTOC{%
\def\section{%
\@ifstar{\@Starred}{\@nonStarred}%
}
\def\@Starred{%
\@ifnextchar[%
{\GenericWarning{}{Warning: A starred section can not have parameters. I am going to ignore them!}\@StarredWith}%
{\@StarredWithout}%
}
\def\@StarredWith[##1]##2{%
\oldsection*{##2}\refstepcounter{mysection}\labeltext{##2}{Sec:\arabic{mysection}}%
}
\def\@StarredWithout##1{
\oldsection*{##1}\refstepcounter{mysection}\labeltext{##1}{Sec:\arabic{mysection}}%
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[##1]##2{%
\oldsection*{\arabic{section}\hspace{1em}{##2}}\refstepcounter{mysection}\labeltext{\refstepcounter{section}\arabic{section}\hspace{1em}##2}{Sec:\arabic{mysection}}%
}
\def\@nonStarredWithout##1{%
\oldsection*{\arabic{section}\hspace{1em}{##1}}\refstepcounter{mysection}\labeltext{\refstepcounter{section}\arabic{section}\hspace{1em}##1}{Sec:\arabic{mysection}}%
}

\def\subsection{%
\@ifstar{\@StarredS}{\@nonStarredS}%
}
\def\@StarredS{%
\@ifnextchar[%
{\GenericWarning{}{Warning: A starred section can not have parameters. I am going to ignore them!}\@StarredSWith}%
{\@StarredSWithout}%
}
\def\@StarredSWith[##1]##2{%
\oldsubsection*{##2}\refstepcounter{mysubsection}\label{SubSec:\arabic{mysection}:\arabic{mysubsection}}%
}
\def\@StarredSWithout##1{%
\oldsubsection*{##1}\refstepcounter{mysubsection}\label{SubSec:\arabic{mysection}:\arabic{mysubsection}}%
}
\def\@nonStarredS{%
\@ifnextchar[%
{\@nonStarredSWith}%
{\@nonStarredSWithout}%
}
\def\@nonStarredSWith[##1]##2{%
\oldsubsection*{\arabic{section}.\arabic{subsection}\hspace{1em}##2}\refstepcounter{mysubsection}\labeltext{\refstepcounter{subsection}\arabic{section}.\arabic{subsection}\hspace{1em}##2}{SubSec:\arabic{mysection}:\arabic{mysubsection}}%
}
\def\@nonStarredSWithout##1{%
\oldsubsection*{\arabic{section}.\arabic{subsection}\hspace{1em}##1}\refstepcounter{mysubsection}\labeltext{\refstepcounter{subsection}\arabic{section}.\arabic{subsection}\hspace{1em}##1}{SubSec:\arabic{mysection}:\arabic{mysubsection}}%
}
}

%SectionBreakDown

\newcounter{secc}
\newcounter{ssecc}
\newcounter{tssecc}
\xdef\OverC{0}

\newcommand\SBD[2][1,-1]{%
\xdef\OverC{0}%
\def\Continued\empty%
\def\ToBeContinued{-1}%
\foreach \opt[count=\ll from 1] in {#1}{%
\ifnum\ll=1
\xdef\Continued{\opt}%
\else
\xdef\ToBeContinued{\opt}%
\fi
}%
\ifx\ToBeContinued\empty
\xdef\ToBeContinued{-1}%
\fi
\ifx\Continued\empty
\xdef\Continued{1}%
\fi
%
%\section{Section breakdown}

\ifnum\Continued>0
\else
\noindent{\large\bfseries Contents}%

\noindent\rule{\textwidth}{2pt}\vspace{0.5cm}
\setcounter{secc}{0}%
\setcounter{ssecc}{0}%
\setcounter{tssecc}{0}%
\fi
%
{\noindent #2}\par
%
%
\ifnum\ToBeContinued<0
\def\ContinueUntil{100}%
\else
\def\ContinueUntil{\ToBeContinued}%
\fi
%
\foreach \mk in {\Continued,...,\ContinueUntil}{%
\@ifundefined{r@Sec:\mk}{%
\breakforeach%
}{%
\setcounter{secc}{\mk}%
\ifnum\mk<0
\breakforeach%
\else
\ifnum\mk>\ContinueUntil
\\\breakforeach%
\else
\noindent{\bfseries{\nameref{Sec:\mk}\dotfill\pageref{Sec:\mk}}\\[1.2ex]}
\foreach \ml in {1,...,100}{%
\@ifundefined{r@SubSec:\mk:\ml}{%
\breakforeach%
}{%
\setcounter{ssecc}{\ml}%
\stepcounter{tssecc}%
\ifnum\mk>0
\hspace{0.3cm}\parbox[t]{\textwidth}{\setlength{\baselineskip}{4pt}\nameref{SubSec:\mk:\ml}\dotfill\pageref{SubSec:\mk:\ml}\\[0.9ex]}\\
\fi
}%
}%
\fi
\fi
}%
}
%\begin{enumerate}[label={\arabic{enumi}.},itemsep=0pt]
%\foreach \i in {#3,...,#4}
%{\item \nameref{\thechapter:\i}}
%\end{enumerate}

\ifnum\ToBeContinued>0
\relax%
\else
\vspace{-0.cm}
\par
\noindent\rule{\textwidth}{2pt}
\fi
}
\makeatother

\title{A guide to Stuff}
\author{Me}
\date{}

\begin{document}
\maketitle
\newpage
\section*{Introduction}

\newpage
\doparttoc\tableofcontents
\newpage

\part{Part 1}
\newpage

\section{Subsection of Part 1}
\newpage

\section{Second Subsection of Part 1}

\newpage
\part{Part 2}
\newpage

\section{Subsection of Part 2}
\newpage

\section{Second Subsection of Part 2}

\newpage
\part{FAQ}
\stopTOC
\SBD[0,1]{}
\SBD[7,-1]{}
%\parttoc
\section*{Question One}
Q1
\section{Question Two}
Q2
\subsection{Subquestion of Question Two}
SubQ1
\subsection{Another subquestion of Question Two}
SubQ2
\section{Question Three}
Q3
\end{document}


TOC:

PART 3:

• minitoc is not really used – koleygr Aug 10 '19 at 10:42
• But minitoc is cool ;) – cis Jan 7 '20 at 19:23