2

I'm using KOMA script's scrartcl class and have customized the section numbering as in the following MWE:

\documentclass{scrartcl}
\begin{document}
    \renewcommand{\thesection}{\alph{section}}
    \section{Introduction}
\end{document}

This gives me the output:
a. Introduction

Now I'd like to replace the dot character after the section number (".") by a closing parenthesis (")"). The best solution I've found so far is:

\renewcommand\sectionformat{\thesection)\enskip}

which results in
a) Introduction.

However, I'm wondering if this way is recommendable or if there is a more canonical way to do it. Especially, I'd like to just change the character in question without touching the horizontal spacing or prefix and in the best case I'd like to be able to change multiple levels (section, subsection, paragraph etc.) at once.

3
  • Maybe see the titlesec package...?
    – user202729
    Jul 19, 2022 at 3:03
  • There's always the option of using patchcmd or similar, but that doesn't seem good either.
    – user202729
    Jul 19, 2022 at 3:04
  • Changing \sectionformat is the way to go with scrartcl, which has been incompatible with titlesec for a few years.
    – egreg
    Jul 19, 2022 at 7:45

2 Answers 2

1

The komascript classes offer the choice of having a period after all sectional numbers or not. By default they follow Duden's recommendation that all numeric labels aren't followed by a period, nonnumeric are.

At least this is what the manual says, but isn't what actually happens: maybe I don't read correctly the manual.

If you're bold, you can redefine the meaning of \autodot:

\makeatletter
\renewcommand*\autodot{\if@altsecnumformat)\fi}
\makeatother

Full example.

\documentclass{scrartcl}

\renewcommand{\thesection}{\alph{section}}
\makeatletter
\renewcommand*\autodot{\if@altsecnumformat)\fi}
\makeatother

\begin{document}

\section{Title}

\subsection{Another}

\end{document}

enter image description here

But the real solution is indeed to use \sectionformat. You can read in the manual (page 110 of the current version) that the standard format for all sectional titles (from \section down) is to have \enspace between the number (possibly followed by a period) and the title.

So indeed

\sectionformat{\thesection)\enspace}

is the way to go. You need to change all levels, though, there is no generic setting.

3
  • 1
    997k -- you are really close! Will there be a party at 1M?
    – Keks Dose
    Jul 19, 2022 at 9:45
  • 2
    @KeksDose Big party!
    – egreg
    Jul 19, 2022 at 9:52
  • sir @egreg Kindly include me also into the party.... :-D
    – MadyYuvi
    Jul 19, 2022 at 9:55
0

What you are doing is ok, but maybe you have more levels to change and if, you might want a table of contents and so on.

So let's extend your MWE to a whole document, using the blindtext package:

\documentclass[ngerman, numbers=nodotatend]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{blindtext, lmodern}

\renewcommand{\thesection}{\alph{section})}
%\renewcommand\sectionformat{\thesection)\enskip}


\begin{document}
\tableofcontents{}

\blinddocument

\end{document}

Result (only part of first page): pic of page

The renewcommand would add the ")" only to the heading, but not to the TOC.

If you need to redefine more of the headings, please have a closer look into the manual, sect. 21.8, regarding "\DeclareSectionCommand[Einstellungen ]{Name }" (german version, texdoc scrguideon command line, english version texdoc scrguien).

You must log in to answer this question.

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