2

Exploring the site, I get only this method in order to replace the ugly "Content" by "Table of content" on the title:

\renewcommand\contentsname{Table of Contents}

Is there a package missing?

\documentclass[a4paper,12pt]{report}
\usepackage[a4paper]{geometry}
\geometry{hscale=0.75,vscale=0.8,centering}
 %\geometry{legalpaper, landscape, margin=2in}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
 %\usepackage[french]{babel}
\usepackage[british]{babel}
\usepackage{listings}
\usepackage{amssymb}
\usepackage{multirow}
\usepackage{setspace}
\usepackage{pdfpages}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{color}
\usepackage{fancyhdr}
\usepackage{booktabs}
\usepackage{hyperref}
\usepackage{subfigure}
\usepackage{array}
\usepackage{url}
\usepackage{here}
\usepackage{mdwlist}
\usepackage{textcomp,gensymb}
\usepackage{pgfgantt}
\usepackage{pgf,tikz}
\usepackage{parskip}
\hypersetup{pdfborder = {0 0 0}}
\renewcommand\contentsname{Table of Contents}
\begin{document}
\tableofcontents
\end{document}
  • \documentclass{report} \renewcommand\contentsname{Table of Contents} \begin{document} \tableofcontents \chapter{One} \end{document} appears to work ok here. Can you reproduce that if you comment out the other packages? – Mike Renfro Jul 25 '16 at 15:48
  • @MikeRenfro: The babel package is the 'culprit' here -- it takes control of \contentsname in a \AtBeginDocument hook -- so using a \renewcommand just before \begin{document} does not work. It must be the 'last' thing in a \AtBeginDocument hook list, at least it must be put after `babel' takes action – user31729 Jul 25 '16 at 15:54
  • The subfigure package is completely outdated, and hyperref should be loaded as the last package (in most cases!). 99 % of the packages loaded here are not relevant for the actual problem, however! – user31729 Jul 25 '16 at 15:55
3

The \contentsname is redefined by babel at the begin of the document, so \renewcommand\contentsname before \begin{document} is too early. Either push this after \begin{document} or use \AtBeginDocument{...} (as has been done here in the code)

Another way: Use\addto\captionsbritish (since british is the language setting here!)

\documentclass[a4paper,12pt]{report}
\usepackage[a4paper]{geometry}
\geometry{hscale=0.75,vscale=0.8,centering}
 %\geometry{legalpaper, landscape, margin=2in}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
 %\usepackage[french]{babel}
\usepackage[british]{babel}
\usepackage{listings}
\usepackage{amssymb}
\usepackage{multirow}
\usepackage{setspace}
\usepackage{pdfpages}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{color}
\usepackage{fancyhdr}
\usepackage{booktabs}
%\usepackage{subfigure}
\usepackage{array}
\usepackage{url}
\usepackage{here}
\usepackage{mdwlist}
\usepackage{textcomp,gensymb}
\usepackage{pgfgantt}
\usepackage{pgf,tikz}
\usepackage{parskip}
\usepackage{hyperref}

\hypersetup{pdfborder = {0 0 0}}
\AtBeginDocument{%
  \renewcommand\contentsname{Table of Contents}
}
\begin{document}
\tableofcontents
\end{document}

\addto\captionsbritish -- version:

\documentclass[a4paper,12pt]{report}
\usepackage[a4paper]{geometry}
\geometry{hscale=0.75,vscale=0.8,centering}
 %\geometry{legalpaper, landscape, margin=2in}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french,british]{babel}
%\usepackage[british]{babel}
\usepackage{listings}
\usepackage{amssymb}
\usepackage{multirow}
\usepackage{setspace}
\usepackage{pdfpages}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{color}
\usepackage{fancyhdr}
\usepackage{booktabs}
%\usepackage{subfigure}
\usepackage{array}
\usepackage{url}
\usepackage{here}
\usepackage{mdwlist}
\usepackage{textcomp,gensymb}
\usepackage{pgfgantt}
\usepackage{pgf,tikz}
\usepackage{parskip}
\usepackage{hyperref}

\hypersetup{pdfborder = {0 0 0}}
\addto\captionsbritish{\renewcommand\contentsname{Table of Contents}}
\begin{document}
\tableofcontents
\end{document}

enter image description here

  • That work! I also tried with the "\addto", but that was no effect. thank you! – Batfly Jul 25 '16 at 15:58
  • @Batfly: Did you try \addto\captionsenglish by chance? That won't work. – user31729 Jul 25 '16 at 15:59
  • Yes, I tried, but also at the wrong place... Both works on my document. – Batfly Jul 25 '16 at 16:50

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.