1

I'm fairly new to LaTeX and need to create a subsubsubsection in a document. After looking around I found that it could be done with titlesec. I've followed all instructions I've been able to find but it stil doesn't work as I desire.

The subsubsubsection shows up in the table of contents and the counter does work when using the \setcounter{}{} and it's also reset every subsubsection, but for some reason the counter does not increase with new subsubsubsections nor is thesubsubsubsection displayed in the table of contents or the text.

Below is the code and the document. In the end the table of contents will probably just display 2 levels, so I don't really care about the looks there at the moment. It is just included to show that the subsubsubsection is recognised in some way.

\documentclass[11pt,twoside,a4paper]{article}

\usepackage{titlesec}

\titleclass{\subsubsubsection}{straight}[\subsubsection]
\newcounter{subsubsubsection}[subsubsection]
\renewcommand{\thesubsubsubsection}{\thesubsubsection.\arabic{subsubsubsection}}
\titlespacing*{\subsubsubsection}{0mm}{0mm}{0mm}[0mm]
\titleformat{\subsubsubsection}{\small}{\thesubsubsubsection}{1em}{}

\begin{document}

\tableofcontents

\section{Section one}
\subsection{Subsection one}
\subsubsection{Subsubsection one}
\subsubsubsection{Subsubsubsection one}
\thesubsubsubsection\\
\setcounter{subsubsubsection}{3}
\thesubsubsubsection
\subsubsection{Subsubsection two}
\subsubsubsection{Subsubsubsection one}
\thesubsubsubsection\\

\end{document}

enter image description here

  • Welcome to TeX.SX! Relative: tex.stackexchange.com/questions/60209/… ... You have to add the command \setcounter{secnumdepth}{4} to get it work – koleygr Mar 29 at 21:43
  • 1
    you don't need to define new counters, article class already has level 4 and 5 headings, the commands are \paragraph and \subparagraph – David Carlisle Mar 29 at 22:18
2

You have to change the value of secnumdepth (by default sectioning titles are numbered up to level 3 – the level of subsubsections). You also should have to set the layout of subsubsubsections in the table of contents via titletoc:

\documentclass[11pt, twoside, a4paper]{article}

\usepackage{titlesec}
\setcounter{secnumdepth}{4}
\titleclass{\subsubsubsection}{straight}[\subsubsection]
\newcounter{subsubsubsection}%[subsubsection]
\counterwithin{subsubsubsection}{subsubsection}
\titlespacing*{\subsubsubsection}{0mm}{0mm}{0mm}[0mm]
\titleformat{\subsubsubsection}{\small}{\thesubsubsubsection}{1em}{}

\begin{document}

\tableofcontents

\section{Section one}
\subsection{Subsection one}
\subsubsection{Subsubsection one}
\subsubsubsection{Subsubsubsection one}
\thesubsubsubsection\\
\setcounter{subsubsubsection}{3}
\thesubsubsubsection
\subsubsection{Subsubsection two}
\subsubsubsection{Subsubsubsection one}
\thesubsubsubsection

\end{document}

enter image description here

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.