ToC
如何使用@Bordaigorl 提供的解决方案更改标题这里?我想要小写字母,就像我示例中的摘要、章节和附录一样。LoF
和 也存在同样的问题LoT
。 抱歉代码太乱了!
\documentclass[twoside]{book}
\usepackage{fancyhdr}
\usepackage[titles]{tocloft}
\usepackage{lipsum} % just for the example
\makeatletter
\fancyhead{}
\fancyfoot{}
\fancyhead[RO]{\textsc{\rightmark}}
\fancyhead[LE]{\textsc{\leftmark}}
\fancyfoot[LE]{\thepage}
\fancyfoot[RO]{\thepage}
\fancypagestyle{plain}{%
\fancyhf{}
\fancyfoot[LE]{\thepage}
\fancyfoot[RO]{\thepage}
}
\pagestyle{fancy}
\g@addto@macro{\frontmatter}{%
\renewcommand*{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand*{\sectionmark}[1]{\markright{#1}{}}
}
\g@addto@macro{\mainmatter}{%
\renewcommand*{\chaptermark}[1]{\markboth{Chapter\space\thechapter:\space#1}{}}
\renewcommand*{\sectionmark}[1]{\markright{\thesection:\space#1}{}}
}
\g@addto@macro{\appendix}{%
\renewcommand*{\chaptermark}[1]{\markboth{Appendix\space\thechapter:\space#1}{}}
\renewcommand*{\sectionmark}[1]{\markright{\thesection:\space#1}{}}
\addtocontents{loa}{\protect\renewcommand{\protect\cftchappresnum}{\appendixname\space}}
}
\g@addto@macro{\backmatter}{%
\renewcommand*{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand*{\sectionmark}[1]{\markright{#1}{}}
}
\makeatother
\begin{document}
\frontmatter
\tableofcontents
\cleardoublepage
\listoffigures
\cleardoublepage
\listoftables
\cleardoublepage
\chapter{Abstract}
\section{Abs1}
\lipsum
\section{Abs2}
\lipsum
\cleardoublepage
\mainmatter
\chapter{A}
\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{Section A}
\lipsum
\cleardoublepage
\chapter{B}
\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{Section B}
\lipsum
\cleardoublepage
\appendix
\chapter{Appendies}
\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{Section App}
\lipsum
\cleardoublepage
\backmatter
\chapter{Bibliography}
\section{Section Bib}
\lipsum
\end{document}
答案1
\tableofcontents
、\listoffigures
和的定义\listoftables
都有\chapter*{...\@mkboth{\MakeUppercase}{....}
etc,也就是说相关的contentsname都设置了大写,跟\scshape
etc在一起看起来很别扭。
\xpatchcmd
一个可能的解决方案是使用和使用\@mkboth{\scshape \contentsname}{...}
等来替换这些定义。
更新——现在也可以tocloft
使用:
\documentclass[twoside]{book}
\usepackage[T1]{fontenc}
\usepackage{tocloft}
\usepackage{fancyhdr}
\usepackage{xpatch}
\usepackage{lipsum} % just for the example
\usepackage{fancyhdr}
\makeatletter
\fancyhead{}
\fancyfoot{}
\fancyhead[RO]{\textsc{\rightmark}}
\fancyhead[LE]{\textsc{\leftmark}}
\fancyfoot[LE]{\thepage}
\fancyfoot[RO]{\thepage}
\fancypagestyle{plain}{%
\fancyhf{}
\fancyfoot[LE]{\thepage}
\fancyfoot[RO]{\thepage}
}
\pagestyle{fancy}
\@ifpackageloaded{tocloft}{%
\renewcommand{\cftmarktoc}{\@mkboth{\scshape \contentsname}{\scshape \contentsname}}
\renewcommand{\cftmarklof}{\@mkboth{\scshape \listfigurename}{\scshape \listfigurename}}
\renewcommand{\cftmarklot}{\@mkboth{\scshape \listtablename}{\scshape \listtablename}}
}{%
\xpatchcmd{\tableofcontents}{%
\chapter*{\contentsname
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
}{%
\chapter*{\contentsname\@mkboth{\scshape \contentsname}{\scshape \contentsname}}%
}{}{}%
\xpatchcmd{\listoffigures}{%
\chapter*{\listfigurename}%
\@mkboth{\MakeUppercase\listfigurename}%
{\MakeUppercase\listfigurename}%
}{%
\chapter*{\listfigurename\@mkboth{\scshape \listfigurename}{\scshape \listfigurename}}%
}{}{}
\xpatchcmd{\listoftables}{%
\chapter*{\listtablename}%
\@mkboth{\MakeUppercase\listtablename}%
{\MakeUppercase\listtablename}%
}{%
\chapter*{\listtablename\@mkboth{\scshape \listtablename}{\scshape \listtablename}}%
}{}{}
}
\g@addto@macro{\frontmatter}{%
\renewcommand*{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand*{\sectionmark}[1]{\markright{#1}{}}
}
\g@addto@macro{\mainmatter}{%
\renewcommand*{\chaptermark}[1]{\markboth{Chapter \thechapter{}:\space#1}{}}
\renewcommand*{\sectionmark}[1]{\markright{\thesection{}:\space#1}{}}
}
\g@addto@macro{\appendix}{%
\renewcommand*{\chaptermark}[1]{\markboth{\textsc{Appendix \thechapter{}:}\space#1}{}}
\renewcommand*{\sectionmark}[1]{\markright{\thesection{}:\space#1}{}}
\addtocontents{loa}{\protect\renewcommand{\protect\cftchappresnum}{\appendixname\space}}
}
\g@addto@macro{\backmatter}{%
\renewcommand*{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand*{\sectionmark}[1]{\markright{#1}{}}
}
\makeatother
\begin{document}
\frontmatter
\tableofcontents
\cleardoublepage
\listoffigures
\cleardoublepage
\listoftables
\chapter{Abstract}
\section{Abs1}
\lipsum
\section{Abs2}
\lipsum
\cleardoublepage
\mainmatter
\chapter{A}
\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{A}\section{Section A}
\lipsum
\cleardoublepage
\chapter{B}
\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{B}\section{Section B}
\lipsum
\cleardoublepage
\appendix
\chapter{Appendies}
\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{app}\section{Section App}
\lipsum
\cleardoublepage
\backmatter
\chapter{Bibliography}
\section{Section Bib}
\lipsum
\end{document}