\pagestyle{plain} 用于摘要,\fancypagestyle 用于章节页面

\pagestyle{plain} 用于摘要,\fancypagestyle 用于章节页面

我想使用 \pagestyle{plain} 来制作摘要,使用 \pagestyle{fancy} 来制作章节页。但是它不起作用。如果有人能帮助我,我将非常高兴。提前致谢。

\documentclass[12pt,a4paper]{book}
\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc}% Output font encoding for international characters
\usepackage{mathptmx}%times Roman
\usepackage{caption}

%maths
\usepackage{mathtools}
\usepackage{amsmath}%mathematical facilities for latex
\usepackage{amssymb, amsthm} %curl F and similar
\usepackage{amsfonts}
\usepackage{mathrsfs}
\usepackage{romannum}
\DeclareMathOperator{\lcm}{lcm}


%tikzpicture
\usepackage{tikz}
\usepackage{scalerel}
\usepackage{tkz-euclide}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\usetikzlibrary{patterns,arrows.meta}
\usetikzlibrary{shadows}
\usetikzlibrary{external}

%pgfplots
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{statistics}
\usepgfplotslibrary{fillbetween}
\usepackage{float}
%\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{ragged2e}

%colours
\usepackage{color}
\usepackage{nicefrac}
%To add a navigation window
\usepackage[pdftex]{pict2e}
\usepackage{hyperref}
\hypersetup{colorlinks=true,allcolors=purple}
\usepackage{hypcap}

\usepackage{blindtext}
\usepackage{array,boldline, makecell, booktabs}%for creating a table
\usepackage{multicol}
\usepackage{multirow}
\usepackage{verbatim} %for multiline comments
\usepackage{setspace}
\onehalfspacing

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{%
\markright{\thesection\ #1}}
\fancyhf{} % delete current header and footer
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt}% space for the rule
\fancypagestyle{plain}{%
\fancyhead{} % get rid of headers on plain pages
\renewcommand{\headrulewidth}{0pt} % and the line
}

\begin{document}
\input{title}
\let\cleardoublepage\clearpage
\input{title2}
\input{title3}

\frontmatter
\pagestyle{plain}
\addcontentsline{toc}{chapter}{Declaration}
\include{authorship}

\addcontentsline{toc}{chapter}{Abstract}
\include{abstract}

\addcontentsline{toc}{chapter}{Acknowledgements}
\include{ack} 

\tableofcontents

\listoffigures

\pagestyle{fancy}
\mainmatter


%%%%%%%%%%% MAIN CONTENT %%%%%%%%%%%%
\include{Chapters/Chapter1}  
\include{Chapters/Chapter2}  
\include{Chapters/Chapter3}
\include{Chapters/Chapter4}
\include{Chapters/Chapter5}
\end{document}

相关内容