Remove numbering from a table page, not in landscape

I have a very long table that should stay in portrait. I'm having trouble removing numbering on the page where the table shows up. I tried putting \thispagestyle{empty} and the whole table in a \begin{center} environment, \thispagestyle{empty} in the table environment and \thispagestyle{empty} in the \begin{threeparttable} environment to no effect. Placing \thispagestyle{empty} inside tabular fails.

Any easy fixes?

Here's my code:

\documentclass[12pt,letterpaper]{article}
\usepackage[margin=1in ]{geometry}
\usepackage{fancyhdr}
\usepackage[flushleft]{threeparttable}
\pagestyle{fancy}

\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}

\begin{document}

\begin{table}[htbp]
\begin{threeparttable}
\caption{ Drinking Water}
\thispagestyle{empty} %Doesn't clear the page where the table ends up.
%Works in this simplified code because there is ONLY one page.
{
\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}
\begin{tabular}{l*{3}{c}}
\hline\hline
&\multicolumn{3}{c}{}                       \\
& Non-EWB School         &  EWB School & Diff.         \\
\hline
Water Src. Dist. (min)$^{\dag}$     &       17.16         &       14.76     &    2.408\sym{*}   \\
&     (14.27)         &     (12.55)     &     (0.966)         \\
\hline
Spring (protected)              &       0.407         &       0.395      &      0.0134         \\
&     (0.492)         &     (0.489)       &    (0.0353)         \\
[1em]
Spring (unprotected)   &      0.0418         &      0.0385      &     0.00341         \\
&     (0.200)         &     (0.193)       &    (0.0141)         \\
[1em]
Rain        &       0.227         &       0.221        &     0.00721       \\
&     (0.420)         &     (0.415)        &    (0.0300)       \\
[1em]
Public Tap         &      0.0940         &       0.100       &    -0.00575         \\
&     (0.292)         &     (0.300)       &    (0.0213)         \\
[1em]
Household Pipe        &      0.0261         &      0.0538       &     -0.0276         \\
&     (0.160)         &     (0.226)       &    (0.0141)         \\
[1em]
Rivers/Streams       &       0.112         &      0.0923       &      0.0202         \\
&     (0.316)         &     (0.290)       &    (0.0218)         \\
[1em]
Well (protected)    &      0.0627         &      0.0564      &     0.00640         \\
&     (0.243)         &     (0.231)       &    (0.0170)         \\
[1em]
Well (unprotected)    &     0.00783         &      0.0154      &    -0.00751         \\
&    (0.0883)         &     (0.123)       &   (0.00771)         \\
[1em]
Borehole    &      0.0183         &     0.00769       &      0.0106         \\
&     (0.134)         &    (0.0875)       &   (0.00812)         \\
[1em]
EWB Borehole    &           0         &      0.0179      &     -0.0179\sym{**} \\
&         (0)         &     (0.133)       &   (0.00678)         \\
[1em]
Lake/Pond        &     0.00261         &     0.00256       &   0.0000534         \\
&    (0.0511)         &    (0.0506)       &   (0.00365)         \\
\hline
Treat Water$^{\dag\dag}$       &       0.619         &       0.597       &      0.0229         \\
&     (0.486)         &     (0.491)       &    (0.0351)         \\
[1em]
Treat Water in Household$^{\dag\dag\dag}$      &       0.431         &       0.408       &      0.0242         \\
&     (0.496)         &     (0.492)       &    (0.0355)         \\
\hline
$$N$$       &                     &                   &         774         \\
\hline\hline
\end{tabular}
}
\begin{tablenotes}
\item sd/se in parentheses
\item \sym{*} $$p<0.05$$, \sym{**} $$p<0.01$$, \sym{***} $$p<0.001$$
\item$^{\dag}$Distance to water source for 2014 dry season only.
\item$^{\dag\dag}$Indicates the household treats water at the source \emph{or} treats water at home.
\item$^{\dag\dag\dag}$Indicates the household treats water at home.
\item Water sources are for the wet season.
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document}

• good question this, no good answers unfortunately:-) – David Carlisle Dec 12 '14 at 18:18
• @DavidCarlisle Er… – egreg Dec 12 '14 at 19:01
• @egreg my comment stands:-) – David Carlisle Dec 12 '14 at 19:39
• I ended up putting the table in a scale box and shrinking it. – k-dubs Jan 15 '15 at 20:12

latex doesn't really support this. This makes float pages have an empty foot, so it does just affect the page the table lands on, not the page before or after. It will affect all other float pages unless you set it back ie restore the original definition without the marked line.

\documentclass[12pt,letterpaper]{article}
\usepackage[margin=1in ]{geometry}
\usepackage{fancyhdr}
\usepackage[flushleft]{threeparttable}
\pagestyle{fancy}

\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}

\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}
\makeatletter
\def \@startcolumn {%
\global \@colroom \@colht
\@tryfcolumn \@deferlist
\def\@thefoot{}%<<<<<<<<
\else
\begingroup
\let \reserved@b \@deferlist
\global \let \@deferlist \@empty
\let \@elt \@scolelt
\reserved@b
\endgroup
\fi
}

\makeatother
\begin{document}
\setcounter{page}{111111111}

some text some text some text some text some text
some text some text some text some text some text
some text some text some text some text some text

\begin{table}[p]
\begin{threeparttable}
\caption{ Drinking Water}
%Works in this simplified code because there is ONLY one page.
{
\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}
\begin{tabular}{l*{3}{c}}
\hline\hline
&\multicolumn{3}{c}{}                       \\
& Non-EWB School         &  EWB School & Diff.         \\
\hline
Water Src. Dist. (min)$^{\dag}$     &       17.16         &       14.76     &    2.408\sym{*}   \\
&     (14.27)         &     (12.55)     &     (0.966)         \\
\hline
Spring (protected)              &       0.407         &       0.395      &      0.0134         \\
&     (0.492)         &     (0.489)       &    (0.0353)         \\
[1em]
Spring (unprotected)   &      0.0418         &      0.0385      &     0.00341         \\
&     (0.200)         &     (0.193)       &    (0.0141)         \\
[1em]
Rain        &       0.227         &       0.221        &     0.00721       \\
&     (0.420)         &     (0.415)        &    (0.0300)       \\
[1em]
Public Tap         &      0.0940         &       0.100       &    -0.00575         \\
&     (0.292)         &     (0.300)       &    (0.0213)         \\
[1em]
Household Pipe        &      0.0261         &      0.0538       &     -0.0276         \\
&     (0.160)         &     (0.226)       &    (0.0141)         \\
[1em]
Rivers/Streams       &       0.112         &      0.0923       &      0.0202         \\
&     (0.316)         &     (0.290)       &    (0.0218)         \\
[1em]
Well (protected)    &      0.0627         &      0.0564      &     0.00640         \\
&     (0.243)         &     (0.231)       &    (0.0170)         \\
[1em]
Well (unprotected)    &     0.00783         &      0.0154      &    -0.00751         \\
&    (0.0883)         &     (0.123)       &   (0.00771)         \\
[1em]
Borehole    &      0.0183         &     0.00769       &      0.0106         \\
&     (0.134)         &    (0.0875)       &   (0.00812)         \\
[1em]
EWB Borehole    &           0         &      0.0179      &     -0.0179\sym{**} \\
&         (0)         &     (0.133)       &   (0.00678)         \\
[1em]
Lake/Pond        &     0.00261         &     0.00256       &   0.0000534         \\
&    (0.0511)         &    (0.0506)       &   (0.00365)         \\
\hline
Treat Water$^{\dag\dag}$       &       0.619         &       0.597       &      0.0229         \\
&     (0.486)         &     (0.491)       &    (0.0351)         \\
[1em]
Treat Water in Household$^{\dag\dag\dag}$      &       0.431         &       0.408       &      0.0242         \\
&     (0.496)         &     (0.492)       &    (0.0355)         \\
\hline
$$N$$       &                     &                   &         774         \\
\hline\hline
\end{tabular}
}
\begin{tablenotes}
\item sd/se in parentheses
\item \sym{*} $$p<0.05$$, \sym{**} $$p<0.01$$, \sym{***} $$p<0.001$$
\item$^{\dag}$Distance to water source for 2014 dry season only.
\item$^{\dag\dag}$Indicates the household treats water at the source \emph{or} treats water at home.
\item$^{\dag\dag\dag}$Indicates the household treats water at home.
\item Water sources are for the wet season.
\end{tablenotes}
\end{threeparttable}
\vspace{-50pt}
\end{table}

some text some text some text some text some text
some text some text some text some text some text

\clearpage

some text some text some text some text some text

\end{document}

• I don't understand the code, but it works! However, it removes page numbering from the other float pages, as you mentioned. I'm not so stoked about that. Where could I reset the definition of \@thefoot? Within the \begin{document}...\end{document}? – k-dubs Dec 13 '14 at 20:37
• @k well that's the thing: you can restore the definition anywhere after the float page is output but you don't (in general) know where that is. But for any particular document just put it anywhere in the document after you know the big float is output – David Carlisle Dec 13 '14 at 21:36
• @k-dubs This is basically same issue as egreg's which is the same mechanism, just accessed a bit differently. – David Carlisle Dec 13 '14 at 21:39

Use \iffloatpage from fancyhdr:

\documentclass[12pt,letterpaper]{article}
\usepackage{fancyhdr}
\usepackage[flushleft]{threeparttable}
\pagestyle{fancy}
\fancyfoot[C]{\iffloatpage{}{\thepage}}

\usepackage{lipsum}

\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}

\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}

\begin{document}
\title{Title}
\author{Author}
\date{}
\maketitle

\lipsum[1-20]

\begin{table}[p]
\small
\begin{threeparttable}
\caption{ Drinking Water}
%Works in this simplified code because there is ONLY one page.
{
\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}
\begin{tabular}{l*{3}{c}}
\hline\hline
&\multicolumn{3}{c}{}                       \\
& Non-EWB School         &  EWB School & Diff.         \\
\hline
Water Src. Dist. (min)$^{\dag}$     &       17.16         &       14.76     &    2.408\sym{*}   \\
&     (14.27)         &     (12.55)     &     (0.966)         \\
\hline
Spring (protected)              &       0.407         &       0.395      &      0.0134         \\
&     (0.492)         &     (0.489)       &    (0.0353)         \\
[1em]
Spring (unprotected)   &      0.0418         &      0.0385      &     0.00341         \\
&     (0.200)         &     (0.193)       &    (0.0141)         \\
[1em]
Rain        &       0.227         &       0.221        &     0.00721       \\
&     (0.420)         &     (0.415)        &    (0.0300)       \\
[1em]
Public Tap         &      0.0940         &       0.100       &    -0.00575         \\
&     (0.292)         &     (0.300)       &    (0.0213)         \\
[1em]
Household Pipe        &      0.0261         &      0.0538       &     -0.0276         \\
&     (0.160)         &     (0.226)       &    (0.0141)         \\
[1em]
Rivers/Streams       &       0.112         &      0.0923       &      0.0202         \\
&     (0.316)         &     (0.290)       &    (0.0218)         \\
[1em]
Well (protected)    &      0.0627         &      0.0564      &     0.00640         \\
&     (0.243)         &     (0.231)       &    (0.0170)         \\
[1em]
Well (unprotected)    &     0.00783         &      0.0154      &    -0.00751         \\
&    (0.0883)         &     (0.123)       &   (0.00771)         \\
[1em]
Borehole    &      0.0183         &     0.00769       &      0.0106         \\
&     (0.134)         &    (0.0875)       &   (0.00812)         \\
[1em]
EWB Borehole    &           0         &      0.0179      &     -0.0179\sym{**} \\
&         (0)         &     (0.133)       &   (0.00678)         \\
[1em]
Lake/Pond        &     0.00261         &     0.00256       &   0.0000534         \\
&    (0.0511)         &    (0.0506)       &   (0.00365)         \\
\hline
Treat Water$^{\dag\dag}$       &       0.619         &       0.597       &      0.0229         \\
&     (0.486)         &     (0.491)       &    (0.0351)         \\
[1em]
Treat Water in Household$^{\dag\dag\dag}$      &       0.431         &       0.408       &      0.0242         \\
&     (0.496)         &     (0.492)       &    (0.0355)         \\
\hline
$$N$$       &                     &                   &         774         \\
\hline\hline
\end{tabular}
}
\begin{tablenotes}
\item sd/se in parentheses
\item \sym{*} $$p<0.05$$, \sym{**} $$p<0.01$$, \sym{***} $$p<0.001$$
\item$^{\dag}$Distance to water source for 2014 dry season only.
\item$^{\dag\dag}$Indicates the household treats water at the source \emph{or} treats water at home.
\item$^{\dag\dag\dag}$Indicates the household treats water at home.
\item Water sources are for the wet season.
\end{tablenotes}
\end{threeparttable}
\end{table}

\lipsum[3-20]

\end{document}


This suppresses the page number in the float pages. If you also want to suppress the rule above the pages, add also

\renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.4pt}}


after choosing \pagestyle{fancy}.

This will clear the page number in all pages of floats. You can set \fancyfoot[C]{\iffloatpage{}{\thepage} anywhere, and revert it with \fancyfoot[C]{\thepage} in the page that follows the float page, hoping that you don't have consecutive pages of floats.

However, the best action is avoiding enormous floats. As you see, \small is sufficient to keep that float into the page boundaries.

• Simple solution but I don't want to remove the page numbers from every float page, just this page for an enormous table. – k-dubs Dec 13 '14 at 20:22
• Assuming you don't have consecutive pages of floats, you can issue \fancyfoot[C]{\iffloatpage{}{\thepage}} on the page preceding the float and \fancyfoot[C]{\thepage} on the following page. Do it when the text is in final form. But, first of all, try avoiding oversized floats. – egreg Dec 13 '14 at 20:30
• Noted. I've thought I might just shrink the table. However, I do have multiple floating pages in a row, unfortunately. It is a data description section with a series of floating tables at the end. – k-dubs Dec 13 '14 at 20:46
• @k-dubs Tough problem. – egreg Dec 13 '14 at 21:00

This is not the most elegant solution but I added \pagenumbering{gobble} which removes the page number and then reset it with \pagenumbering{arabic}(depending on your preferred style) and \setcounter{page}{2}. There is probably some automatic way to reset the counter without referring to the specific page.

EDIT: So the page clearing/breaking I did between the pages for that table also matters.

    \documentclass[12pt,letterpaper]{article}
\usepackage[margin=1in ]{geometry}
\usepackage{fancyhdr,lipsum}
\usepackage[flushleft]{threeparttable}
\pagestyle{fancy}

\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}

\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}

\begin{document}

\section*{First random title} \lipsum[1]
\pagebreak

\begin{table}[htbp]
\begin{threeparttable}
\caption{ Drinking Water}
%\thispagestyle{empty} %Doesn't clear the page where the table ends up.
%Works in this simplified code because there is ONLY one page.
\pagenumbering{gobble}
\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}
\begin{tabular}{l*{3}{c}}
\hline\hline
&\multicolumn{3}{c}{}                       \\
& Non-EWB School         &  EWB School & Diff.         \\
\hline
Water Src. Dist. (min)$^{\dag}$     &       17.16         &       14.76     &    2.408\sym{*}   \\
&     (14.27)         &     (12.55)     &     (0.966)         \\
\hline
Spring (protected)              &       0.407         &       0.395      &      0.0134         \\
&     (0.492)         &     (0.489)       &    (0.0353)         \\
[1em]
Spring (unprotected)   &      0.0418         &      0.0385      &     0.00341         \\
&     (0.200)         &     (0.193)       &    (0.0141)         \\
[1em]
Rain        &       0.227         &       0.221        &     0.00721       \\
&     (0.420)         &     (0.415)        &    (0.0300)       \\
[1em]
Public Tap         &      0.0940         &       0.100       &    -0.00575         \\
&     (0.292)         &     (0.300)       &    (0.0213)         \\
[1em]
Household Pipe        &      0.0261         &      0.0538       &     -0.0276         \\
&     (0.160)         &     (0.226)       &    (0.0141)         \\
[1em]
Rivers/Streams       &       0.112         &      0.0923       &      0.0202         \\
&     (0.316)         &     (0.290)       &    (0.0218)         \\
[1em]
Well (protected)    &      0.0627         &      0.0564      &     0.00640         \\
&     (0.243)         &     (0.231)       &    (0.0170)         \\
[1em]
Well (unprotected)    &     0.00783         &      0.0154      &    -0.00751         \\
&    (0.0883)         &     (0.123)       &   (0.00771)         \\
[1em]
Borehole    &      0.0183         &     0.00769       &      0.0106         \\
&     (0.134)         &    (0.0875)       &   (0.00812)         \\
[1em]
EWB Borehole    &           0         &      0.0179      &     -0.0179\sym{**} \\
&         (0)         &     (0.133)       &   (0.00678)         \\
[1em]
Lake/Pond        &     0.00261         &     0.00256       &   0.0000534         \\
&    (0.0511)         &    (0.0506)       &   (0.00365)         \\
\hline
Treat Water$^{\dag\dag}$       &       0.619         &       0.597       &      0.0229         \\
&     (0.486)         &     (0.491)       &    (0.0351)         \\
[1em]
Treat Water in Household$^{\dag\dag\dag}$      &       0.431         &       0.408       &      0.0242         \\
&     (0.496)         &     (0.492)       &    (0.0355)         \\
\hline
$$N$$       &                     &                   &         774         \\
\hline\hline
\end{tabular}
\begin{tablenotes}
\item sd/se in parentheses
\item \sym{*} $$p<0.05$$, \sym{**} $$p<0.01$$, \sym{***} $$p<0.001$$
\item$^{\dag}$Distance to water source for 2014 dry season only.
\item$^{\dag\dag}$Indicates the household treats water at the source \emph{or} treats water at home.
\item$^{\dag\dag\dag}$Indicates the household treats water at home.
\item Water sources are for the wet season.
\end{tablenotes}
\end{threeparttable}
\end{table}
\clearpage

\pagebreak
\pagenumbering{arabic}%
\setcounter{page}{2}
\section*{Second random title} \lipsum[2]

\end{document}


• this is basically the same as the thispagestyle suggestion in the question, if you didn't have a forced break before, or the table floated further away the gobble would take effect on the page the table was set not on the page it appeared. – David Carlisle Dec 12 '14 at 18:07
• @David Do you think I should remove this answer? – user3235 Dec 12 '14 at 18:10
• not necessarily, let the OP choose:-) (there is no good answer here, they will all, including one I just posted, have odd side effects, unless you rewrite large parts of latex internals) – David Carlisle Dec 12 '14 at 18:16
• This is a nice simple solution. The only draw back is I'll have to monitor the \setcounter{page}{} as the document changes length. – k-dubs Dec 13 '14 at 20:44

This should work:

    \documentclass[12pt,letterpaper]{article}
\usepackage[margin=1in ]{geometry}
\usepackage{fancyhdr}
\usepackage[flushleft]{threeparttable}
\pagestyle{fancy}
\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}
\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}
\begin{document}
Text
\clearpage
\begingroup
\thispagestyle{empty}


• Nope, doesn't change the page where the table floats to, just the page where the table is posted. I used \thispagestyle{empty} \begin{table}...\end{table} \clearpage to no avail. – k-dubs Dec 13 '14 at 20:17