4

I am using the cleanthesis.sty and I would like to have numbered subsubsections, which are in style and format similar to the subsection, just a little bit smaller maybe. I tried editing the *.sty file directly, but had no success. Is there a simpler way?

5

Try adding the following code in your preamble:

\makeatletter
\setcounter{secnumdepth}{3}
\titlespacing{\subsubsection}{0em}{.5em}{0em}%[0pt]
\ifct@cthesis@hangsubsection
        \titleformat{\subsubsection}[hang]%
            {\usekomafont{subsubsection}}%
            {\color{ctcolorblack}\thesubsubsection\hspace*{10pt}}%
            {0pt}%
            {\raggedright}%
            [\phantomsection]
\else
        \titleformat{\subsubsection}[block]%
            {\usekomafont{subsubsection}}%
            {\color{ctcolorblack}\thesubsubsection\hspace*{10pt}}%
            {0pt}%
            {\raggedright}%
            [\phantomsection]
\fi
\makeatother

The line

\setcounter{secnumdepth}{3}

gives you the correct numbering, while the rest of the code is to produce the title of the subsubsection similar to the one for subsections.

MWE:

\documentclass{scrbook}

\usepackage{cleanthesis}

\makeatletter
\setcounter{secnumdepth}{3}
\titlespacing{\subsubsection}{0em}{.5em}{0em}%[0pt]
\ifct@cthesis@hangsubsection
        \titleformat{\subsubsection}[hang]%
            {\usekomafont{subsubsection}}%
            {\color{ctcolorblack}\thesubsubsection\hspace*{10pt}}%
            {0pt}%
            {\raggedright}%
            [\phantomsection]
\else
        \titleformat{\subsubsection}[block]%
            {\usekomafont{subsubsection}}%
            {\color{ctcolorblack}\thesubsubsection\hspace*{10pt}}%
            {0pt}%
            {\raggedright}%
            [\phantomsection]
\fi
\makeatother

\begin{document}

\chapter{Chapter}

\section{Section}

\subsection{Subsection}

\subsubsection{Subsubsection}

\end{document} 

Output:

enter image description here

  • Thank you! That's exactly what I was looking for. :-) I nearly had the same code trying to edit the *.sty file... – Mil Nov 14 '13 at 16:24
  • 1
    @Mil Glad to help. Please consider accepting the answer (see How do you accept an answer?). – karlkoeller Nov 14 '13 at 16:32
  • I accepted it. Thank you for letting me know about these functions - this is a great and well designed place. :) I do have another short question: How do I change the font of this new subsubtitle, e.g. also make it in this color of the other titles? – Mil Nov 15 '13 at 8:01
  • @Mil Add the following in the preamble \newcommand{\thesissubsubsectionfont}{\color{ctcolorsection}\tgherosfont} \setkomafont{subsubsection}{\thesissubsubsectionfont} – karlkoeller Nov 15 '13 at 9:50
0

I have another short question. If I want to create a subsubsubsection or a numbered paragraph respectively, how can I change the code for that? I tried editing Karl's code, but it didn't work for me. I'd greatly appreciate your ideas. :-)

Edit: okay I managed on my own. Actually it was as easy as I expected it to be:

\setkomafont{paragraph}{\thesissubsubsectionfont\normalsize\itshape}
\makeatletter
\setcounter{secnumdepth}{3} %unnumbered
\titlespacing{\paragraph}{0em}{.4em}{0em}%[0pt]
\ifct@cthesis@hangsubsection
        \titleformat{\paragraph}[hang]%
            {\usekomafont{paragraph}}%
            {\color{ctcolorblack}\theparagraph\hspace*{8pt}}%
            {0pt}%
            {\raggedright}%
            [\phantomsection]
\else
        \titleformat{\paragraph}[block]%
            {\usekomafont{paragraph}}%
            {\color{ctcolorblack}\theparagraph\hspace*{8pt}}%
            {0pt}%
            {\raggedright}%
            [\phantomsection]
\fi
\makeatother
  • OKay, I managed myself. Actually it was as easy as I thought it should be: – Mil Dec 11 '13 at 9:45
  • 2
    Asking another question in an answer and unaccepting mine is not correct at all. You should have asked a new question and gave your own answer... – karlkoeller Dec 11 '13 at 10:02
  • Oh, I am sorry Karl - I didn'd realize that. I am new to stackexchange and these functions. I did not mean to unaccept your reply (which was a really great and helpful one) but wanted to indicate that my second question can be considered resolved. sorry for the misunderstanding. :-) – Mil Dec 11 '13 at 18:06
  • It doesn't matter. When you want small clarifications you can comment an answer, while when you want to ask something different you'd better ask a new question. In this case I suggest you to delete this answer and, if you want, ask it as a new question and give your own answer. :-) – karlkoeller Dec 11 '13 at 18:12

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.