0

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

\documentclass{scrartcl}
\usepackage{ulem}
\addtokomafont{section}{\uline}

\begin{document}

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

\tableofcontents{}

\end{document} 

enter image description here

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!

  • 1
    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
1

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}
\addtokomafont{section}{\myuline}
\newcommand\myuline{\uline}
\renewcommand\raggedsection{\centering}

\begin{document}

\section{ABC}

\let\myuline\relax
\tableofcontents{}

\end{document} 

enter image description here

  • 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
  • 1
    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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.