# How to get a section style in KOMA-Script without titlesec package?

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 .}
\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}


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.

Code:

\documentclass[
parskip=half*,
]{scrartcl}[2015/10/03]

\usepackage[usenames,dvipsnames,x11names,table,rgb]{xcolor}
\usepackage[spanish,mexico,es-ucroman,
]{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}