fancyhdr页眉页脚设计史上最全代码

转载自:http://blog.sina.com.cn/s/blog_5e16f1770100g46l.html

代码如下:

\documentclass{article}
\usepackage{CJK}
\setcounter{page}{6}
\setlength\textheight{100.0pt} 
\setlength\textwidth{200.0pt}                                  
\usepackage{fancyhdr}                                
\usepackage{lastpage}                                           
\usepackage{layout}                                             
%\pagestyle{empty}                   %不设置页眉页脚            
\footskip = 10pt                                                
\pagestyle{fancy}                    % 设置页眉                 
\begin{CJK}{GBK}{kai}\end{CJK}                                  
\lhead{page \thepage\ of \pageref{LastPage}}                    
\chead{页眉中间}                                                
\rhead{\small\leftmark}                                                
\cfoot{\thepage}                                                
\rfoot{页脚左}%                                                       
\lfoot{页脚右}                                                        
\renewcommand{\headrulewidth}{1pt}  %页眉线宽,设为0可以去页眉线
\setlength{\skip\footins}{0.5cm}    %脚注与正文的距离           
\renewcommand{\footnotesize}{}      %设置脚注字体大小           
\renewcommand{\footrulewidth}{1pt}  %脚注线的宽度               
%===============                                                
%双线页眉的设置                                                 
%\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                                                   
%===============                                                
%\pagestyle{fancy}                                              
%\fancyhead{} %clear all fields                                 
%\fancyhead[CE]{ \应\用 \数 \学 }                               
%\fancyhead[CO]{{ huangzh: 数学}}                               
%\fancyhead[RO]{\thepage} %奇数页眉的右边                       
%\fancyhead[LE]{\thepage} %偶数页眉的左边                       
%\fancyhead[RE]{\zihao{-5} 2005 c}                              
%\fancyfoot[C]{}                                                
%================================================================%
\setcounter{tocdepth}{3}
\begin{CJK*}{GBK}{song}
\begin{document}
\section{The first}
\section{第二部分}
\paragraph{}
\newpage
\end{CJK*}
\end{document}
实现效果如下图




  • 10
    点赞
  • 41
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值