4

Well, this time I have a very concise doubt about how to get a section style different from the default one in KOMA-Script (actually within the scratcl class) without use the titlesec package.

With the titlesec package I can get what I need with this code:

\titleformat{\subsection}[runin]
{\scshape\bfseries}
{\color{blue} \S \thesubsection .}
{1ex}{\color{blue}}[.\quad]
\subsection{\mbox{}}
Text Text Text Text Text
Text Text Text Text Text
Text Text Text Text Text

I found this question about incompatibilities between titlesec and KOMA-Script but I haven't a clear idea yet about how to get the above result in a barebone KOMA-Script way.

My MWE of course:

\documentclass[fontsize=14pt,paper=letter,headings=big,DIV=calc,headsepline=true,titlepage=on,draft=false,index=totoc]{scrartcl}
\usepackage[usenames,dvipsnames,x11names,table,rgb]{xcolor}
\usepackage[spanish,mexico,es-ucroman]{babel}
\usepackage{amsmath}

\KOMAoption{parskip}{half*}
\begin{document}

\section{Recuperación de costos}

\subsection{\mbox}

Text Text Text Text Text
Text Text Text Text Text
Text Text Text Text Text

\end{document}

1 Answer 1

4

You can \RedeclareSectionCommand to change the skips before and after the heading. A negative value of afterskip will result in a horizontal skip. So you get a runin heading. To change the format of the subsection number in the heading you can redefine \subsectionformat. To insert the dot at the end of the subsection title redefine \sectioncatchphraseformat.

\RedeclareSectionCommand[
  afterskip=-1ex,
  font=\rmfamily\scshape\bfseries\color{blue}
]{subsection}
%
\renewcommand\subsectionformat{\S \thesubsection\autodot\hspace{1ex}}
\renewcommand{\sectioncatchphraseformat}[4]{%
    \hskip #2#3#4%
    \ifstr{#1}{subsection}{.}{}%
  }

To ensure that the heading numbers will be controlled by the KOMA-Script class use the babel option es-nosectiondot and the KOMA-Script option numbers=enddot.

enter image description here

Code:

\documentclass[
  fontsize=14pt,paper=letter,headings=big,DIV=calc,
  headsepline=true,titlepage=on,draft=false,index=totoc,
  parskip=half*,
  numbers=enddot% <- added
]{scrartcl}[2015/10/03]
\usepackage[T1]{fontenc}% <- added
\usepackage[utf8]{inputenc}% <- added

\usepackage[usenames,dvipsnames,x11names,table,rgb]{xcolor}
\usepackage[spanish,mexico,es-ucroman,
  es-nosectiondot% <- added
]{babel}


\RedeclareSectionCommand[
  afterskip=-1ex,
  font=\rmfamily\scshape\bfseries\color{blue}
]{subsection}
%
\renewcommand\subsectionformat{\S \thesubsection\autodot\hspace{1ex}}
\renewcommand{\sectioncatchphraseformat}[4]{%
    \hskip #2#3#4%
    \ifstr{#1}{subsection}{.}{}%
  }

\begin{document}
\section{Recuperación de costos}

\subsection{\mbox{}}
Text Text Text Text Text
Text Text Text Text Text
Text Text Text Text Text

\subsection{Subsectiontitel}
Text Text Text Text Text
Text Text Text Text Text
Text Text Text Text Text
\end{document}

You must log in to answer this question.

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