重命名目录无效!

重命名目录无效!

浏览该网站时,我只得到这种方法,以便用标题上的“内容表”替换丑陋的“内容”:

\renewcommand\contentsname{Table of Contents}

是否有包裹丢失?

\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}

答案1

在文档开头重新定义了,因此之前\contentsname还为时过早。要么将其推送到之后,要么使用(如代码中所做的那样)babel\renewcommand\contentsname\begin{document}\begin{document}\AtBeginDocument{...}

另一种方法:使用\addto\captionsbritish(因为british这里是语言设置!)

\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- 版本:

\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}

在此处输入图片描述

相关内容