How do I change the ToC depth mid document?
so in this example
\documentclass[a4paper,10pt,oneside]{book}
\begin{document}
\chapter{hello}
\frontmatter
\chapter{hello}
\setcounter{tocdepth}{3}
\tableofcontents
\mainmatter
\chapter{hello}
\section{hello}
\subsection{hello}
\subsubsection{hello}
\chapter{hello}
\appendix
\setcounter{tocdepth}{1}
\chapter{hello}
\section{hello}
\subsection{hello}
\subsubsection{hello}
\end{document}
But I want the ToC depth in the appendix to only be of depth 1 (while the rest of the document stays in tocdepth 3). I tried the \setcounter{tocdepth}{1} right after \appendix but that didn't do anything as you can see...
(my guess would be that the ToC is build right after I call \tableofcontents thus I can't change it afterwards this way)

If I then add your line I get the error "undefined control sequence" and if I compile again that error changes to "missing } inserted. \tableofcontents".
Any idea how to resolve this? (Else I'll just make a follow up question if this is not clear enough)
– LinG May 18 '17 at 14:02