使用 \fancyhdr 不會改變頁碼的位置

使用 \fancyhdr 不會改變頁碼的位置

您好,我正在使用 fancyhdr 套件將我的頁碼定義到右下角。通常它可以工作,但不能在兩頁上工作,並且頁碼位於底部中心而不是右下角。可能是因為我在這些頁面上定義了編號格式。但我無法解決這個問題。你能幫忙嗎?

\documentclass[11pt]{report}
\usepackage[a4paper, margin=1in]{geometry}
\usepackage{amsmath, amsfonts}
\usepackage{graphicx,subfigure}
\usepackage[round,authoryear]{natbib}
\parindent 0ex
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue, citecolor=blue]{hyperref}
\usepackage[table]{xcolor}
\usepackage{array,lscape,longtable,multicol,multirow,boldline,threeparttable,colortbl,enumitem}
\usepackage{fancyhdr} 
\fancyhf{}
\pagestyle{fancy}
\rfoot{\thepage}
\begin{document}
\pagenumbering{roman}
\tableofcontents
\begingroup
\let\clearpage\relax
\listoffigures
\listoftables
\endgroup
\setcounter{chapter}{2}
%Chapter
%%===================================
\chapter{Methods of analysis of dams}
\pagenumbering{arabic}
\setcounter{page}{1}

\section{Introduction}
text...
\end document 

在此輸入影像描述

在此輸入影像描述

答案1

每章的第一頁使用plainpagestyle,預設沒有標題,頁碼位於底部中心。目錄標題、圖表列表等是使用該\chapter*命令排版的,因此它們具有相同的行為。

您可以透過重新定義plain樣式來變更此設置,如fancyhdr文件第 7 節所述。

將其添加到文件的序言中:

\fancypagestyle{plain}{%
  \fancyhf{}% clear all header and footer fields
  \rfoot{\thepage}%
  \renewcommand{\headrulewidth}{0pt}%
  \renewcommand{\footrulewidth}{0pt}%
}

相關內容