![更改加载 scrlayer-scrpage 的页脚 classicthesis](https://linux22.com/image/348843/%E6%9B%B4%E6%94%B9%E5%8A%A0%E8%BD%BD%20scrlayer-scrpage%20%E7%9A%84%E9%A1%B5%E8%84%9A%20classicthesis.png)
我使用的是 classicthesis 样式,可加载 scrlayer-scrpage。我喜欢这种样式的大部分内容,但想更改一些内容。我以前在其他文档中做的一件事是在页脚中的页码旁边放置一个彩色框。我通常这样做:
\documentclass[a4paper,11pt,fleqn]{book}
\usepackage{color}
\usepackage{fontspec}
\setlength{\textwidth}{146.8mm} % = 210mm - 37mm - 26.2mm
\setlength{\oddsidemargin}{11.6mm} % 37mm - 1in (from hoffset)
\setlength{\evensidemargin}{0.8mm} % = 26.2mm - 1in (from hoffset)
\setlength{\topmargin}{-2.2mm} % = 0mm -1in + 23.2mm
\setlength{\textheight}{221.9mm} % = 297mm -29.5mm -31.6mm - 14mm (12 to accomodate footline with pagenumber)
\setlength{\headheight}{14pt}
\usepackage{fancyhdr}
\fancyhf{}
\renewcommand{\footrulewidth}{0pt}
\fancyfoot[EL]{\makebox[0pt][r]{\color{Black}\rule[0pt]{0.55\marginparwidth} {6pt}\makebox[0.16\marginparwidth][r]{\bfseries\sffamily\color{black}\fontspec[] {MetaBoldLF-Roman}\thepage}}}%
\fancyfoot[OR]{\makebox[0pt][l]{\makebox[0.16\marginparwidth][1]{\bfseries\sffamily\color{black}\fontspec[]{MetaBoldLF-Roman}\thepage}\color{Blac}\rule[0pt]{0.55\marginparwidth}{6pt}}}%
\fancypagestyle{plain}{
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyfoot[EL]{\makebox[0pt][r]{\color{black}\rule[0pt] {0.55\marginparwidth}{6pt}\makebox[0.16\marginparwidth][r] {\bfseries\sffamily\color{black}\fontspec[]{MetaBoldLF-Roman}\thepage}}}%
\fancyfoot[OR]{\makebox[0pt][l]{\makebox[0.16\marginparwidth][l] {\bfseries\sffamily\color{black}\fontspec[]{MetaBoldLF-Roman}\thepage}\color{black}\rule[0pt]{0.55\marginparwidth}{6pt}}}}%
\fancypagestyle{addpagenumbersforpdfimports}{
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot{}
\fancyfoot[EL]{\makebox[0pt][r]{\color{black}\rule[0pt] {0.55\marginparwidth}{6pt}\makebox[0.16\marginparwidth][r] {\bfseries\sffamily\color{black}\fontspec[]{MetaBoldLF-Roman}\thepage}}}%
\fancyfoot[OR]{\makebox[0pt][l]{\makebox[0.16\marginparwidth][l] {\bfseries\sffamily\color{black}\fontspec[]{MetaBoldLF-Roman}\thepage}\color{black}\rule[0pt]{0.55\marginparwidth}{6pt}}}}%
\begin{document}
\chapter{hello Word}
Hello world
\chapter{hello Word2}
Hello world 2
\end{document}
有人能帮我把这个翻译成 classicthesis 文件吗?还想让它出现在章节起始页上。
答案1
如果我理解了这个问题,您的示例目前并没有真正显示您想要的内容,因为它没有在偶数页或章节页的页脚中显示页码。所以我无法确定以下内容是否真的是您所期望的:
\documentclass[a4paper,11pt,fleqn]{book}
\usepackage{color}
\usepackage{fontspec}
\setlength{\textwidth}{146.8mm} % = 210mm - 37mm - 26.2mm
\setlength{\oddsidemargin}{11.6mm} % 37mm - 1in (from hoffset)
\setlength{\evensidemargin}{0.8mm} % = 26.2mm - 1in (from hoffset)
\setlength{\topmargin}{-2.2mm} % = 0mm -1in + 23.2mm
\setlength{\textheight}{221.9mm} % = 297mm -29.5mm -31.6mm - 14mm (12 to accomodate footline with pagenumber)
\setlength{\headheight}{14pt}
% Put \marginparwidth onto the page
\setlength{\marginparwidth}{\dimexpr\paperwidth-\oddsidemargin-1in-\textwidth-\marginparsep}
\usepackage[footwidth=textwithmarginpar]{scrlayer-scrpage}
\clearpairofpagestyles
\ihead{\headmark}
\rofoot*{%
\makebox[\dimexpr\marginparsep+\marginparwidth\relax]{%
\pagemark\hfill\rule{.55\marginparwidth}{6pt}%
}%
}
\lefoot*{%
\makebox[\dimexpr\marginparsep+\marginparwidth\relax]{%
\rule{.55\marginparwidth}{6pt}\hfill\pagemark
}%
}
\usepackage{mwe}
\begin{document}
\blinddocument
\end{document}
如果你想改变页脚的字体,只需使用类似
\setkomafont{pagefoot}{\bfseries}% You can also use \fontspec here.
如果要更改规则的颜色(例如红色),请使用
\textcolor{red}{\rule{.55\marginparwidth}{6pt}}
或者
\addtokomafont{pagefoot}{\color{red}}
\addtokomafont{pagenumber}{\normalcolor}