有没有办法在memoir
课堂上设置页眉和页脚规则的颜色?
使用以下代码:
\documentclass[ebook,12pt,twoside,openany]{memoir}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage[english,italian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[dvipsnames]{xcolor} % Allows the definition of hex colors
\newenvironment{dedication}
{
\cleardoublepage
\thispagestyle{empty}
\vspace*{ \stretch{1}}
\hfill \begin{minipage}[t]{0.66 \textwidth}
\raggedright
}%
{
\end{minipage}
\vspace*{ \stretch{3}}
\clearpage
}
\setlength{ \topmargin}{-0.5in}
\setlength{ \textheight}{520pt}
\makepagestyle{myruled}
\makeheadrule {myruled}{ \textwidth}{ \normalrulethickness}
\makefootrule {myruled}{ \textwidth}{ \normalrulethickness}{ \footruleskip}
\makeevenhead {myruled}{}{ \small \itshape \leftmark} {}
\makeoddhead {myruled}{}{ \small \itshape \rightmark}{}
\makeevenfoot {myruled}{ \small \thepage}{}{}
\makeoddfoot {myruled}{}{} { \small \thepage}
\makeatletter % because of \@chapapp
\makepsmarks {myruled}{
\nouppercaseheads
\createmark {chapter} {both} {nonumber}{ \@chapapp \ }{. \ }
\createmark {section} {right}{shownumber}{} {. \ }
\createmark {subsection} {right}{shownumber}{} {. \ }
\createmark {subsubsection}{right}{shownumber}{} {. \ }
\createplainmark {toc} {both} { \contentsname}
\createplainmark {lof} {both} { \listfigurename}
\createplainmark {lot} {both} { \listtablename}
\createplainmark {bib} {both} { \bibname}
\createplainmark {index} {both} { \indexname}
\createplainmark {glossary} {both} { \glossaryname}
}
\makeatother
\setsecnumdepth{subsubsection}
\begin{document}
\begin{dedication}
Put dedication here
\end{dedication}
\chapterstyle{thatcher}
\pagestyle{myruled}
\chapter{Lipsum chapter}
\lipsum[1-8]
\end{document}
加载包后,xcolor
我尝试使用命令,但虽然它适用于文本,但\color{colorname}
放在之前或之后时却不起作用。\makeheadrule
\makefootrule
答案1
您可以使用
\makeheadfootruleprefix{<style>}{<for headrule>}{<for footrule>}
一个例子:
\documentclass[ebook,12pt,twoside,openany]{memoir}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage[english,italian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[dvipsnames]{xcolor} % Allows the definition of hex colors
\newenvironment{dedication}
{
\cleardoublepage
\thispagestyle{empty}
\vspace*{\stretch{1}}
\hfill\begin{minipage}[t]{0.66\textwidth}
\raggedright
}%
{
\end{minipage}
\vspace*{\stretch{3}}
\clearpage
}
\setlength{\topmargin}{-0.5in}
\setlength{\textheight}{520pt}
\makepagestyle{myruled}
\makeheadfootruleprefix{myruled}{\color{Bittersweet}}{\color{PineGreen}}
\makeheadrule{myruled}{\textwidth}{\normalrulethickness}
\makefootrule{myruled}{\textwidth}{\normalrulethickness}{\footruleskip}
\makeevenhead{myruled}{}{\small\itshape\leftmark}{}
\makeoddhead{myruled}{}{\small\itshape\rightmark}{}
\makeevenfoot{myruled}{\normalcolor\small\thepage}{}{}
\makeoddfoot{myruled}{}{}{\normalcolor\small\thepage}
\makeatletter % because of \@chapapp
\makepsmarks{myruled}{
\nouppercaseheads
\createmark{chapter}{both}{nonumber}{\@chapapp\ }{. \ }
\createmark{section}{right}{shownumber}{}{. \ }
\createmark{subsection}{right}{shownumber}{}{. \ }
\createmark{subsubsection}{right}{shownumber}{}{. \ }
\createplainmark{toc}{both}{\contentsname}
\createplainmark{lof}{both}{\listfigurename}
\createplainmark{lot}{both}{\listtablename}
\createplainmark{bib}{both}{\bibname}
\createplainmark{index}{both}{\indexname}
\createplainmark{glossary}{both}{\glossaryname}
}
\makeatother
\setsecnumdepth{subsubsection}
\begin{document}
\begin{dedication}
Put dedication here
\end{dedication}
\chapterstyle{thatcher}
\pagestyle{myruled}
\chapter{Lipsum chapter}
\lipsum[1-8]
\end{document}
\normalcolor
注意内部的使用\makeevenfood
,\makeoddfoot
以防止页码也接收颜色(删除\normalcolor
您希望数字也被着色)。
获得的其中一页的图像: