4

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".

1
  • See my updated solution
    – user31729
    Aug 3 '14 at 16:46
6

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}
4
  • This does still only "hide" the toc title, but does not "free" the vertical space it used.
    – Foo Bar
    Aug 3 '14 at 16:24
  • @FooBar: There was no line that you want "free" the space ;-)
    – user31729
    Aug 3 '14 at 16:28
  • There was, in the question the last line starting with "Note: ". ;) But I made it even more clear now. :)
    – Foo Bar
    Aug 3 '14 at 16:34
  • @foobar: Now it is there, previously there was only no heading at all, not space be freed ;-)
    – user31729
    Aug 3 '14 at 16:36

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.