4

I want my subsection heading to have an italic title but an upright number:

1.2.3 My Title

How can I reach this in KOMA? I only got the whole title in italics:

\documentclass{scrbook}
\usepackage{blindtext}
\addtokomafont{disposition}{\rmfamily}
\addtokomafont{subsection}{\itshape}
\begin{document}
\blinddocument
\end{document}

Or do I need titlesec?

1 Answer 1

7
\documentclass{scrbook}
\usepackage{blindtext}
\addtokomafont{disposition}{\rmfamily}
\addtokomafont{subsection}{\itshape}

\newcommand\subsectionnumberfont{\upshape}
\renewcommand*{\othersectionlevelsformat}[3]{\csname#1numberfont\endcsname#3\autodot\enskip}

\begin{document}
\blinddocument
\end{document}

enter image description here

Edit

With newer versions of scrbook you do it like this:

\documentclass{scrbook}
\usepackage{blindtext}
\addtokomafont{disposition}{\rmfamily}
\addtokomafont{subsection}{\itshape}
\renewcommand*{\subsectionformat}{\upshape \thesubsection\autodot\enskip}

\begin{document}
\blinddocument
\end{document}
3
  • Unfortunately, your solution seems not to work anymore (KOMA-Script 3.19a). Is there an other way to achieve the same result?
    – jlk
    Oct 26, 2015 at 21:13
  • I tried to achieve something similar with \renewcommand*{\subsectionformat}{\makebox[40pt][r]{\\upshape\thesubsubsection\autodot\enskip}} but it seems pretty wrong because of the fixed length of 40pt -- isn't there a more elegent way?
    – jlk
    Oct 26, 2015 at 21:50
  • @harryhaller I edited the answer. But I have no idea why you introduced the makebox. Oct 26, 2015 at 23:07

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.