1

How can I put subsection title on the right (outer) margin using Koma Script?

I do not want to use titlesec package.

Although this is working snippet with titlesec package:

\usepackage[explicit]{titlesec}

\titleformat{\subsection}[runin]{\scshape}{}{\parindent}%
{\checkoddpage\marginnote{#1}[-\baselineskip]}[\leavevmode\hspace*{-\marginparsep}]
1
  • Probably yes. I think you can.
    – Johannes_B
    Commented Dec 17, 2016 at 7:49

1 Answer 1

4

With KOMA-Script version 3.19 or newer:

\RedeclareSectionCommand[
    afterskip=-\parindent
]{subsection}
\setkomafont{subsection}{\normalfont\scshape}

\renewcommand{\sectioncatchphraseformat}[4]{%
    \ifstr{#1}{subsection}
        {\marginnote{#4}}
        {\hskip #2#3#4}%
}

If only sections and higher levels should be numbered, you have to set the counter secnumdepth to \sectionnumdepth:

\setcounter{secnumdepth}{\sectionnumdepth}

Example:

enter image description here

Code:

\documentclass{scrbook}[2016/10/03]% needs version 3.19 or newer
\usepackage{lipsum}
\usepackage{marginnote}

\RedeclareSectionCommand[
    afterskip=-\parindent
]{subsection}
\setkomafont{subsection}{\normalfont\scshape}

\renewcommand{\sectioncatchphraseformat}[4]{%
    \ifstr{#1}{subsection}
        {\marginnote{#4}}
        {\hskip #2#3#4}%
}

\setcounter{secnumdepth}{\sectionnumdepth}

\begin{document}
\chapter{Chapter One}
\section{Section One}
\subsection{Subsection One}
\lipsum
\subsection{Longer Title for Subsection Two}
\lipsum
\subsection{Subsection Three}
\lipsum
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .