LaTeX
我正在使用我所在部门似乎已经使用了一段时间的模板文件撰写论文。问题是,当我编译代码时,我在第 2 章开始的页面上获得了一个带有章节编号和标题的标题。
但在第一章开始的页面上并没有发生这种情况。
我想从第 2 章的起始页中删除页眉,但尽管尝试了很多次,我还是无法弄清楚是什么原因导致它出现在那里(而不是第 1 章的起始页),以及如何摆脱它。任何帮助都将不胜感激。这是主LaTeX
文件的 MWE:
\documentclass[11pt,a4paper,twoside]{report}
\usepackage[top=3cm, bottom=3cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage[latin1]{inputenc}
% Page number must be in the upper righthand corner
\usepackage{fancyhdr}
\fancypagestyle{phdthesis}{
\fancyhf{} %clear all headers and footers fields
\rhead{\thepage} %prints the page number on the right side of the header
\renewcommand{\headrulewidth}{0pt}
}
\fancypagestyle{plain}{\pagestyle{phdthesis}}
% to remove page numbers on empty pages (before chapter start)
\makeatletter
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%% TITLE PAGE AND DECLARATION
\pagestyle{empty}
\begin{titlepage}
\end{titlepage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% CONTENTS
\tableofcontents
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% CHAPTERS
\newpage
\pagenumbering{arabic}
%% INCLUDE TEXT OF CHAPTER 1 IN THE FILE chp1.tex
\include{chp1}
%% INCLUDE TEXT OF CHAPTER 2 IN THE FILE chp2.tex
\include{chp2}
%% INCLUDE TEXT OF CHAPTER 3 IN THE FILE chp3.tex
\include{chp3}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% BIBLIOGRAPHY
\bibliography{mybib}
\end{document}
以下是全部 3 个章节的代码,它们分别保存为 chp1.tex、chp2.tex 和 chp3.tex,位于同一目录中:
\chapter{{\it Chapter 1 Title}}\label{chp1}
\thispagestyle{myheadings}
{\it Text for Chapter \ref{chp1}}
\chapter{{\it Chapter 2 Title}}\label{chp2}
\thispagestyle{myheadings}
{\it Text for Chapter \ref{chp2}}
\chapter{{\it Chapter 3 Title}}\label{chp3}
\thispagestyle{myheadings}
{\it Text for Chapter \ref{chp3}}
请帮忙。
答案1
删除命令\thispagestyle{myheadings}
后面的\chapter
。
然后您自己的页面样式phdthesis
将用于章节页面,因为
\fancypagestyle{plain}{\pagestyle{phdthesis}}