参考我之前的问题:目录样式变更
如何实现这个才能得到我在标题中提到的效果。例如。第 1 章,第 2 章等等,甚至在目录和章节开头。任何帮助都非常感谢。
答案1
重新定义\chaptername
为\MakeUppercase{\chapoldname}
并将更改写入 ToC 本身。
\documentclass[11pt]{report}
\usepackage{amsmath, mathrsfs}
\usepackage{amssymb}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{tocloft}
\usepackage[nottoc,notlot]{tocbibind}
\let\chapnameold\chaptername
\addtolength{\cftchapnumwidth}{65pt}
\renewcommand{\cftchappresnum}{\textbf{\chaptername}~}
\makeatletter
\AtBeginDocument{%
\renewcommand{\bibname}{References}
\addtocontents{toc}{\protect\renewcommand{\protect\chaptername}{\MakeUppercase{\protect\chapnameold}}}
\renewcommand{\chaptername}{\MakeUppercase{\chapnameold}}
}
\makeatother
%\linespread{1.4}
\pagestyle{myheadings}
\title{This is the title}
\author{Author A and Author B}
\date{}
\begin{document}
\maketitle
\cite{Lam94}
\tableofcontents
\chapter{Foo}
\section{This is section 1}
\subsection{This is a subsection}
\section{This is section 2}
\subsection{This is a subsection}
\chapter{Foobar}
\clearpage
\bibliographystyle{abbrv}
\bibliography{biblio}
\end{document}