1

I have set my TOC depth to 4, but unfortunatelly when I do that, the sections which have less depth add one more line and so it repeats the number withouth any need. Can you please help with that? Check the image.

enter image description here

My code

\usepackage{titlesec}
\usepackage{hyperref}

\titleclass{\subsubsubsection}{straight}[\subsection]
\newcounter{subsubsubsection}[subsubsection]
\renewcommand\thesubsubsubsection{\thesubsubsection.\arabic{subsubsubsection}}
\titleformat{\subsubsubsection}
 {\normalfont\normalsize\bfseries}{\thesubsubsubsection}{1em}{}
\titlespacing*{\subsubsubsection}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\makeatletter
\def\toclevel@subsubsubsection{4}
\def\l@subsubsubsection{\@dottedtocline{4}{7em}{4em}}
\makeatother
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
%%Starting TOC
\tableofcontents

\addcontentsline{toc}{section}{Sumário}
  • We can't process your example code. What is the class? What is the body of the document? Please provide a complete example code showing the problem from \documentclass... to \end{document}. – Peter Wilson Mar 22 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.