34

I have a large table that uses up the whole space on a page. Unfortunately, the table also covers the page number, which is shining through. I don't want to split the table across two pages, hence I want to suppress the page numbering for this single page. Here's my table source code:

\begin{table}
    \myfloatalign
    \begin{tabular}[t]{rrrrr}
        % lots
        % of
        % rows
    \end{tabular}
\end{table}

I tried to place a \thispagestyle{empty} right before the table, directly after the table and in various other places, but without success.

How do I suppress the page number of the page that contains the table?

  • Do you have control on where the table will appear in the document, or do you want it to float freely? – Gonzalo Medina Oct 29 '11 at 0:30
49

The behaviour you expierence is because the table is typeset first on the current page, so a \thispagestyle before or after applies to that page, but then it floats to the next page where it is displayed.

In order to make this work use the floatpag package with \floatpagestyle{empty} to make all float pages have an empty style or use \thisfloatpagestyle{empty} inside the float, i.e. the table environment.

  • Thank you very much for your extensive answer. Your solution works perfectly well. – Philip Oct 30 '11 at 16:26
  • Hi, @MartinScharrer. Your solution worked for me. However, for the numbered float pages, their position was modified to top right. Can I define it to bottom center? Thank you. – pceccon Aug 15 '14 at 18:43
  • 1
    I had the same issue as @pceccon. This is due to the floatpag package defaulting to \floatpagestyle{headings}. You can use \floatpagestyle{plain} to get the bottom-center page numbers (and \thisfloatpagestyle{empty} as necessary to suppress page numbers). – KQS Jan 3 '17 at 1:59
  • how to hide only page number and keep top header? – user3806649 Feb 6 '18 at 14:42
  • @user3806649: Depends on your setup. Please post a follow-up question and provide a minimal example. – Martin Scharrer Feb 7 '18 at 9:04
8

You could use the afterpage package and its command \afterpage; the method is admittedly a bit kludgy, but I've used it over the years to very good effect in just the types of situations you describe.

... material before large table ...
\afterpage{ % execute argument of this command *after* end of current page
\clearpage % clear any pending floats
\begin{table}
...
\end{table}
\thispagestyle{empty}
\clearpage % force a page break
} % end of \afterpage{...} stuff
... remainder of document ...

The only way this might fail is if you already have other floats queued up, waiting to be typeset on a page, before you get to the \afterpage{} command. If that's the case, just issue a second \clearpage command. :-)

7

You can change the page style for all float-only pages using the package fancyhdr. It provides the construction \iffloatpage{value for float page}{value for other pages}. See the documentation for fancyhdr, section 14.

Another option is to use float package and the provided H placement specifier to put your table on a non-floating page. Then you can use \thispagestyle on this page. Of course it means you are to control the placement of the table yourself...

0

Expanding on the answer from Boris, I got it working by adding the following to my preamble

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C]{\iffloatpage{}{\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

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.