1

I want the subsubsection starts from 1.1.1 instead its numeration is starting from 1.1.0, where's the problem, note that I used the renewcommand that allows you to custom the book or any class's parts, it worked for the subsection, but it didn't with the subsubsection.

Here's the code :

% !TeX program = xelatex
\documentclass[openany,12pt]{scrbook}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[tmargin=1.5cm,bmargin=1.5cm,rmargin=1.8cm,lmargin=1.8cm]{geometry}
\frenchbsetup{IndentFirst=false}
\usepackage{tcolorbox}
\usepackage{xcolor}
\usepackage[explicit]{titlesec}
\usepackage{lipsum}


\newtcolorbox{titlecolorbox}[1]{
    coltext=white,
    colframe=black,
    colback=black,
    boxrule=0pt,
    arc=0pt,
    notitle,
    width=4.8em,
    height=2.4ex,
    before=\hfill
}
\titleformat{\chapter}[display]
  {\huge}
  {}
  {2pt}
  {\begin{titlecolorbox}{}
  {\large\MakeUppercase{\chaptername}}
  \end{titlecolorbox}
  \vspace*{-3.08ex}\textcolor{black}{\noindent\rule{\textwidth}{0.5pt}}
  \parbox[b]{\dimexpr\textwidth-4.8em\relax}{\raggedright\MakeUppercase{#1}}{\hfill\fontsize{70}{60}\selectfont\textcolor{blue}{\thechapter}}
  }
  []
  
  

\titleformat{\section}[display]
  {\Large}
  {}
  {0pt}
  {\parbox[b]{\dimexpr\textwidth\relax}{\textcolor{blue}{\thesection}\quad\raggedright\textcolor{blue}{\bfseries{#1}}}}


  \titleformat{\subsection}[display]
  {\large}
  {}
  {0pt}
  {\textcolor{cyan}{\thesubsection}\quad\raggedright\textcolor{cyan}{\textbf{#1}}}
  
  \titleformat{\subsubsection}[display]
  {\normalsize}
  {}
  {0pt}
  {\textcolor{cyan}{\thesubsubsection}\quad\raggedright\textcolor{cyan}{\textbf{#1}}}
  
\renewcommand\thechapter{\Roman{chapter}}
\renewcommand\thesection{\arabic{section}}
\renewcommand\thesubsection{\thesection.\arabic{subsection}}
\renewcommand{\thesubsubsection}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}
\begin{document}
\chapter{Chapter  :}
\section{section  :}
bla bla bla bla....
\subsection{subsection :}
bla bla bla bla....
\subsubsection{subsubsection :}
bla bla bla bla....
\end{document}

enter image description here

Any thought on how to solve the following problem ?

4
  • 1
    Have you tried \setcounter{secnumdepth}{3}?
    – Tom
    Jun 7 at 23:31
  • @Tom No, I'm gonna try it now !
    – euler_med
    Jun 7 at 23:34
  • @Tom It worked, will you consider to edit the code, and publish it as an answer so I can upvote it ?
    – euler_med
    Jun 7 at 23:35
  • 1
    That's fine, We have already solved it through the comment. initial secnumdepth was set to 2, however subsubsection have secnumdepth equal to 3, So it will not be numbered. It was not start from 0. It will be always 0 if you don't set the secnumdepth equal to 3
    – Tom
    Jun 7 at 23:41

1 Answer 1

2

With a KOMA-Script class you can use

\setcounter{secnumdepth}{\subsubsectionnumdepth}
\setcounter{tocdepth}{\subsubsectiontocdepth}

to get numbered subsubsections and TOC entries for the subsubsections.

Additional remarks:

  1. The redefinitions of \thesection, \thesubsection etc. are not needed. The redefinition of \thechapter is enough.
  2. Do not use package titlesec with a KOMA-Script class!

Suggestion:

\documentclass[
  open=any,fontsize=12pt,
  numbers=noenddot% <- added
]{scrbook}
\usepackage[french]{babel}
\frenchbsetup{IndentFirst=false}

\usepackage[T1]{fontenc}
\usepackage[vmargin=1.5cm,hmargin=1.8cm]{geometry}
\usepackage{tcolorbox}% loads packages tikz, xcolor, graphicx, ...
\usepackage{fix-cm}% make font scalable

\setcounter{secnumdepth}{\subsubsectionnumdepth}
\setcounter{tocdepth}{\subsubsectiontocdepth}
\renewcommand\thechapter{\Roman{chapter}}

\newtcolorbox{titlecolorbox}[1]{
    coltext=white,
    colframe=black,
    colback=black,
    boxrule=0pt,
    arc=0pt,
    notitle,
    width=4.8em,
    height=2.4ex,
    before=\myhrulefill{.5pt}
}
\newcommand\myhrulefill[2][0pt]{\leavevmode\leaders\hrule height #2 depth #1\hfill\kern0pt}

\renewcommand\chapterlinesformat[3]{%
  \begin{titlecolorbox}{}\large\MakeUppercase{\chaptername}\end{titlecolorbox}\medskip
  \parbox[b]{\dimexpr\textwidth-4.8em\relax}{\raggedright\MakeUppercase{#3}}\hfill#2
}

\renewcommand{\chapterformat}{{\usekomafont{chapternumber}{\thechapter\autodot}}}
\renewcommand{\sectionformat}{{\usekomafont{headingnumber}{\thesection\autodot\quad}}}
\renewcommand{\subsectionformat}{{\usekomafont{headingnumber}{\thesubsection\autodot\quad}}}
\renewcommand{\subsubsectionformat}{{\usekomafont{headingnumber}{\thesubsubsection\autodot\quad}}}

\newkomafont{headingnumber}{\mdseries}
\newkomafont{chapternumber}{\usekomafont{headingnumber}\fontsize{70}{60}\selectfont\color{blue}}
\addtokomafont{disposition}{\normalfont\bfseries}
\addtokomafont{chapter}{\normalfont\huge}
\addtokomafont{section}{\Large\color{blue}}
\addtokomafont{subsection}{\large\color{cyan}}
\addtokomafont{subsubsection}{\normalsize\color{cyan}}

\begin{document}
\tableofcontents
\chapter{Chapter :}
\section{section :}
bla bla bla bla ...
\subsection{subsection :}
bla bla bla bla ...
\subsubsection{subsubsection :}
bla bla bla bla ...
\end{document}

enter image description here

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.