目錄頁上的頁首問題

目錄頁上的頁首問題

我的 LaTeX 如下所示(我省略了很多\usepackage和一些花哨的設置,例如在奇數頁打開):

\documentclass[9pt,a4paper,reqno]{amsbook}

\usepackage{fancyhdr,etoolbox}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[LO]{\nouppercase\rightmark}
\fancyhead[RE]{\nouppercase\leftmark}


\begin{document}
\frontmatter

\title{\textsc{AAAZZZ}}
\author{LZ}
\mainmatter

\pagenumbering{roman}

\maketitle

\chapter*{Abstract}
The goal of this notes is to describe...


\chapter*{Acknowledgements}
I offer my sincerest gratitude to...

\renewcommand{\contentsname}{Table of contents}
\makeatletter
\patchcmd{\@tocline}
{\hfil}
{\leaders\hbox{\,.\,}\hfil}{}{}
\makeatother
{\large {\tableofcontents}}
\addcontentsline{toc}{subsection}{Section name}
\thispagestyle{plain}

\pagenumbering{arabic}

\chapter{Preliminaries on A}

\chapter{Results on Z}

\end{document}

我的問題有兩個:

Table of contents只有一頁,然後CHAPTER 1直接開始。但我希望它稍後開始一頁,仍然編號為“1”(而不是“2”),即Table of contents應該有一個虛擬/空的第二頁(應該是普通樣式,沒有頁眉/頁腳)。如何實現這項目標?

和:

如果我在目錄中添加更多內容,那麼目錄第二頁的頁眉將顯示為“第 0 章。目錄”(在右側;左側是頁碼“viii”,這是我想要的為了保留,如果目錄第二頁沒有頁首/頁腳,我也會感到滿意)?有沒有辦法使其僅作為“目錄”?

答案1

以下程式碼模板似乎可以解決您所有的問題:

\documentclass{amsbook}

\usepackage{fancyhdr,etoolbox}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[LO]{\nouppercase\rightmark}
\fancyhead[RE]{\nouppercase\leftmark}

\renewcommand{\contentsname}{Table of contents}
\makeatletter
\patchcmd{\@tocline}
  {\hfil}
  {\leaders\hbox{\,.\,}\hfil}{}{}
\makeatother

\begin{document}

\pagestyle{plain}

\frontmatter

\title{\textsc{AAAZZZ}}
\author{LZ}

\maketitle

\chapter*{Abstract}
The goal of this notes is to describe \ldots

\chapter*{Acknowledgements}
I offer my sincerest gratitude to \ldots

\tableofcontents

\mainmatter

\cleardoublepage

\pagenumbering{arabic}
\pagestyle{fancy}

\chapter{Preliminaries on A}

\chapter{Results on Z}

\end{document}

具體來說,有以下一些建議:

  • 用於\pagestyle{plain}書的前半部(直到 之前\mainmatter)。頁面plain樣式僅設定頁腳中的頁碼。可以將其附加到\frontmatter所做的內容中,從而進一步清理您的程式碼。

  • 用於\pagestyle{fancy}書的主要部分(在 之後\mainmatter)。可以將其附加到\mainmatter所做的內容中,從而進一步清理您的程式碼。

  • \cleardoublepageafter\tableofcontents應該充分清除頁面,以便在目錄末尾和第一章開頭之間留下一個空白頁(如果目錄只有一頁)。

  • 使用\pagenumbering{arabic}將頁碼重設為 1,因此\chapter如果第一頁前面有第一頁,則始終會從第 1 頁開始第一頁\chapter

相關內容