1

I am using overleaf and I want to go to the fourth section. I am using \chapter, \section \subsection and \subsubsection. I want the (1.1.1.1 desired) mark. I tried using \paragraph but it is not showing up as a numbered heading in the table of content.

  1. Text

1.1. Text

1.1.1. Text

1.1.1.1 Desired?

  • 1
    Welcome to TeX SX! You can define a number for \paragraphs using titlesec. – Bernard Nov 19 '19 at 11:18
  • 1
    Numbered paragraph both in text and table of contents are achieved with \setcounter{secnumdepth}{4}\setcounter{tocdepth}{4}. – campa Nov 19 '19 at 12:23
1

Once I wanted to do exactly the same thing, and information about that is all over the internet in small bits. So this was my method:

\documentclass{report}
\usepackage{titlesec}

\begin{document}
\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}

\chapter{This is a chapter}
\section{This is a section}
\subsection{This is a subsection}
\subsubsection{This is a subsubsection}
\subsubsubsection{This is a subsubsubsection}
\end{document}

enter image description here

| improve this answer | |
  • Thank you so much. But can I configure this to keep subsubsection unnumbered and still use subsubsubsection to achieve 1.1.1.1? – Staph Nov 19 '19 at 11:58
  • @Staph If I understood you correctly and you want to keep subsubsubsection with four numbers rather than five then this is the solution: Replace line 7 and 8 of code in the answer with \newcounter{subsubsubsection}[subsubsection] \renewcommand\thesubsubsubsection{\thesubsection.\arabic{subsubsubsection}} \renewcommand\thesubsubsection{} – bgleb Nov 19 '19 at 22:41
  • Oh and how to remove the subsubsection to not come in table of content as well. I just need the this is subsubsubsection to appear in my table of content and subsubsection to remain how it is by default. I am really grateful for your help already – Staph Nov 20 '19 at 9:19

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.