接下来,除了最后一页之外,目录标题都是错误的,我找不到解决方案。我一直试图修改\tableofcontents
以及\toc@heading
命令,但没有成功。
\documentclass[12pt]{book}
\usepackage[left=3.8cm,right=3.8cm,top=10cm,bottom=10cm,letterpaper]{geometry}
\usepackage{kpfonts}
\DeclareRobustCommand{\capsspacing}[1]{\textsc{\MakeLowercase{#1}}}
\usepackage[linktocpage=true]{hyperref}
\begin{document}
\tableofcontents
\markboth{\capsspacing{\contentsname}}{\capsspacing{\contentsname}}
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\end{document}
所有目录页的目录标题都应该是小写字母。
答案1
为了获得所需的结果,您可以\tableofcontents
按照以下方式重新定义以book.cls
更改标记:
\documentclass[12pt]{book}
\usepackage[left=3.8cm,right=3.8cm,paperheight=10cm,top=2cm,bottom=2cm]{geometry}
\usepackage{kpfonts}
\DeclareRobustCommand{\capsspacing}[1]{\textsc{\MakeLowercase{#1}}}
\DeclareRobustCommand{\capsspacingb}{\scshape\MakeLowercase}
\usepackage[linktocpage=true]{hyperref}
\usepackage[titles]{tocloft}
% chapters
\renewcommand{\cftchappresnum}{\normalfont}%
\renewcommand{\cftchapfont}{\capsspacingb}%
\renewcommand{\cftchappagefont}{\normalfont}%
\makeatletter
\renewcommand\tableofcontents{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\contentsname
\@mkboth{%
\scshape\MakeLowercase{\contentsname}}{\scshape\MakeLowercase{\contentsname}}}%
\@starttoc{toc}%
\if@restonecol\twocolumn\fi
}
\makeatother
\begin{document}
\tableofcontents
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\end{document}
使用etoolbox
包来修补\tableofcontents
,代码简化:
\documentclass[12pt]{book}
\usepackage[left=3.8cm,right=3.8cm,paperheight=10cm,top=2cm,bottom=2cm]{geometry}
\usepackage{kpfonts}
\usepackage{etoolbox}
\patchcmd{\tableofcontents}{\MakeUppercase\contentsname}{\scshape\MakeLowercase{\contentsname}}{}{}
\patchcmd{\tableofcontents}{\MakeUppercase\contentsname}{\scshape\MakeLowercase{\contentsname}}{}{}
\DeclareRobustCommand{\capsspacing}[1]{\textsc{\MakeLowercase{#1}}}
\DeclareRobustCommand{\capsspacingb}{\scshape\MakeLowercase}
\usepackage[linktocpage=true]{hyperref}
\usepackage[titles]{tocloft}
% chapters
\renewcommand{\cftchappresnum}{\normalfont}%
\renewcommand{\cftchapfont}{\capsspacingb}%
\renewcommand{\cftchappagefont}{\normalfont}%
\begin{document}
\tableofcontents
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\chapter{title}\section{title}\section{title}\section{title}\section{title}\section{title}\section{title}
\end{document}