我有一张很长的表格,应该保持纵向显示。我无法删除表格所在页面上的编号。我尝试将\thispagestyle{empty}
整个表格放在\begin{center}
环境中、\thispagestyle{empty}
表格环境中和\thispagestyle{empty}
环境中,但\begin{threeparttable}
均无效。放置\thispagestyle{empty}
在表格内部失败。
有什么简单的解决办法吗?
这是我的代码:
\documentclass[12pt,letterpaper]{article}
\usepackage[margin=1in ]{geometry}
\usepackage{fancyhdr}
\usepackage[flushleft]{threeparttable}
\setlength{\headheight}{15.2pt}
\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}
答案1
latex 并不真正支持这一点。这会使浮动页面有一个空脚,因此它只会影响表格所在的页面,而不会影响之前或之后的页面。除非您将其恢复,即恢复没有标记线的原始定义,否则它将影响所有其他浮动页面。
\documentclass[12pt,letterpaper]{article}
\usepackage[margin=1in ]{geometry}
\usepackage{fancyhdr}
\usepackage[flushleft]{threeparttable}
\setlength{\headheight}{15.2pt}
\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
\if@fcolmade
\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}
答案2
使用\iffloatpage
自fancyhdr
:
\documentclass[12pt,letterpaper]{article}
\usepackage[margin=1in,headheight=15.2pt]{geometry}
\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}
这将隐藏浮动页面中的页码。如果您还想隐藏页面上方的规则,请添加
\renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.4pt}}
选择后\pagestyle{fancy}
。
这将清除所有浮动页中的页码。您可以将其设置\fancyfoot[C]{\iffloatpage{}{\thepage}
在任意位置,并\fancyfoot[C]{\thepage}
在浮动页之后的页面中将其恢复,但希望您没有连续的浮动页。
然而,最好的做法是避免使用过多的浮动。如您所见,\small
将浮动保持在页面边界内就足够了。
答案3
这不是最优雅的解决方案,但我添加了\pagenumbering{gobble}
删除页码然后使用\pagenumbering{arabic}
(取决于您的首选样式)重置它\setcounter{page}{2}
。 可能有一些自动重置计数器的方法,而无需参考特定页面。
编辑:所以我在该表的页面之间进行的页面清除/分页也很重要。
\documentclass[12pt,letterpaper]{article}
\usepackage[margin=1in ]{geometry}
\usepackage{fancyhdr,lipsum}
\usepackage[flushleft]{threeparttable}
\setlength{\headheight}{15.2pt}
\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}
答案4
这应该有效:
\documentclass[12pt,letterpaper]{article}
\usepackage[margin=1in ]{geometry}
\usepackage{fancyhdr}
\usepackage[flushleft]{threeparttable}
\setlength{\headheight}{15.2pt}
\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}
Your table
\endgroup
\clearpage
Text
\end{document}