我使用 \fancyhead[EL,OR] 将页码放在偶数页的最左侧,并使用 fancyhdr 将页码放在奇数页的最右侧,但它不起作用。
\documentclass[10pt,openany,oneside]{book}
\usepackage{geometry}
\geometry{paperheight=9.8125in,paperwidth=8in, left=.5in,
right=.5in,top=.75in,bottom=.4375in }
\usepackage{fancyhdr}
\fancypagestyle{plain}{\fancyhf{} \fancyhead[EL,OR]{\textbf
{\thepage}}\renewcommand{\headrulewidth}{0pt}}
\pagestyle{plain}
\renewcommand{\rmdefault}{pag}
\usepackage[utf8]{inputenc}
\usepackage[hyphens]{url}
\usepackage[authoryear,round]{natbib}
\begin{document}
\newcommand{\titlefontarash}{\usefont{OT1}{pag}{b}{n}\fontsize{25}
{\baselineskip} \selectfont}
\newcommand{\basefontarash}{\usefont{OT1}{pag}{b}{n}\fontsize{18}
{\baselineskip} \selectfont}
\title{\titlefontarash Helping each other}
\author{\basefontarash Good boy}
\maketitle
\frontmatter
\vspace*{\fill}
\begin{center}
\basefontarash To good...
\basefontarash To those good..
\end{center}
\vspace*{\fill}
\tableofcontents
\newgeometry{ left=2.75in, right=.5in }
\mainmatter
\fancypagestyle{plain}{ \fancyhf{}\fancyhead[EL,OR]{\textbf
{\thepage}\hspace*{2.25in}}\renewcommand{\headrulewidth}{0pt}}
\pagestyle{plain}
\chapter{Introduction}
\section{Introducing the fish}
\section{fox}
referring to \citet{Fish(1979)}.
A \textbf{fish} (or \textbf{cat}) jungle sky.
\section{river}
\newgeometry{ left=.5in, right=.5in}
\fancypagestyle{plain}{\fancyhf{}\fancyhead[EL,OR]{\textbf
{\thepage}}\renewcommand{\headrulewidth}{0pt}}
\pagestyle{plain}
\begin{thebibliography}{9}
\bibitem[Fish(1979)]{Fish(1979)} Fish, Y(1979) \textit{orange HHH} New York:
hot.
\end{thebibliography}
\end{document}
你知道如何让它工作吗?
答案1
当您编译示例时,您应该注意到许多警告,例如:
Package Fancyhdr Warning: \fancyhead's `E' option without twoside option is useless
on input line 29.
因此,您可以在类选项中使用twoside
而不是 ,从而使示例按您想要的方式工作。实际上和是类的默认设置,因此只需有:oneside
book
10pt
twoside
book
\documentclass[openany]{book}