3

I am trying to create a subsubparagraph and subsubsubparagraph. Subsubsubparagraph is working fine, but subsubparagraph is giving me strange results in my Table of Contents.

Here is my Code:

\documentclass[parskip=full]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{titlesec}

\makeatletter

\titleclass{\subsubparagraph}{straight}[\subparagraph]
\titleformat{\subsubparagraph}{\normalfont\normalsize\bfseries}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}.\arabic{paragraph}.\arabic{subparagraph}.\arabic{subsubparagraph}}{1em}{}

\titlespacing{\subsubparagraph}{0pt}{-3.25ex plus-1ex minus-.2ex}{1.25ex plus .1ex}

\newcounter{subsubparagraph}[subparagraph]

\titlespacing{\subparagraph}{0pt}{-3.25ex plus-1ex minus-.2ex}{1.25ex plus .1ex}
\titleclass{\subsubsubparagraph}{straight}[\subparagraph]

\titleformat{\subsubsubparagraph}{\normalfont\normalsize\bfseries}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}.\arabic{paragraph}.\arabic{subparagraph}.\arabic{subsubparagraph}.\arabic{subsubparagraph}}{1em}{}

\titlespacing{\subsubsubparagraph}{0pt}{3.25ex plus-1ex minus-.2ex}{1.25ex plus .1ex}

\newcounter{subsubsubparagraph}[subsubparagraph]

\renewcommand\thesubsubparagraph {\arabic{section}.\arabic{subsection}.\arabic{subsubsection}.\arabic{paragraph}.\arabic{subparagraph}.\arabic{subsubparagraph}}% 

\setcounter{secnumdepth}{8}
\setcounter{tocdepth}{8}

\newcommand*\l@subsubparagraph{\@dottedtocline{7}{12em}{2em}}
\newcommand*\l@subsubsubparagraph{\@dottedtocline{8}{17em}{2em}}


\begin{document}

\setcounter{tocdepth}{10}
\setcounter{secnumdepth}{10}
\tableofcontents

\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\paragraph{Paragraph}
\subparagraph{Subparagraph}
\subsubparagraph{Subsubparagraph}
\subsubsubparagraph{Subsubparagraph}

\end{document}

The title of the subsubparagraph is overlapping with the numbering. enter image description here

How can I fix this?

3
  • 1
    This is similar in nature to How to add an extra level of sections with headings below \subsubsection
    – Werner
    Jul 13 '17 at 18:29
  • What happens when you change some of the lengths in your definition of \l@subsubparagraph? That seems to be the one causing the overlapping problem.
    – Werner
    Jul 13 '17 at 18:30
  • 2
    Is this really necessary? Wouldn't it be better to use a book - structure class (or memoir with its book level) in order to have 7 or even 8 levels of structures (I never needed more than 5, I think, yet, in my 'typo' life) instead of inventing such things?
    – user31729
    Jul 13 '17 at 19:04
9

Note that package titlesec breaks some of the KOMA-Script features. So it is not recommended to use this package together with scrartcl.

You can use \DeclareNewSectionCommands and \RedeclareSectionCommand:

\documentclass[parskip=full]{scrartcl}[2016/05/10]
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\DeclareNewSectionCommands[
  style=section,
  level=\subparagraphnumdepth+1,
  beforeskip=-3.25ex plus -1ex minus -.2ex,
  afterskip=1.25ex plus .1ex,
  counterwithin=subparagraph,
  font={},
  indent=0pt,
  toclevel=\subparagraphtocdepth+1,
  tocnumwidth=6em
]{subsubparagraph,subsubsubparagraph}

\RedeclareSectionCommand[
  tocindent=12em
]{subsubparagraph}
\RedeclareSectionCommand[
  tocindent=14em
]{subsubsubparagraph}

\setcounter{secnumdepth}{\subsubsubparagraphnumdepth}
\setcounter{tocdepth}{\subsubsubparagraphtocdepth}

\begin{document}
\tableofcontents
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
Text
\paragraph{Paragraph}
Text
\subparagraph{Subparagraph}
Text
\subsubparagraph{Subsubparagraph}
Text
\subsubsubparagraph{Subsubsubparagraph}
Text
\end{document}

Result:

enter image description here

As you can see in the image paragraph and subparagraph are inline headings. A negative value of afterskip sets a horizontal skip resulting in an inline heading. So if the headings for the new defined levels should also be inline headings, use afterskip=-1em. But if there should be vertical space after the paragraph and subparagraph change their afterskip to a positiv value, eg:

\RedeclareSectionCommands[
  afterskip=1.25ex plus .1ex
]{paragraph,subparagraph}
0

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.