我从标准书籍类派生了一个类。我想重新定义页眉和页脚。但如果我使用以下代码
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{} % clear all header and footer fields
\fancyhead[L]{\PageWaveHeader}
\fancyfoot[L]{\PageBox\PageWaveFoot}
我没有看到任何变化。页眉和页脚都是空的。
奇怪的是,如果我重新定义普通风格
\pagestyle{plain}
\fancypagestyle{plain}{%
\renewcommand{\headrulewidth}{0pt}
\fancyhf{} % clear all header and footer fields
\fancyhead[L]{\PageWaveHeader}
\fancyfoot[L]{\PageBox\PageWaveFoot}
}
章节开头的页面看起来不错(如上所述)。
有人看到第一个代码有什么问题吗?
编辑:添加 MWE(不是那么小)
\documentclass{book}
\usepackage{lipsum}
% page size
\RequirePackage{geometry}
% hegight 265mm width 202 % it looks like letter size
\geometry{%
paper=letterpaper,
includefoot,
outer=16mm, % TODO CHECK
inner=16mm,
bottom=2.4pc,
top=17mm,
head=14.5pt,
headsep=0mm
}
\RequirePackage{tikz}
\usepackage{tikzpagenodes}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{snakes}
\usetikzlibrary{calc}
\usetikzlibrary{backgrounds}
\usepgflibrary{shadings}
%\usetikzlibrary{decorations.pathmorphing}
%\usetikzlibrary{shapes.geometric}
\usepackage{xcolor}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
\definecolor{fillblue}{cmyk}{0.16,0.03,0,0.03}
\definecolor{chaptercolor}{cmyk}{0,0.76,0.49,0.07}
\definecolor{partcolor}{cmyk}{0,1,0,0}
%% FOOTER
\usepackage{fancyhdr}
\newcommand\PageBox{%
\tikz[baseline,trim left=0mm,trim right=0mm,remember picture, overlay] {
\begin{pgfonlayer}{background}
\node [
fill=fillblue,
text = black,
anchor= base east,
minimum width=10mm,
minimum height=7mm] (a) at (0mm,0) {\sffamily\thepage};
\end{pgfonlayer}
}%
}%
%
\newcommand\PageWaveFoot{%
\tikz[remember picture,overlay] {
\coordinate (low west) at ($(current page.south west) +(0, 0.5cm)$);
\coordinate (low east) at ($(current page.south west)+(\paperwidth, 0.5cm)$);
\fill[
partcolor,
] decorate[snake, segment length=\paperwidth/2]{ (low west) -- (low east)} -- (current page.south east) -- (current page.south west) -- (low west);
}%
}%
\newcommand\PageWaveHeader{%
\tikz[remember picture, overlay] {
\begin{pgfonlayer}{foreground}
\coordinate (up west) at ($(current page.north west) +(0, -0.5cm)$);
\coordinate (up east) at ($(current page.north west)+(\paperwidth, -0.5cm)$);
\fill[
partcolor,
] decorate[snake, segment length=\paperwidth/2]{ (up west) -- (up east)} -- (current page.north east) -- (current page.north west) -- (up west);
\end{pgfonlayer}
}%
}%
\pagestyle{headings}
\fancypagestyle{plain}{%
\renewcommand{\headrulewidth}{0pt}
\fancyhf{} % clear all header and footer fields
\fancyhead[L]{\PageWaveHeader}
\fancyfoot[L]{\PageBox\PageWaveFoot}
}
\begin{document}
\chapter{A test}
\lipsum[1-10]
\end{document}