Underlining subsections / subsubsections in LaTeX with ulem?

Viewed 41

I want to underline subsubsections in the way shown in the example below with the uwave method of the ulem package.

\documentclass[12pt,paper=a4, numbers=endperiod]{scrartcl} 
\usepackage[svgnames]{xcolor}


%-------------------------------------------------------------------------------------------------------
% Sections   
%--------------------------------------------------------------------------------------------
\setkomafont{section}{\bfseries \sffamily\LARGE}    
\setkomafont{subsection}{\bfseries \sffamily \large}    
\setkomafont{subsubsection}{ \bfseries \sffamily}   

\renewcommand\sectionformat{\makebox[0pt][r]{\color{Green}\thesection\autodot\enskip}}
\renewcommand\subsectionformat{\color{Green}\thesubsection\autodot\enskip}
\renewcommand\subsubsectionformat{\color{Green} \thesubsubsection\autodot\enskip} %or \enskip



%UNDERLINED SUBSECTIONS     
\usepackage{ulem}
\normalem  
\newcommand\subsectionuline{%   
    \bgroup\markoverwith{\textcolor{Green}{\rule[-.55ex]{1pt}{.5pt}}}
    \ULon%    
}         
\addtokomafont{subsection}{\subsectionuline}




\begin{document}       
\section{The section}    
\subsection{The subsection}    
 
\subsubsection{This should be underlined with a \uwave{wave}}
    \end{document}

I have already manged to redefine the \subsection to be underlined with a straight rule- I am using KOMA classes, which are sadly not compatible with the titlesec package. So what is the best way to make these "curly" rules with KOMA classes?

Example of how it should look like

The \rule command can unfortunately not be replaced with the \uwave as emphasized with the \subsectionuline command...

1 Answers

You can try with \addtokomafont{subsubsection}{\uwave}:

\documentclass[12pt,paper=a4, numbers=endperiod]{scrartcl} 
\usepackage[svgnames]{xcolor}


%-------------------------------------------------------------------------------------------------------
% Sections   
%--------------------------------------------------------------------------------------------
\setkomafont{section}{\bfseries \sffamily\LARGE}    
\setkomafont{subsection}{\bfseries \sffamily \large}    
\setkomafont{subsubsection}{ \bfseries \sffamily}   

\renewcommand\sectionformat{\makebox[0pt][r]{\color{Green}\thesection\autodot\enskip}}
\renewcommand\subsectionformat{\color{Green}\thesubsection\autodot\enskip}
\renewcommand\subsubsectionformat{\color{Green} \thesubsubsection\autodot\enskip} %or \enskip



%UNDERLINED SUBSECTIONS     
\usepackage{ulem}
\normalem  
\newcommand\subsectionuline{%   
    \bgroup\markoverwith{\textcolor{Green}{\rule[-.55ex]{1pt}{.5pt}}}
    \ULon%    
}         
\addtokomafont{subsection}{\subsectionuline}
\addtokomafont{subsubsection}{\uwave}


\begin{document}       
\section{The section}    
\subsection{The subsection}    
 
\subsubsection{This should be underlined with a \uwave{wave}}

test

\section{The section}    
\subsection{The subsection}    

    \end{document}

enter image description here

Related