4

I've looked at several other answers, notably this and this, however I am still stumped.

Currently, my document shows all page numbers centered in the bottom (as I need them to be), however for all pages that have a full-page figure the page numbering moves to the top right. I am unsure of how to avoid this issue. I have seen answers on how to remove the page number, but I still need them.

I am using fancyhdr, however I don't use it other than to change the page numbering on rotated pages:

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

I use this page numbering scheme:

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

If I try to use the second link, i.e.,

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

I receive the following error:

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

Edit

For fun, I also tried simply removing the page number (as in this answer), and the page number still appeared.

Edit2

Here is a MWE, although I didn't include a figure. I left all of the preamble in, as I am now wondering if there is some interaction that I'm not seeing.

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

Edit3

Werner's answer correctly formats the page, but only if I comment out my bibliography. Here is the error generated if I leave my bibliography in with the code from his answer:

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

And here is my bibliography code, at the end of the document:

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

Edit the last

I will accept Werner's answer, as that fixed the initial question regarding the layout of page numbering. The issue with the bibliography was that I needed to change the page style back prior to invoking it. In particular:

%%%  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
    \pagenumbering{arabic} overrules \setcounter{page}{1} by setting the page counter to 0 -- unrelated comment ;-). You should show us a MWE – user31729 Apr 14 '15 at 5:51
  • Good to know. I'll try to strip it down...its a dissertation so there's quite a bit of preamble to work through. – the_e Apr 14 '15 at 5:58
  • 1
    monkey??? graphics is useless, if graphicx is included already (remove graphics, als well as the outdated epsfig – user31729 Apr 14 '15 at 6:13
  • 1
    Use the geometry package to set the margins etc. of your document, do not fiddle around with \setlength{\oddsidemargin}{...} etc. Oh my, this MWE is a little mess... And there is no \pagestyle{fancy} or \pagestyle{floatpage} command at all. – user31729 Apr 14 '15 at 6:16
  • 1
5

As mentioned in the documentation of the floatpag package, you need to specify the page style associated with full-page/page-only floats using \floatpagestyle{<pagestyle>}. You haven't done that.

The following minimal example replicates and fixes your problem based on setting the appropriate page style:

enter image description here

\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}
  • Thank you. That somewhat works, however, it breaks at the addition of my bibliography page. I will add extra code and errors in my question. – the_e Apr 14 '15 at 12:54
  • Actually, never mind. I found the issue. I'll update my answer accordingly. Thanks again! – the_e Apr 14 '15 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.