0

I am using this suggestion How to add an extra level of sections with headings below \subsubsection to use more level of sections and I would like to control the font colour as well.

I tried this so far

\documentclass{article}
\usepackage[utf8]{inputenc}

%\usepackage[utf8]{inputnc}

\usepackage{xcolor}

\usepackage{sectsty}

\usepackage{titlesec} \usepackage{hyperref}

\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

\sectionfont{\color{blue}} \subsectionfont{\color{orange!90!black}} \subsubsectionfont{\color{orange!70!white}} \subsubsubsectionfont{\color{orange!50!white}}

\setcounter{secnumdepth}{4} \setcounter{tocdepth}{4}

\title{test}

\begin{document}

\maketitle

\tableofcontents

\section{Introduction} \subsection{Introduction} \subsubsection{Introduction} \subsubsubsection{Introduction}

\end{document}

unmark1
  • 469
  • there are already two levels of section below subsubsection do you really need another, so 6 levels in all 1.1.1.1.1.1 section ? There is no answer to th quesion in the title, a class can define as many levels as it wans but few auhors ever need more than the 5 levels offered by article or 6 levels offered by report class. – David Carlisle May 01 '22 at 22:27
  • Actually I would like to know how to control the colour fonts. – unmark1 May 01 '22 at 22:29
  • The definition of (say) \paragraph in article.cls is, in total \newcommand\paragraph{\@startsection{paragraph}{4}{\z@}% {3.25ex \@plus1ex \@minus.2ex}% {-1em}% {\normalfont\normalsize\bfseries}} just add \color{red} alongside \bfseries and it will be red, there is nothing special needed – David Carlisle May 01 '22 at 22:32
  • Thank you, it worked. May you explain why this \subsubsubsectionfont{\color{orange!50!white}} does not work, please? – unmark1 May 01 '22 at 22:40
  • there is no \subsubsubsection command by default (the level after \subsubsection is called \paragraph so naturally unless you define it, there is no \subsubsubsectionfont command either. – David Carlisle May 01 '22 at 23:07
  • Fair enough! Thx!!! – unmark1 May 01 '22 at 23:14

0 Answers0