0

I am using a part of the MWE from How to use the package etoc to create local toc's? I would like to know how to set the tocdepth.

\documentclass{report}
\usepackage{lipsum}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{hyperref}

\titleclass{\part}{top} % make part like a chapter \titleformat{\part} [display] {\centering\normalfont\Huge\bfseries} {\titlerule[2pt]\vspace{3pt}\titlerule[1pt]\vspace{3pt}\MakeUppercase{\partname} \thepart} {0pt} {\titlerule[1pt]\vspace{1pc}\huge\MakeUppercase} % \titlespacing*{\part}{0pt}{0pt}{20pt}

\makeatletter \let\titlesec@part\part \renewcommand{\part}{@ifstar\part@star\part@nostar} \def\part@star#1{\NR@gettitle{#1}\titlesec@part*{#1}} \def\part@nostar{@ifnextchar[\part@nostar@opt\part@nostar@nopt} \def\part@nostar@nopt#1{\NR@gettitle{#1}\titlesec@part{#1}} \def\part@nostar@opt[#1]#2{\NR@gettitle{#2}\titlesec@part[#1]{#2}} \makeatother

\begin{document} \part{FIRST PART}\label{part:one} \section*{Local toc} \startcontents[mytoc] \printcontents[mytoc]{}{0}{} \chapter{INTRODUCTION} \lipsum{1} \section{Section 1} \subsection{Subsection 1} \chapter{METHODOLOGY} \lipsum{1} \section{Section 1} \subsection{Subsection 1} \chapter{CONCLUSION} \lipsum{1} \section{Section 1} \subsection{Subsection 1} \end{document}

1 Answers1

2

The normal method of adjusting the tocdepth is \setcounter{tocdepth}{...}. I have shown some possibilities based on your MWE.

% titletocprob.tex  SE 597613

\documentclass{report} \usepackage{lipsum} \usepackage{titlesec} \usepackage{titletoc} \usepackage{hyperref}

\titleclass{\part}{top} % make part like a chapter \titleformat{\part} [display] {\centering\normalfont\Huge\bfseries} {\titlerule[2pt]\vspace{3pt}\titlerule[1pt]\vspace{3pt}\MakeUppercase{\partname} \thepart} {0pt} {\titlerule[1pt]\vspace{1pc}\huge\MakeUppercase} % \titlespacing*{\part}{0pt}{0pt}{20pt}

\makeatletter \let\titlesec@part\part \renewcommand{\part}{@ifstar\part@star\part@nostar} \def\part@star#1{\NR@gettitle{#1}\titlesec@part*{#1}} \def\part@nostar{@ifnextchar[\part@nostar@opt\part@nostar@nopt} \def\part@nostar@nopt#1{\NR@gettitle{#1}\titlesec@part{#1}} \def\part@nostar@opt[#1]#2{\NR@gettitle{#2}\titlesec@part[#1]{#2}} \makeatother

\begin{document} \part{FIRST PART}\label{part:one} \section*{Local toc}

\setcounter{tocdepth}{5} % down to subparagraphs \setcounter{tocdepth}{1} % down to sections \setcounter{tocdepth}{0} % down to chapters

\startcontents[mytoc] \printcontents[mytoc]{}{0}{} \chapter{INTRODUCTION} \lipsum{1} \section{Section 1} \subsection{Subsection 1} \chapter{METHODOLOGY} \lipsum{1} \section{Section 1} \subsection{Subsection 1} \chapter{CONCLUSION} \lipsum{1} \section{Section 1} \subsection{Subsection 1} \end{document}

enter image description here

Peter Wilson
  • 28,066