TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 7 down vote accepted

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

share|improve this answer
    
Thanks. Sorry about not reading the manual properly. – Rasmus Mar 10 '12 at 14:15

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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