9

In my document I have a table that is quite big. I would like to have this table on a page with no header and no page number. How can I get this table on a \thispagestyle{empty}? Using it withing the table or tabular environment makes the page were the float is defined go empty and leaves the headers on the table.

For if it matters, I am using fancyhdr.

lockstep
  • 250,273
Peter Smit
  • 14,035

4 Answers4

9

fancyhdr provides the \iffloatpage macro that can be used to customize header and footer for pages which contain only floats.

\documentclass{book}

\usepackage{fancyhdr}
\fancyhead{}
\fancyhead[LE,RO]{\iffloatpage{}{\slshape\rightmark}}
\fancyhead[LO,RE]{\iffloatpage{}{\slshape\leftmark}}
\fancyfoot{}
\fancyfoot[C]{\iffloatpage{}{\thepage}}
\renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.4pt}}
\pagestyle{fancy}

\usepackage[english]{babel}
\usepackage{blindtext}

\begin{document}

\blinddocument

\begin{table}[p]
\centering
(Table contents)
\caption{A table on a separate page}
\end{table}

\end{document}

EDIT: For those that want to use the \iffloatpage macro with KOMA-script's scrpage2 package instead of with fancyhdr, add the following to your preamble (thanks to Stefan Kottwitz for the tip):

\makeatletter
\newcommand*{\iffloatpage}[2]{\if@fcolmade #1\else #2\fi}
\makeatother

(The blindtext package is only used to add some dummy text to the example.)

lockstep
  • 250,273
  • @Peter: By default, the table should be vertically centered. Tweaking the positioning paramaters still won't "reclaim" the header space, unless the table is too large for a normal page to begin with. There may be hacks to achieve what you want, but that's over my head. – lockstep May 30 '11 at 20:27
  • Thanks for that. I realized this immediately after I posted my comment, so therefore I removed it :) – Peter Smit May 31 '11 at 04:14
4

When using the memoir document class the command mergepagefloatstyle can be used to separate pagestyles for regular pages and pages with only floats, similar to @lockstep's soltuion. For example

\mergepagefloatstyle{floatcomp}{ruled}{empty}

defines a new style floatcomp that will use the pagestyle ruled for regular pages and empty for float-only pages.

A MWE:

\documentclass{memoir}
\usepackage{kantlipsum}

% Define new style floatcomp that usees 'ruled' style for regular
% pages, and 'empty' for float-only pages.
\mergepagefloatstyle{floatcomp}{ruled}{empty}
% Use previously defined floatcomp style
\pagestyle{floatcomp}

\begin{document}

\kant[1-5]

\begin{table}[p]
\centering
(Table contents)
\caption{A table on a separate page}
\end{table}
\clearpage

\kant[10-13]

\end{document}
Tim
  • 530
3

You can simply put the table on a page of its own without putting it inside a table environment. Then you can make use \thispagestyle{empty} before the table. To add the caption properly, use the \captionof command from the caption package.

Alan Munn
  • 218,180
2

Because there is no really satisfying answer to the question yet, I want to add an alternative to Alan's approach.

\clearpage
\thispagestyle{empty}
\begin{figure}
...
\end{figure}
\clearpage

This lets you keep the "float" as such, it just doesn't float anymore. That kinda sucks but this at least gives you another poison to choose from.

Christian
  • 19,238