GeneralExtra section levels

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
skrat
Posts: 11
Joined: Fri Sep 05, 2014 5:22 pm

Extra section levels

Post by skrat »

Hi,

In order to finish my paper I would need more levels.
So far I have used \section than \subsection than \subsubsection which is basically all that latex has defined by default. (I want them to be numbered and also shown in the table of contents).
So I googled and found out this: http://tex.stackexchange.com/questions/ ... subsection

And used the following code:

Code: Select all

\titleclass{\subsubsubsection}{straight}[\subsection]

\newcounter{subsubsubsection}[subsubsection]
\renewcommand\thesubsubsubsection{\thesubsubsection.\arabic{subsubsubsection}}
\renewcommand\theparagraph{\thesubsubsubsection.\arabic{paragraph}} % optional; useful if paragraphs are to be numbered

\titleformat{\subsubsubsection}
  {\normalfont\normalsize\bfseries}{\thesubsubsubsection}{1em}{}
\titlespacing*{\subsubsubsection}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{5}{\z@}%
  {3.25ex \@plus1ex \@minus.2ex}%
  {-1em}%
  {\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{6}{\parindent}%
  {3.25ex \@plus1ex \@minus .2ex}%
  {-1em}%
  {\normalfont\normalsize\bfseries}}
\def\toclevel@subsubsubsection{4}
\def\toclevel@paragraph{5}
\def\toclevel@paragraph{6}
\def\l@subsubsubsection{\@dottedtocline{4}{7em}{4em}}
\def\l@paragraph{\@dottedtocline{5}{10em}{5em}}
\def\l@subparagraph{\@dottedtocline{6}{14em}{6em}}
\makeatother
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
This code adds \subsubsubsection and \paragraph. But there is one small bug in this code: The \paragraph counter does not reset after entering a new \subsubsubsection. Does anybody here have any ideas on how to correct than or maybe has an easier/better solution to my problem?

thanks for all the ideas!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

skrat
Posts: 11
Joined: Fri Sep 05, 2014 5:22 pm

Re: Extra section levels

Post by skrat »

I don't know why this happens to me, but usually as soon as i post anything i find a solution myself. I know, I am horrible.

I found a much easier solution on this forum: http://www.latex-community.org/forum/vi ... ?f=5&t=791

problem solved. Thanks!
User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Re: Extra section levels

Post by Stefan Kottwitz »

No problem - thanks for letting us know! Good that you found it.

Next time we may help to solve. :-)

Stefan
LaTeX.org admin
Post Reply