In my project, I tried to hide the subsection from table of content by using the code \setcounter{tocdepth}{1} but it didn't worked
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc, vietnam}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amsthm}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}.}
\begin{document}
\clearpage
\newpage
\tableofcontents
\newpage
\section{Linear Analysis}
\setcounter{tocdepth}{1}
\subsection{Definition}
\end{document}
How can I hide the subsection from table of content ? Thank you
tocdepth. It the executing of\tableofcontentsthat uses the value oftocdepth. Meaning it you only want to remove one subsection, the adjustment oftocdepthneed to go into the.tocfile. – daleif Dec 12 '23 at 14:50\setcounter{tocdepth}{1}after\tableofcontentsso it has no effect. – David Carlisle Dec 12 '23 at 14:51right before\tableofcontents```, but it still didn't worked, so what should I do – PermQi Dec 12 '23 at 14:56\setcounter{tocdepth}{1}up before\tableofcontentsand remompile (maybe twice) I only seeLinear Analysisin the toc. Without it I see both. – daleif Dec 12 '23 at 15:01\tableofcontentsis OK) – David Carlisle Dec 12 '23 at 15:07and I still see the subsection in the table of content. I don't know why (I make my project on overleaf)
– PermQi Dec 12 '23 at 15:16\setcounter{tocdepth}{1}, like you write in your question. Not\setcounter{tocdepth}{2}– samcarter_is_at_topanswers.xyz Dec 12 '23 at 15:18\setcounter{tocdepth}{2}so you have set it to 2 – David Carlisle Dec 12 '23 at 15:18