页码位于整页图片的底部中央

页码位于整页图片的底部中央

我看过其他几个答案,特别是,但我还是很困惑。

目前,我的文档显示所有页码都居中在底部(正如我需要的那样),但是对于所有包含整页图形的页面,页码都会移到右上方。我不确定如何避免此问题。我已经看到了有关如何删除页码的答案,但我仍然需要它们。

我正在使用fancyhdr,它,但是除了更改旋转页面上的页码外,我不会使用它:

% Define terms for rotating pages landscape style WITH page numbering:
\fancypagestyle{floatpage}{%
  \fancyhf{}% Clear page header/footer
  \renewcommand{\headrulewidth}{0pt}% No header rule
  \fancyfoot[C]{\makebox[\textwidth][r]{%
    \smash{\raisebox{\dimexpr\footskip+.5\textheight}{\rotatebox{90}{\thepage}}}}}%
}

我使用以下页码编号方案:

\setcounter{page}{1}\pagenumbering{arabic}

如果我尝试使用第二个链接,即

\usepackage{fancyhdr} 
\fancyhf{}
\cfoot{\thepage}

我收到以下错误:

! Incomplete \iffalse; all text was ignored after line 1.

编辑

为了好玩,我还尝试简单地删除页码(如下所示回答),并且页码仍然出现。

編輯2

这是 MWE,虽然我没有添加图片。我保留了所有的前言,因为我现在想知道是否存在一些我没有看到的交互。

%%% Define the actual document parameters:
\documentclass[12pt,letterpaper]{report}


%%%  Include packages used throughout the dissertation:
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{setspace}
\usepackage{footmisc}
\usepackage{indentfirst}
\usepackage{monkey}
\usepackage{rotating}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{fancyhdr}
\usepackage{floatpag}
\usepackage[subfigure]{tocloft}
\usepackage{multirow}
\usepackage{amssymb}
\usepackage{comment}
\usepackage{epsfig}
\usepackage{moreverb}
\usepackage{subfigure}
\usepackage{setspace}
\usepackage{listings}
\usepackage{hyperref}
\usepackage{longtable,tabu}
\usepackage{IEEEtrantools}
\usepackage{caption}
\usepackage[all]{nowidow}

% ToC
\renewcommand{\contentsname}{\hfill\bfseries\Large Table of Contents\hfill}   
\renewcommand{\cftaftertoctitle}{\hfill}
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}
\renewcommand{\cftfigaftersnum}{:}
\renewcommand{\cfttabaftersnum}{:}
\setlength{\cftbeforetoctitleskip}{-0.25in}
\setlength{\cftbeforeloftitleskip}{-0.25in}
\setlength{\cftbeforelottitleskip}{-0.25in}

\usepackage{calc}
\renewcommand\chaptername{Chapter}
\renewcommand\cftchappresnum{\chaptername\space}
\setlength{\cftchapnumwidth}{\widthof{\textbf{Chapter~999~}}}


% make footnotes conform to font requirements
\renewcommand\footnotelayout{\normalsize}            % 12-point font for footnote text
\renewcommand{\thefootnote}{\small\arabic{footnote}} % 10-point font for footnote numbers

% Renew commands to properly format Table of Contents:
\renewcommand\cftchappagefont{\normalfont}
\renewcommand{\cftdot}{\normalfont.}
\addtocontents{toc}{%
    \protect\renewcommand{\protect\cftchapleader}{%-- switch it on here
        \bfseries\protect\cftdotfill{\protect\cftdotsep}}}

\renewcommand\cftsecfont{\normalfont}
\renewcommand{\cftsecfont}{\bfseries}
\renewcommand{\cftsubsecfont}{\bfseries}
\renewcommand{\cftsubsubsecfont}{\bfseries}
\renewcommand\cftsecpagefont{\normalfont}
\renewcommand{\cftsecleader}{\cftdotfill{\cftsecdotsep}}
\renewcommand\contentsname{\hfill \normalsize{TABLE OF CONTENTS} \hfill}
\renewcommand\listtablename{\hfill \normalsize{LIST OF TABLES} \hfill}
\renewcommand\listfigurename{\hfill \normalsize{LIST OF FIGURES} \hfill}

\renewcommand{\thesubfigure}{(\Alph{subfigure})}

% Format List of Tables:
\renewcommand{\cfttabpresnum}{Table }
\newlength{\mylen}
\settowidth{\mylen}{\cfttabpresnum\cfttabaftersnum}
\addtolength{\cfttabnumwidth}{\mylen}
\addtocontents{lot}{\protect\renewcommand*\protect\addvspace[1]{}}

% Format List of Figures:
\renewcommand{\cftfigpresnum}{Figure }
\newlength{\mylenfig}
\settowidth{\mylenfig}{\cftfigpresnum\cftfigaftersnum}
\addtolength{\cftfignumwidth}{\mylenfig}
\addtocontents{lof}{\protect\renewcommand*\protect\addvspace[1]{}}

\setlength{\cftafterloftitleskip}{3.5\baselineskip}
\setlength{\cftafterlottitleskip}{4.5\baselineskip}

\addtocontents{lot}{\linespread{2}\selectfont}


% make math environments conform to font requirements
\DeclareMathSizes{12}{12}{10}{10} % <font size><math text size><math subscript size><math sub-subscript size>...in english:  for the 12-point font size (our current scheme), set the math text size to 12-point, the math subscript size to 10 point, and the math sub-subscript size to 10-point.

% Define terms for rotating pages landscape style WITH page numbering:
\fancypagestyle{floatpage}{%
  \fancyhf{}% Clear page header/footer
  \renewcommand{\headrulewidth}{0pt}% No header rule
  \fancyfoot[C]{\makebox[\textwidth][r]{%
    \smash{\raisebox{\dimexpr\footskip+.5\textheight}{\rotatebox{90}{\thepage}}}}}%
}

\renewcommand{\bibname}{\large\centering{Bibliography}}

%%% Renew command for full page figures:
\renewcommand{\topfraction}{1.0}


%%%  Set the margins as required by the graduate school. 
%%%  Specifically, set the margins 1 inch top bottom and right, 
%%%  1.5 inch on left.  Now, Latex has margin origins at 1 in on the top 
%%%  and left so for 1.5 in the margin is set at 1.5 - 1 = .5 inch


%%% Changed to have 1in margins on left and right
\setlength{\oddsidemargin}{0.0in}   % This is the left margin for both
\setlength{\evensidemargin}{1.0in} % even and odd pages (in case you use the book format)
\setlength{\topmargin}{0in} % Top margin (remember latex starts from 1 in)
% Pagewidth(8.5in) - textwidth(6in) - leftmargins(1.5in) = 1 inch for right margin
\setlength{\textwidth}{6.5in}

% Page height (11in) - Topmargin (1in) - Textheight (1in) = 1 in for bottom margin
\setlength{\textheight}{9in} %
\setlength{\footskip}{.5in}
%%% Headings are not required, thus suppress:
\setlength{\headheight}{0in} 
\setlength{\headsep}{0in}

%%%  Begin the actual dissertation:
\begin{document}
\sloppy

\setcounter{page}{1}\pagenumbering{arabic}

%%%  Last few formatting commands:
\setlength{\parindent}{2 em}


\begin{doublespace}

\chapter{Background and Application}
\label{ch:background}

\section{Section 1}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis facilisis auctor eleifend. Duis tempus auctor ligula, quis auctor quam tempus a. Mauris lacinia iaculis massa. Aenean congue orci id libero dapibus, id eleifend lorem euismod. Etiam sed euismod magna. Donec a mi vitae nibh ullamcorper iaculis cursus id turpis. Pellentesque ultrices a justo nec finibus. Duis efficitur, felis sed scelerisque egestas, purus lorem efficitur lorem, at pulvinar enim massa vitae dui. Aliquam lacinia lectus ac orci elementum, non dictum magna vehicula.

Maecenas mattis nec nibh posuere pretium. Nullam euismod ipsum a mi pretium tincidunt. Sed vestibulum lacus id velit dignissim dictum. Fusce auctor sagittis tellus ut convallis. Interdum et malesuada fames ac ante ipsum primis in faucibus. Cras quis massa eros. Proin feugiat erat nisi, vel gravida nisi sodales in. Etiam maximus aliquet ante ut ornare. Aliquam dignissim orci massa, eu pretium mauris consectetur varius. Duis ac aliquet erat. Vestibulum nec purus dignissim, malesuada felis eget, hendrerit neque. In mattis, lacus at pulvinar aliquam, nisi mauris rutrum tellus, ac faucibus nibh velit non massa. Etiam pharetra id ipsum nec posuere.

%% Whatever page this figure ends up on, the page number is on the top right instead of the bottom middle
\begin{figure}[htbp]
  \begin{centering}
    \subfigure[Subfig1] {
      \includegraphics[width=5.6in]{the_figure.pdf}
      \label{sf:c2-left}
    }
    \\
    \subfigure[Subfig2] {
      \includegraphics[width=5.9in]{the_figure2.pdf}
      \label{sf:c2-right}
    }
    \caption{Caption}
    \label{f:c2-fig}
  \end{centering}
\end{figure}

\end{doublespace}

\end{document}

编辑3

Werner 的答案正确地格式化了页面,但前提是我注释掉参考书目。如果我将参考书目与他的答案中的代码一起保留,则会产生以下错误:

! Incomplete \iffalse; all text was ignored after line 1.
<inserted text> 
                \fi 
l.362 \bibliography{master.bib} %your bib file here

这是我的书目代码,位于文档的末尾:

%%%  Bibliography:
\cleardoublepage
\renewcommand\bibname{\center \normalsize{BIBLIOGRAPHY} }

\newpage
\vspace*{\fill}
\begin{center}
\addcontentsline{toc}{chapter}{BIBLIOGRAPHY}
\textbf{BIBLIOGRAPHY}
\vspace*{\fill}
\end{center}


\newpage
\begin{singlespace}
\parskip=2\baselineskip \advance\parskip by 0pt plus 2pt
\bibliographystyle{plain}% your bst file here
\bibliography{master} %your bib file here
\end{singlespace}
\end{doublespace}
\end{document}

编辑最后

我会接受 Werner 的回答,因为这解决了有关页码布局的初始问题。参考书目的问题是我需要在调用它之前将页面样式改回来。特别是:

%%%  Bibliography:
\pagestyle{plain} %% This fixed the issue

\cleardoublepage
\renewcommand\bibname{\center \normalsize{BIBLIOGRAPHY} }

\newpage
\vspace*{\fill}
\begin{center}
\addcontentsline{toc}{chapter}{BIBLIOGRAPHY}
\textbf{BIBLIOGRAPHY}
\vspace*{\fill}
\end{center}


\newpage
\begin{singlespace}
\parskip=2\baselineskip \advance\parskip by 0pt plus 2pt
\bibliographystyle{plain}% your bst file here
\bibliography{master} %your bib file here
\end{singlespace}
\end{doublespace}
\end{document}

答案1

正如在文档floatpag包裹,您需要使用 指定与全页/仅页面浮动相关的页面样式\floatpagestyle{<pagestyle>}。您还没有这样做。

以下最小示例根据设置适当的页面样式复制并修复您的问题:

在此处输入图片描述

\documentclass{report}

\usepackage{graphicx,lipsum}
\usepackage{fancyhdr,floatpag}

\pagestyle{fancy}
\fancyhf{}% Clear page header/footer
\renewcommand{\headrulewidth}{0pt}% No header rule
\fancyfoot[C]{\thepage}

\floatpagestyle{fancy}% Page style for float-page only

\begin{document}

\chapter{A chapter} \lipsum[1]
\section{A section} \lipsum[2-3]

\begin{figure}[htbp]
  \centering
  \includegraphics[width=\linewidth,height=.8\textheight]{example-image}%
  \caption{Caption}
\end{figure}

\lipsum[4-5]

\end{document}

相关内容