How to change the heading for \tableofcontents in Latex?

1k Views Asked by At

I've been trying to change the layout of my \tableofcontents in Latex for a while now and I can't find a solution. So the problem is, I have some chapters added before the table of contents. I managed to disable all headings for the frontmatter, but now the title of the last chapter is being shown.

I'm using the scrbook environment and nothing really seems to work. This is how I create my frontmatter in a seperate toc_lof_lot_lol.tex file.

\renewcommand{\contentsname}{Inhaltsverzeichnis}
\renewcommand{\listfigurename}{Abbildungsverzeichnis}
\renewcommand{\listtablename}{Tabellenverzeichnis}
\renewcommand{\listalgorithmname}{Pseudocodeverzeichnis}
\renewcommand{\lstlistlistingname}{Quelltextverzeichnis}

\tableofcontents   

\listoffigures\thispagestyle{empty}
\clearpage{\pagestyle{empty}\cleardoublepage} 
\listoftables\thispagestyle{empty}
\clearpage{\pagestyle{empty}\cleardoublepage} 
\lstlistoflistings\thispagestyle{empty}
\clearpage{\pagestyle{empty}\cleardoublepage} 

\setcounter{page}{1}

This is the content before the table of contents in 01_0_fundamental_stuff_root.tex

\chapter{Liste der Abkürzungen}
\thispagestyle{empty}
\begin{itemize}
    \item \textbf{A} - Text A
    \item \textbf{B} - Text B
    \item \textbf{V} - Text C
\end{itemize}
\clearpage

And this is my document structure

\begin{document}
\frontmatter 
    \include{chapters/00_title/00_title}       
    \include{chapters/01_fundamental_stuff/01_0_fundamental_stuff_root}
    \include{sources/toc_lof_lot_lol}      
\mainmatter
    \doublespacing
    \include{...}      
    ...
\backmatter
    \singlespacing
    ...
\end{document}

My Table of contents looks like this right now, but I either want to change the text in the heading to "Inhaltsverzeichnis" or simply delete the text in the heading completely

Table of Contents

1

There are 1 best solutions below

0
Kuzniarz On

So I managed to create an invisible chapter before the table of contents, so the text in the heading changed to "Inhaltsverzeichnis"

I added this command before the beginning of the document

\makeatletter
\newcommand{\unchapter}[1]{%
  \begingroup
  \let\@makechapterhead\@gobble % make \@makechapterhead do nothing
  \chapter{#1}
  \endgroup
}
\makeatother

Then I changed the \tableofcontents command in the toc_lof_lot_lol.tex

\let\oldtableofcontents\tableofcontents
\makeatletter
\renewcommand{\tableofcontents}{%
\unchapter{Inhaltsverzeichnis}
  \oldtableofcontents%
}
\makeatother 

\tableofcontents

Definitely not the correct way to go, but solved my problem.