3

I have some sections (e.g. References) that don't have a section number. However, I'd like to include them in the TOC with \addcontentsline{toc}. But how can this manually added section be aligned to all other sections in the TOC. So probably I need the indentatoin space that is reserved for the section numbers and at it to \addcontentsline{toc}{section}{\hspace{definedspace}Test Section One Three}.

\documentclass{scrreprt}

\begin{document}

\tableofcontents

\chapter{Test Chapter One}
\section{Test Section One One}
\section{Test Section One Two}

\addcontentsline{toc}{section}{Test Section One Three}
\section*{Test Section One Three}

\end{document}
  • 4
    \addcontentsline{toc}{section}{\protect\numberline{}Test Section One Three} – Ulrike Fischer Apr 16 '14 at 13:48
  • 1
    Note also that \addcontentsline should go after \section*, because otherwise the entry in the table of contents could be off by one. – egreg Apr 16 '14 at 14:12
5

Use option toc=indentunnumbered to setup the table of contents to indent entries without number and command \addsec to add such sections automatically to the table of contents:

\documentclass[toc=indentunnumbered]{scrreprt}

\begin{document}

\tableofcontents

\chapter{Test Chapter One}
\section{Test Section One One}
\section{Test Section One Two}

\addsec{Test Section One Three}

\end{document}

Maybe you need current KOMA-Script version to be able to use option toc=indentunnumbered.

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.