[Tex/LaTex] How to remove toc title in KOMAscript classes

koma-scripttable of contents

In the "normal" classes one can remove the TOC title (the "Content" heading) with

\renewcommand\tableofcontents{\@starttoc{toc}}

But when I do this on KOMAScript classes (e.g. scrartcl) this also changes some other settings (e.g. vertical spaces) of KOMAscript which I don't want to change.

How can I remove only the table of contents' headline without changing anything else?

Note: I don't want the line to be empty (so, not an empty string "", like \renewcommand{\contentsname}{} would do), but so that the headline is not there at all and the space gets "freed".

Best Answer

Using the \phantom command provides help here: It acts and uses the box for the \contentsname content, as if it would be present, but outputs an empty box with the correct dimensions.

However, the original \contentsname content has to be stored via a \let command to some other macro, before it can be redefined.

\documentclass[paper=a4,12pt]{scrartcl}


% Redefine the contentsname, but save it before...
\let\LaTeXStandardContentsName\contentsname
\renewcommand{\contentsname}{\phantom{\LaTeXStandardContentsName}}%

\begin{document}
\tableofcontents%
\clearpage

\section{First}
\clearpage
\section{Second}

enter image description here

The 'same' code without \renewcommand provides the \contentsname above, without vertical shift.



After some misunderstandings the solution seems to be the \deftocheading{toc}{} approach, a somewhat hidden command in the manual ;-)

\documentclass[paper=a4,12pt]{scrartcl}

\deftocheading{toc}{}%
\begin{document}
\tableofcontents%
\clearpage

\section{First}
\clearpage
\section{Second}

\end{document}
Related Question