0

I am trying to change the default section title for the TOC, renewing tocloft's \contentsname macro:

\documentclass{article}

\usepackage[american]{babel} % (*) THE STARRED LINE

\usepackage{tocloft}

\renewcommand*{\contentsname}{FooContents}

\begin{document}
  \tableofcontents

  \section{The first section}
  \section{The second section}
\end{document}

If I remove the starred line, the TOC appears as expected, titled "FooContents" -- otherwise, the default title "Contents" is used.

Is there a way to get this done without getting rid of babel?

EDIT

Per @egreg's comment below, this particular issue can be solved with \addto\captionsamerican{\renewcommand*{\contentsname{FooContents}}}.

With regard to \addto, the babel documentation (p. 64) states that:

For each language four control sequences have to be defined that control the language-specific definitions. To be able to add something to these macro once they have been defined the macro \addto is introduced.

However, I cannot find a list of those "four control sequences". I am using tocloft quite heavily, and most of what I do with it is reversed by babel.

  • 1
    \addto\captionsamerican{\renewcommand{\contentsname}{FooContents}} – egreg Mar 21 at 18:31
  • But of course :-) However, I do not fully understand which macros I would need to renew like that. For instance, I am also changing the TOC title font (renewing cfttoctitlefont), but the above does not seem to work for that case. – dow Mar 21 at 18:56
  • In particular, babel's documentation states about \addto: "For each language four control sequences have to be defined that control the language-specific definitions. To be able to add something to these macro once they have been defined the macro \addto is introduced." I've been browsing around the document to find these "four control sequences", but I cannot find a list. – dow Mar 21 at 19:07
  • Babel does not touch fonts, only names like \contentsname and friends – daleif Mar 21 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.