更新答案:

更新答案:

我需要 3 个事件同时发生:

  1. 删除标题后的空白页

  2. 使用以下代码获取页眉中第 2 章的页码fancyhdr

  3. 左侧为偶数,右侧为奇数页,页眉中标题后的所有页码


\documentclass[openany]{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}
\chapter{Introduction2}
\section{Introducing the fish2}
\section{fox2}
\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

您的代码存在几个问题,从而导致出现问题:

  1. 在类book命令中,在末尾\maketitle使用\cleardoublepage。要摆脱它,请使用和创建一个组\maketitle,然后在该组内\frontmatter停用...\clearpage

    { % <===================================================================
    \maketitle
    \let\cleardoublepage\relax
    
    \frontmatter
    } % <===================================================================
    
  2. 您的章节的页面几何形状非常奇怪。要显示该效果,只需将包选项添加showframegeometry代码并进行编译即可。然后您会看到\geometry命令的奇怪结果。在下面的 mwe 中,我只是评论了这个不寻常的geometry设置...

  3. 我将命令\newcommand{\titlefontarash}和指令\newcommand{\basefontarash}移到了序言中……
  4. 我评论/删除了您对样式的重新定义plain,由于页面几何形状没有改变,因此没有必要重新定义样式...

请参阅以下完整的 MWE

\documentclass[openany]{book}

\usepackage[showframe]{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}

\newcommand{\titlefontarash}{% 
  \usefont{OT1}{pag}{b}{n}%
  \fontsize{25}{\baselineskip}%
  \selectfont%
}
\newcommand{\basefontarash}{%
  \usefont{OT1}{pag}{b}{n}%
  \fontsize{18}{\baselineskip}%
  \selectfont%
}


\begin{document}

\title{\titlefontarash  Helping each other}
\author{\basefontarash Good boy}
{ % <===================================================================
\maketitle
\let\clearpage\relax

\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}

\chapter{Introduction2}
\section{Introducing the fish2}
\section{fox2}
%\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 章的布局等。说实话我无法从给定的代码中猜出您想要什么......

通过激活的几何图形,您将获得以下第 1 章,其中无法放置页码:

奇怪的几何结果

更新答案:

在评论中解释之后,请参见以下更改后的代码:

\newgeometry{ left=2.75in, right=.5in } % <======================= ?????
\mainmatter
\fancypagestyle{plain}{%
  \fancyhf{}
  \fancyhead[OR]{\textbf {\thepage}\hspace*{2.25in}} % <================
  \fancyhead[EL]{\textbf {\hspace*{2.25in}\thepage}} % <================
  \renewcommand{\headrulewidth}{0pt}
}
\pagestyle{plain}

因为您将左边距从 改为 ,.5in所以您需要为页眉2.75in添加新的定义。B 注意,对于奇数和偶数页眉,您需要添加不同的!\hspace*{2.25in}\hspace

因此使用以下代码

\documentclass[openany]{book}

\usepackage{blindtext}
\usepackage[showframe]{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}

\newcommand{\titlefontarash}{% 
  \usefont{OT1}{pag}{b}{n}%
  \fontsize{25}{\baselineskip}%
  \selectfont%
}
\newcommand{\basefontarash}{%
  \usefont{OT1}{pag}{b}{n}%
  \fontsize{18}{\baselineskip}%
  \selectfont%
}


\begin{document}

\title{\titlefontarash  Helping each other}
\author{\basefontarash Good boy}
{ % <===================================================================
\maketitle
\let\clearpage\relax

\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[OR]{\textbf {\thepage}\hspace*{2.25in}} % <================
  \fancyhead[EL]{\textbf {\hspace*{2.25in}\thepage}} % <================
  \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}
\Blinddocument

\chapter{Introduction2}
\section{Introducing the fish2}
\section{fox2}
\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章

第2章

答案2

删除空白页:

\documentclass[openany]{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
\let\newpage\relax
\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}
\chapter{Introduction2}
\section{Introducing the fish2}
\section{fox2}
\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}

相关内容