2

I looked at How to change the title of ToC? but the answer seems not to work for me. I use KOMA scrbook. What is wrong in my MWE? It does not produce an error but seems not have an effect. The title is still "Inhaltsverzeichnis".

\documentclass{scrbook}
\KOMAoptions{paper=      
%   6.14in:9.21in,   % 6.139in:9.209in,   %format for KPD
    128.5mm:198.4mm, %(5,06" x 7,91")  %ziel
    BCOR=8mm,twoside,
    headinclude=false, footinclude=false, 
    headings=normal,
    titlepage=true,
    %   draft=true, 
    DIV=9,  %ziel kleines buch 
    fontsize=12pt,
    %   showframe=true, showcrop=true % does not workw scrbook
}


%%%% Sprache
\usepackage[german]{babel}   

%change title for german toc
\addto\captionsngerman{% Replace "english" with the language you use
    \renewcommand{\contentsname}%
    {Inhalt}%
}


\begin{document}
    \frontmatter
        \tableofcontents

    \mainmatter

\part{ Philosophie}
some text 

\end{document} 
user855443
  • 1,120
  • 1
    You have to decide, if you your language is ngerman (new german - use option ngerman for babel) or german (outdated german- use \addto\captionsgerman). – esdd Apr 22 '20 at 07:56

2 Answers2

3

The correct answer is to find in KOMA script documentation in Section 12.4. “Defining Language-Dependent Terms”.

Changing the title of the ToC is done via the following command in the preamble:

\renewcaptionname{german}{\contentsname}{<the new name>}

As in

\documentclass{scrbook}

\usepackage[german]{babel}

%change title for german toc
\renewcaptionname{german}{\contentsname}{Foobar}

\begin{document}
    \tableofcontents

    \part{Philosophie}
        some text
\end{document}

[Initial answer]

This is a quick fix, but moving \renewcommand{\contentsname} within the documents body (rather than in the preamble) works.

\documentclass{scrbook}

\usepackage[german]{babel}

\begin{document}
    %change title for german toc
    \renewcommand{\contentsname}{Baz}

    \tableofcontents

    \part{Philosophie}
        some text 
\end{document}
ebosi
  • 11,692
1

You load package babel with option german, but then you use \captionsngerman - note the »n« between »caption« and »german«.

As I have already suggested to you, use option ngerman for package babel:

\usepackage[ngerman]{babel}% ngerman!

Then \addto\captionsngerman{\renewcommand{\contentsname}{Inhalt}} would work.

But with a KOMA-Script class you should use:

\renewcaptionname{\contentsname}{ngerman}{Inhalt}

Example:

\documentclass{scrbook}
\KOMAoptions{paper=      
%   6.14in:9.21in,   % 6.139in:9.209in,   %format for KPD
    128.5mm:198.4mm, %(5,06" x 7,91")  %ziel
    BCOR=8mm,twoside,
    headinclude=false, footinclude=false, 
    headings=normal,
    titlepage=true,
    DIV=9,  %ziel kleines buch 
    fontsize=12pt,
}


%%%% Sprache
\usepackage[ngerman]{babel}% ngerman!
\renewcaptionname{\contentsname}{ngerman}{Inhalt}

\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\part{ Philosophie}
some text 
\end{document}

enter image description here

esdd
  • 85,675
  • thank you for the perfect solution and I am sorry for the continued confusion between german and ngerman. I am old and use mostly in the current text old swiss spelling, so perhaps german fits better for the hyphenation? – user855443 Apr 22 '20 at 10:53