![目录中的章节样式独立于页码样式](https://linux22.com/image/322871/%E7%9B%AE%E5%BD%95%E4%B8%AD%E7%9A%84%E7%AB%A0%E8%8A%82%E6%A0%B7%E5%BC%8F%E7%8B%AC%E7%AB%8B%E4%BA%8E%E9%A1%B5%E7%A0%81%E6%A0%B7%E5%BC%8F.png)
我将目录中的章节条目样式chapterentry
(在 koma-script 类文档中 - 不能从 koma-script 更改)更改为小写。不幸的是,这也影响了章节的页码,即页码也是小写。有没有办法防止页码更改为小写,而只保留正常的罗马字体?
\documentclass[
fontsize=12pt,
open=right,
twoside = true,
paper=a4,
listof=totoc,
numbers=noenddot,
headings=big,
chapterprefix=false] %
{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{blindtext}
\setkomafont{sectioning}{\rmfamily}
\setkomafont{chapterentry}{\mdseries\scshape\lowercase}
\addtokomafont{chapter}{\normalsize\scshape}
\addtokomafont{section}{\normalsize\scshape}
\addtokomafont{subsection}{\normalsize\itshape}
\begin{document}
\pagenumbering{roman}
\tableofcontents
\listoffigures
\listoftables
\newpage
\pagenumbering{arabic}
\Blinddocument
\end{document}
答案1
使用
\setkomafont{chapterentrypagenumber}{\normalfont\normalcolor}
使用正常字体作为目录中章节页码的字体。
代码:
\documentclass[
fontsize=12pt,
open=right,
twoside = true,
paper=a4,
listof=totoc,
numbers=noenddot,
headings=big,
chapterprefix=false] %
{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{blindtext}
\setkomafont{sectioning}{\rmfamily}
\setkomafont{chapterentry}{\mdseries\scshape\lowercase}
\setkomafont{chapterentrypagenumber}{\normalfont\normalcolor}%<- added
\addtokomafont{chapter}{\normalsize\scshape}
\addtokomafont{section}{\normalsize\scshape}
\addtokomafont{subsection}{\normalsize\itshape}
\begin{document}
\pagenumbering{roman}
\tableofcontents
\listoffigures
\listoftables
\newpage
\pagenumbering{arabic}
\Blinddocument
\end{document}
答案2
获得你想要的东西的最简单方法是添加行
\addtokomafont{pagenumber}{\rmfamily\normalsize}
在您的序言中。然后页面上的页码和目录中的页码将采用给定的字体\rmfamily
大小\normalsize
。
完整代码:
\documentclass[
fontsize=12pt,
open=right,
twoside = true,
paper=a4,
listof=totoc,
numbers=noenddot,
headings=big,
chapterprefix=false] %
{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{blindtext}
\setkomafont{sectioning}{\rmfamily}
\setkomafont{chapterentry}{\mdseries\scshape\lowercase}
\addtokomafont{chapter}{\normalsize\scshape}
\addtokomafont{section}{\normalsize\scshape}
\addtokomafont{subsection}{\normalsize\itshape}
\addtokomafont{pagenumber}{\rmfamily\normalsize} % <====================
\begin{document}
\pagenumbering{roman}
\tableofcontents
\listoffigures
\listoftables
\newpage
\pagenumbering{arabic}
\Blinddocument
\end{document}
得到的目录如下: