页眉/页脚标尺未显示在文本中

页眉/页脚标尺未显示在文本中

我正在撰写博士论文,但没有得到章节中的页眉页脚标尺。

序言如下:

\documentclass[12pt,twoside]{report}

%Packages used
\usepackage{amssymb,amsmath,amsfonts}
\usepackage{multirow}
\usepackage{natbib}
\usepackage[pdftex]{graphicx}
\usepackage{epsf}
\usepackage{a4}
\usepackage[hypertexnames=false,linktocpage=true]{hyperref}
\hypersetup{colorlinks=true,linkcolor=blue,anchorcolor=blue,citecolor=blue,filecolor=blue,urlcolor=blue,bookmarksnumbered=true,pdfview=FitB}

%------------------------------------------------------------------------------
%Margins and Header/Footer
\usepackage[top=2in, bottom=1.5in, left=1.5in, right=1in]{geometry}
\usepackage{lastpage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\rhead{--DRAFT--}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\title{}

\author{}
\date{}
\begin{document}

\baselineskip=18pt plus1pt

\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}


\maketitle                 
%------------------------------------------------------------------------------

\include{dedication}       
\include{acknowlegements}   
\include{abstract}         

%-------------------------------------------------------------------------------
\pagenumbering{roman}   
%-------------------------------------------------------------------------------

\phantomsection
\addcontentsline{toc}{chapter}{Contents}
\tableofcontents


\phantomsection
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures

\phantomsection
\addcontentsline{toc}{chapter}{List of Tables}
\listoftables

%-------------------------------------------------------------------------------

\newpage
\pagenumbering{arabic}
\clearpage

%-------------------------------------------------------------------------------

\include{chapter1}
\include{chapter2}
\include{chapter3}
\include{conclusions}
%-------------------------------------------------------------------------------

\end{document}

请帮忙。

答案1

这是您的文档的更好形状。请注意以下几点:

  1. 这些软件包a4epsf已经过时
  2. 要自动将目录和列表包含在目录中,请加载包tocbibind
  3. 如果您确实希望在章节起始页中也使用这些规则,请重新定义plain页面样式,如下所示
  4. 最好避免设置灵活的基线跳过;heightrounded需要\geometry的是
  5. fancyhdr警告您增加的值\headheight(可以在 中完成\geometry
\documentclass[12pt,twoside]{report}

%Packages used
\usepackage{geometry}
\usepackage{amssymb,amsmath,amsfonts}
\usepackage{multirow}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{tocbibind} % for toc and lists in toc

\usepackage[hypertexnames=false,linktocpage=true]{hyperref}
\hypersetup{colorlinks=true,
  linkcolor=blue,
  anchorcolor=blue,
  citecolor=blue,
  filecolor=blue,
  urlcolor=blue,
  bookmarksnumbered=true,
  pdfview=FitB}

%------------------------------------------------------------------------------
%Margins and Header/Footer
\geometry{a4paper,
  top=2in,
  bottom=1.5in,
  left=1.5in,
  right=1in,
  headheight=14.5pt, % the default is too short
  heightrounded, % avoids the need of a flexible baselineskip
} 

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\fancyhf{} % clear all fields
\fancyhead[R]{--DRAFT--}
\fancyfoot[C]{\thepage}
\fancypagestyle{plain}{%
  \renewcommand{\headrulewidth}{0.4pt}%
  \renewcommand{\footrulewidth}{0.4pt}%
  \fancyhf{}% clear all fields
  \fancyhead[R]{--DRAFT--}%
  \fancyfoot[C]{\thepage}%
}

\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

\begin{document}

\title{}
\author{}
\date{}

\maketitle                 
%------------------------------------------------------------------------------

\include{dedication}       
\include{acknowlegements}   
\include{abstract}         

%-------------------------------------------------------------------------------
\clearpage
\pagenumbering{roman}
%-------------------------------------------------------------------------------

\tableofcontents

\listoffigures

\listoftables

%-------------------------------------------------------------------------------

\clearpage
\pagenumbering{arabic}

%-------------------------------------------------------------------------------

\include{chapter1}
\include{chapter2}
\include{chapter3}
\include{conclusions}
%-------------------------------------------------------------------------------

\end{document}

相关内容