如下图所示:
前言的罗马页码在目录中看起来太暗了,那么如何使其成为正常字体,但不改变章节的粗体阿拉伯数字?
答案1
您的全局设置可能略有不同,但以下设置有效:
\documentclass{book}
\makeatletter
\def\@pnum@font{\bfseries}% Default is \bfseries
\renewcommand*\l@chapter[2]{% Taken from book.cls
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss\@pnum@font #2}\par
\penalty\@highpenalty
\endgroup
\fi}
\g@addto@macro{\frontmatter}{\addtocontents{toc}{\protect\def\protect\@pnum@font{\normalfont}}}
\g@addto@macro{\mainmatter}{\addtocontents{toc}{\protect\def\protect\@pnum@font{\bfseries}}}
\makeatother
\begin{document}
\tableofcontents
\frontmatter
\chapter{Acknowledgements}
\chapter{Abstract}
\chapter{List of Figures}
\chapter{List of Tables}
\chapter{Nomenclature}
\mainmatter
\chapter{Introduction}
\section{Problem and motivation}
\section{Objectives}
\section{Research and methodology}
\subsection{Continuum}
%...
\end{document}
\chapter
负责设置目录中标题的宏是\l@chapter
。我从book.cls
并插入\@pnum@font
设置实际页码的位置。默认情况下,这已被定义为\bfseries
打印在大胆的。\normalfont
在 添加修改\frontmatter
并在 处撤销修改\mainmatter
(均使用\g@addto@macro
)将导致您想要的显示。
由于写入 ToC 必须小心进行(以避免扩展),因此使用\protect
是必要的。
答案2
就我的情况来说,这几乎是有效的。瞧。
[Texlive 2012 Ubuntu 中的 XeLatex]
首页第一页码为粗体,第 1 章码为正常。
我不知道为什么会发生这种情况,这里是 tex 代码:
\documentclass[a4paper,12pt]{book}
\include{Setting/settings} % <----- page layout, font, renewcommands etc.
\begin{document}
\include{Cover/cover} % cover page
\frontmatter % book mode only
\pagenumbering{Roman}
\include{Acknowledgement/acknowledgement}
\include{Abstract/abstract}
{\hypersetup{linkcolor=black}
\tableofcontents }
\listoffigures
\listoftables
\printnomenclature[1.6 cm]
\clearpage
\mainmatter % book mode only
\include{Introduction/introduction}
\include{Chapter2/chapter2}
\include{Chapter3/chapter3}
\include{Chapter4/chapter4}
\include{Conclusions/conclusions}
....
目录内容
\contentsline {chapter}{Acknowledgements}{i}{chapter*.1}
\def \@pnum@font {\normalfont }
\contentsline {chapter}{Abstract}{iii}{chapter*.2}
\contentsline {chapter}{List of Figures}{vii}{chapter*.4}
\contentsline {chapter}{List of Tables}{ix}{chapter*.5}
\contentsline {chapter}{Nomenclature}{xi}{chapter*.6}
\contentsline {chapter}{\numberline {1}Introduction}{1}{chapter.1}
\contentsline {section}{\numberline {1.1}Problem and motivation}{1}{section.1.1}
\contentsline {section}{\numberline {1.2}Objectives}{3}{section.1.2}
\contentsline {section}{\numberline {1.3}Research methodology}{4}{section.1.3}
\contentsline {subsection}{\numberline {1.3.1}Continuum}{4}{subsection.1.3.1}
\contentsline {subsection}{\numberline {1.3.2}Discontinuum}{4}{subsection.1.3.2}
\contentsline {section}{\numberline {1.4}Thesis outline}{6}{section.1.4}
\def \@pnum@font {\bfseries }
\contentsline {chapter}{References}{9}{chapter*.7}
\contentsline {chapter}{Appendix A}{11}{appendix*.8}
\contentsline {chapter}{Appendix B}{13}{appendix*.9}
\usepackage[nottoc]{tocbibind} 用于排除列表中的“目录”。仅包含第 1 章进行测试。
如果我将 \def \@pnum@font {\normalfont } 放在目录顶部,将 \def \@pnum@font {\bfseries } 放在目录命名法下方,然后重新编译,就可以了。但如果运行 Bibtex,顺序当然会再次被打乱。