8

In Koma-Script I use \addsec{.} to add section without numbers. However, with respect to my ToC this gives undesirable results, as the unnumbered section-title is aligned with the beginning of the ToC line. How do I make unnumbered section aligned with numbered section in the ToC?

\documentclass{scrartcl}
\usepackage{tocstyle}
\usetocstyle{nopagecolumn}
\selecttocstyleoption{tocflat}

\begin{document}

\tableofcontents{}
\hrulefill
\section{First section}

\section{Second section}

\subsection{A subsection}

\addsec{A section which should not have a number}
\end{document}

output

2 Answers 2

8

Add the tocstyle package option toctextentriesindented.

\documentclass{scrartcl}
\usepackage[toctextentriesindented]{tocstyle}
\usetocstyle{nopagecolumn}
\selecttocstyleoption{tocflat}

\begin{document}

\tableofcontents{}
\hrulefill
\section{First section}

\section{Second section}

\subsection{A subsection}

\addsec{A section which should not have a number}
\end{document}

enter image description here

1
  • Thanks. Sorry about not reading the manual properly.
    – Rasmus
    Mar 10, 2012 at 14:15
2

Here is a suggestion that needs at least KOMA-Script Version 3.20 (current on CTAN) but does not use any additional package.

\documentclass[toc=indenttextentries,toc=flat]{scrartcl}[2016/05/10]

\RedeclareSectionCommands[
  tocraggedpagenumber,
  toclinefill=\quad
]{part,section,subsection,subsubsection}

\begin{document}
\tableofcontents

\noindent\hrulefill
\section{First section}
\section{Second section}
\subsection{A subsection}
\addsec{A section which should not have a number}
\end{document}

enter image description here

You must log in to answer this question.

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