我尝试为论文制作页眉和页脚。我想删除摘要的页眉。但是,当我使用 \pagestyle{plain} 时,所有章节页眉都被删除(不仅是摘要章节)。
\documentclass[12pt,oneside]{book}%use oneside to ensure no blanks\
\usepackage[text={5.45in,8.5in}, left=1.5in, right=1.25in, top=1.25in, bottom=1.25in, headheight=15.91pt, centering]{geometry}
\usepackage[table,hyperref]{xcolor}
\usepackage{setspace, fancyhdr, amsmath, amssymb,amsthm, graphicx, color, lscape, longtable, booktabs, caption, wrapfig, hyperref, pdfpages, capt-of, lmodern, titlesec, tikz, lipsum}
\fancypagestyle{plain}{\cfoot{\thepage}}
\usepackage{babel}
%\usepackage{fancyhdr,ifthen}
\usepackage{blindtext}
\usepackage{nonumonpart}
%\usepackage{textcomp}
% Setup for headers and footers (fancyhdr)
\fancyhf{}
\lhead{\ifthenelse{\isodd{\value{page}}}{}{\nouppercase\leftmark}}
\rhead{\ifthenelse{\isodd{\value{page}}}{\nouppercase\rightmark}{}}
\cfoot{\thepage}
\pagestyle{fancy}
\fancypagestyle{chapter}{%
\fancyhf{}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}
\begin{document}
\thispagestyle{fancyplain}
\chapter{Abstract}
\lipsum[1-5]
\part{First part} \label{part1}
\thispagestyle{chapter}
\chapter{Some chapter}
\thispagestyle{chapter}
\section{Section I}
\lipsum[1-1]
\subsection{Subsection}
\lipsum[1-2]
\section{Section II}
\lipsum[1-2]
\subsection{Subsection One}
\lipsum[1-2]
\subsection{Subsection Two}
\lipsum[1-2]
\chapter{Some chapter 2}
\thispagestyle{chapter}
\section{Section I}
\lipsum[1-1]
\subsection{Subsection}
\lipsum[1-2]
\section{Section II}
\lipsum[1-2]
\subsection{Subsection One}
\lipsum[1-2]
\subsection{Subsection Two}
\lipsum[1-2]
\end{document}
答案1
这是一个可能的解决方案:
\documentclass[12pt,oneside]{book}%use oneside to ensure no blanks\
\usepackage[text={5.45in,8.5in}, left=1.5in, right=1.25in, top=1.25in, bottom=1.25in, headheight=15.91pt, centering]{geometry}
\usepackage[table,hyperref]{xcolor}
\usepackage{setspace, fancyhdr, amsmath, amssymb,amsthm, graphicx, color, lscape, longtable, booktabs, caption, wrapfig, hyperref, pdfpages, capt-of, lmodern, titlesec, tikz, lipsum}
\usepackage{babel}
\usepackage{blindtext}
\usepackage{nonumonpart}
%\fancypagestyle{plain}{\cfoot{\thepage}}
% Setup for headers and footers (fancyhdr)
\pagestyle{fancy}
\fancyhf{}
\lhead{\ifthenelse{\isodd{\value{page}}}{}{\nouppercase\leftmark}}
\rhead{\ifthenelse{\isodd{\value{page}}}{\nouppercase\rightmark}{}}
\cfoot{\thepage}
\fancypagestyle{chapter}{%
\fancyhf{}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
\begin{document}
\thispagestyle{plain}
\chapter*{Abstract}
\lipsum[1-5]
\part{First part} \label{part1}
\thispagestyle{chapter}
\chapter{Some chapter}
\thispagestyle{chapter}
\section{Section I}
\lipsum[1-1]
\subsection{Subsection}
\lipsum[1-2]
\section{Section II}
\lipsum[1-2]
\subsection{Subsection One}
\lipsum[1-2]
\subsection{Subsection Two}
\lipsum[1-2]
\chapter{Some chapter 2}
\thispagestyle{chapter}
\section{Section I}
\lipsum[1-1]
\subsection{Subsection}
\lipsum[1-2]
\section{Section II}
\lipsum[1-2]
\subsection{Subsection One}
\lipsum[1-2]
\subsection{Subsection Two}
\lipsum[1-2]
\end{document}
如果你观察一下,就会发现摘要并不是一章!所以你可以用它chapter*
来解决它。如果你再看看这个解决方案,你会看到第二页仍然带有页眉(空白页眉)。但是,你不必担心,因为没有摘要会太大,所以它需要两页!
答案2
不要做这些\thispagestyle{chapter}
事情(并且不要定义chapter
页面样式。默认plain
页面样式将执行相同的操作。
不要使用 pagestyle fancyplain
。它已经过时,可能会产生意想不到的结果。
对于摘要,只需\pagestyle{plain}
在 之前给出一个,\pagestyle{fancy}
在 之后给出一个\part
。
\documentclass[12pt,oneside]{book}%use oneside to ensure no blanks\
\usepackage[text={5.45in,8.5in}, left=1.5in, right=1.25in, top=1.25in, bottom=1.25in, headheight=15.91pt, centering]{geometry}
\usepackage[table,hyperref]{xcolor}
\usepackage{setspace, fancyhdr, amsmath, amssymb,amsthm, graphicx, color, lscape, longtable, booktabs, caption, wrapfig, hyperref, pdfpages, capt-of, lmodern, titlesec, tikz, lipsum}
\usepackage{babel}
%\usepackage{fancyhdr,ifthen}
\usepackage{blindtext}
\usepackage{nonumonpart}
%\usepackage{textcomp}
% Setup for headers and footers (fancyhdr)
\fancyhf{}
\lhead{\ifthenelse{\isodd{\value{page}}}{}{\nouppercase\leftmark}}
\rhead{\ifthenelse{\isodd{\value{page}}}{\nouppercase\rightmark}{}}
\cfoot{\thepage}
\pagestyle{fancy}
\begin{document}
\pagestyle{plain}
\chapter{Abstract}
\lipsum[1-5]
\part{First part} \label{part1}
\pagestyle{fancy}
\chapter{Some chapter}
\section{Section I}
\lipsum[1-1]
\subsection{Subsection}
\lipsum[1-2]
\section{Section II}
\lipsum[1-2]
\subsection{Subsection One}
\lipsum[1-2]
\subsection{Subsection Two}
\lipsum[1-2]
\chapter{Some chapter 2}
\section{Section I}
\lipsum[1-1]
\subsection{Subsection}
\lipsum[1-2]
\section{Section II}
\lipsum[1-2]
\subsection{Subsection One}
\lipsum[1-2]
\subsection{Subsection Two}
\lipsum[1-2]
\end{document}