4

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?

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

2 Answers 2

2

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

3
  • Thank you so much. But can I configure this to keep subsubsection unnumbered and still use subsubsubsection to achieve 1.1.1.1?
    – Staph
    Commented Nov 19, 2019 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
    Commented Nov 19, 2019 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
    Commented Nov 20, 2019 at 9:19
2

add the following between document

\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}

then use \paragraph{} as the 4th section.

I've found maybe there are typos between your description

1.Text

1.1. Text

1.1.1. Text

1.1.1.1. Desired?

Should be something like this? (Before Desired there's a dot?)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .