4

I added a new subsubparagraph section level using the titlesec package, with help from How to add an extra level of sections with headings below \subsubsection and https://tex.stackexchange.com/a/94404/98753.

The in-text titles are fine but the new label is added to the TOC with a page number. I can remove it by adding an asterisk to the call: \subsubparagraph*{New label}. But is there a way to build this into the titleformat instead?

A MWE:

\documentclass{article}
\usepackage[raggedright]{titlesec}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}

\titleformat{\paragraph}[hang]
  {\bfseries\small}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{0em}

\titleformat{\subparagraph}[hang]
  {\bfseries\small}{\thesubparagraph}{1em}{}
\titlespacing{\subparagraph}{32pt}{0.5em}{0em}

\titleclass{\subsubparagraph}{straight}[\subparagraph]
\newcounter{subsubparagraph}
\renewcommand{\thesubsubparagraph}{\arabic{subsubparagraph}}
\titleformat{\subsubparagraph}[runin]
  {\normalfont\normalsize\bfseries}{\thesubsubparagraph}{1em}{}
\titlespacing*{\subsubparagraph}{32pt}{3.25ex plus 1ex minus .2ex}{1em}

\begin{document}
\tableofcontents
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\paragraph{Paragraph} 
  \subparagraph{Subparagraph 1} 
  \subparagraph{Subparagraph 2}
    \subsubparagraph{New label}
      Finally, some ordinary text. I don't want a whole Lorem ipsum paragraph, so I'll just manually add a couple of lines.
\subsubsection{Subsubsection 2}
\end{document}

Screen capture of document produced

eknumbat
  • 175
  • 3

1 Answers1

4

You have to define \l@subsubparagraph, e.g.

\makeatletter
\newcommand\l@subsubparagraph{\@dottedtocline{6}{14em}{7em}}
\makeatother

The first argument of \@dottedtocline defines the toclevel of \subsubparagraph.

enter image description here

Code:

\documentclass{article}
\usepackage[raggedright]{titlesec}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}

\titleformat{\paragraph}[hang]
  {\bfseries\small}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{0em}

\titleformat{\subparagraph}[hang]
  {\bfseries\small}{\thesubparagraph}{1em}{}
\titlespacing{\subparagraph}{32pt}{0.5em}{0em}

\titleclass{\subsubparagraph}{straight}[\subparagraph]
\newcounter{subsubparagraph}
\renewcommand{\thesubsubparagraph}{\arabic{subsubparagraph}}
\titleformat{\subsubparagraph}[runin]
  {\normalfont\normalsize\bfseries}{\thesubsubparagraph}{1em}{}
\titlespacing*{\subsubparagraph}{32pt}{3.25ex plus 1ex minus .2ex}{1em}

\makeatletter
\newcommand\l@subsubparagraph{\@dottedtocline{6}{14em}{7em}}
\makeatother

\begin{document}
\tableofcontents
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\paragraph{Paragraph} 
  \subparagraph{Subparagraph 1} 
  \subparagraph{Subparagraph 2}
    \subsubparagraph{New label}
      Finally, some ordinary text. I don't want a whole Lorem ipsum paragraph, so I'll just manually add a couple of lines.
\subsubsection{Subsubsection 2}
\end{document}
esdd
  • 85,675