
\lhead{page \thepage\ of \pageref{LastPage}}
\chead{页眉中间\\换行(两行中文)}
\rhead{\small\leftmark}
%===============
%双线页眉的设置
\makeatletter %双线页眉
\def\headrule{{\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi%
\hrule\@height 1.0pt \@width\headwidth\vskip1pt%上面线为1pt粗
\hrule\@height 0.5pt\@width\headwidth %下面0.5pt粗
\vskip-2\headrulewidth\vskip-1pt} %两条线的距离1pt
\vspace{6mm}} %双线与下面正文之间的垂直间距
\makeatother
%===============
这样是不可以的,最好不要修改 plain 的风格。
你有使用 ctexbook 为文档类吗?在 ctexbook 中有相关的设置,具体来说:
1. 文档类为 ctexbook :
\documentclass{ctexbook}2. 在导言区设置:
\ctexset {chapter = {pagestyle = fancy}}推荐使用 ctexbook 的方式实现,它自带很多汉化,非常方便,但是如果你不想改文档类的话,也可以使用下面的方式,在导言区加入:
\makeatletter\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
\thispagestyle{fancy}% original style: plain
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
\makeatother
还有第三种方法,把 plain 设置为 fancy (不一定生效,我没验证)
\makeatletter\let\ps@plain\ps@fancy
\makeatother
如果上面的方法无效,还有一个变种,前提是你不需要 empty 风格
\makeatletter\let\ps@plain\ps@empty
\makeatother
\fancypagestyle{plain}{%
\fancyhf{} %
\fancyhead[LO,RE]{...} %
\fancyhead[RO,LE]{...} %
\fancyfoot[C]{...} %
\renewcommand{\headrulewidth}{0.4pt} %
\renewcommand{\footrulewidth}{0.4pt} %
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)