# How to remove the underline from the ToC title at KOMA-script?

I made underline titles of sections at KOMA-script.
Here is MWE:

\documentclass{scrartcl}
\usepackage{ulem}

\begin{document}

\renewcommand\raggedsection{\centering}
\section{ABC}

\tableofcontents{}

\end{document}


The problem is that also the ToC title is underlined.

There is a way to cancel it? (I'm asking about the title - "Contents")
i.e. The sections titles will be underlined and only the ToC (and other lists like it) will be with no underline.

Thank you!

• Please clarify your formatting objective(s) regarding the appearance of the Table of Contents: Do you want just the string "Contents" to be not-underlined, or should the section-level ToC entries also be not-underlined? – Mico Mar 17 at 10:21
• @Mico, just the string "Contents". As you can see the section-level ToC entries are not-underlined... :-) – heblyx Mar 17 at 10:24

You can use a user command and redefine it before the table of contents (and back after it). The example also shows that \uline affects the centering.

The much better idea would be not to use underlining.

\documentclass{scrartcl}
\usepackage{ulem}
\newcommand\myuline{\uline}
\renewcommand\raggedsection{\centering}

\begin{document}

\section{ABC}

\let\myuline\relax
\tableofcontents{}

\end{document}


• And if I want that also the ABC section will be at the center what I need to do? Thank you!! – heblyx Mar 17 at 18:07
• then don't use \uline. – Ulrike Fischer Mar 17 at 18:13
• I play with it little bit and I found a new way to do this (I just define the \sectionlinesformat at ERT before the ToC - and it's works!). Thank you!! – heblyx Mar 17 at 18:17