我正在使用文档类自定义页眉和页脚scrbook
。现在一切正常除了\pagemark
没有按预期格式化(即灰色,字母间距等)之外。我想将 格式化\pagemark
为与标题相同的格式。此外,所有\pagemark
s 都应出现在所有页面上(包括每章的第一页,因为它已经出现了)
梅威瑟:
\documentclass[twoside]{scrbook}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage[letterspace=200]{microtype}
\usepackage{scrlayer-scrpage}
\clearpairofpagestyles
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\lehead{\color{gray} \sffamily \textls{\MakeUppercase\leftmark}}
\rohead{\color{gray} \sffamily \textls{\MakeUppercase\leftmark}}
\lefoot[\pagemark]{\color{gray} \sffamily \textls{\pagemark}} % <--- The formatting doesn't take effects.....
\rofoot[\pagemark]{\color{gray} \sffamily \textls{\pagemark}} % <--- The formatting doesn't take effects.....
\begin{document}
\frontmatter
\listoffigures
\listoftables
\mainmatter
\chapter{Introduction}
\lipsum[1-50]
\chapter{Methodology}
\lipsum[1-50]
\end{document}
答案1
这里建议使用\addtokomafont
和\setkomafont
来设置页眉和页脚的字体。
\documentclass[twoside]{scrbook}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage[letterspace=200]{microtype}
\usepackage[markcase=upper]{scrlayer-scrpage}%
\clearpairofpagestyles
\ohead{\leftmark}
\ofoot{\pagemark}% or maybe \ofoot*{\pagemark} for page numbers on chapter pages
\renewcommand{\chaptermarkformat}{}% no chapter number in page header
\addtokomafont{pageheadfoot}{\color{gray}\sffamily\textls}% font settings for page header and footer
\setkomafont{pagenumber}{}% no special font for page numbers
\begin{document}
\frontmatter
\listoffigures
\listoftables
\mainmatter
\chapter{Introduction}
\lipsum[1-50]
\chapter{Methodology}
\lipsum[1-50]
\end{document}