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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

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: 10335
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