如何将子表保持在一起而不产生半空的页面?

如何将子表保持在一起而不产生半空的页面?

我有两个子表放置在连续浮动环境中。但是,正如我在示例中试图说明的那样,(i) 我希望子表彼此相连。此外,(ii) 我希望避免在第一段和第一个表之间留有空白。(iii) 所有表都不应位于第二段下方。我发布这个问题是因为即使在搜索有关子表的类似问题后,我也找不到解决方案。我的问题有解决方案吗?代码如下:

\documentclass[hidelinks,12pt,a4paper]{article} %hidelinks

\usepackage[T1]{fontenc} % Font encoding (e.g. hyphenation w/ accented characters)
\usepackage[utf8]{inputenc} % utf-8 support
\usepackage[main=english,german]{babel} % English as main language 
\usepackage{kpfonts}

\usepackage[margin=25mm]{geometry}
\usepackage{ragged2e}
\usepackage{microtype} % Adjustment of interword spacing, character protrusion etc.
\usepackage{lipsum}

\linespread{1.5}
\renewcommand{\baselinestretch}{1.3} % ~ 1.5 line spacing
\setlength{\parskip}{2pt} % "subtle" space between parag.

\usepackage{tabu} % tabu-environment, \tabulinesep
\usepackage{booktabs} % horizontal lines in tables
\usepackage{longtable} % tables with page break
\usepackage{float} % determining the position of e.g. tables
\usepackage[font=normalsize,labelfont=bf,skip=0pt]{caption} % formatting of captions
\usepackage[list=true,listformat=simple]{subcaption} % captions for subtables / subfigures
\usepackage{subcaption} % for subfigure-environment

\widowpenalty=10000 % no single lines at the top of a page
\clubpenalty=10000 % no single lines at the end of a page
\displaywidowpenalty=10000 % \widowpenalty im "math mode"
\interfootnotelinepenalty=10000 % footnotes always on one page

\begin{document}
\lipsum[3-5]\par
%
\begin{table}[htbp]
  \centering
  \caption{Comparison of production function estimators \\[+ 2.5mm]} 
  \label{tab:comparison}
\begin{subtable}{1\textwidth}
  \centering  
  \caption{Gross output specification} 
  \label{tab:comparison_gross}
\begin{tabular}{@{\extracolsep{5pt}}lccccc} 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
 & \multicolumn{5}{c}{\textit{Model:}} \\ 
\cline{2-6} 
\\[-1.8ex] & OLS & FE & OP & LP & WD \\ 
\\[-1.8ex] & (1) & (2) & (3) & (4) & (5) \\ 
\hline \\[-1.8ex] 
 Capital & 0.036$^{***}$ & 0.023$^{***}$ & 0.07$^{***}$ & 0.044$^{***}$ & 0.064$^{***}$ \\ 
  & (0.001) & (0.005) & (0.008) & (0.009) & (0.009) \\ 
\\ 
 Labour & 0.241$^{***}$ & 0.208$^{***}$ & 0.236$^{***}$ & 0.246$^{***}$ & 0.241$^{***}$ \\ 
  & (0.005) & (0.009) & (0.004) & (0.004) & (0.001) \\ 
\\ 
 Intermediates & 0.714$^{***}$ & 0.705$^{***}$ & 0.726$^{***}$ & 0.731$^{***}$ & 0.736$^{***}$ \\ 
  & (0.003) & (0.006) & (0.003) & (0.003) & (0.001) \\ 
\\ 
 R\&D & & & & & \\ 
  & & & & & \\ 
\\
\hline \\[-1.8ex]
Observations & 24,438 & 24,438 & 24,215 & 24,360 & 24,360 \\ 
No. of Firms & 5,056 & 5,056 & 5,055 & 5,047 & 5,047 \\
Returns to scale & 0.991 & 0.936 & 1.02 & 1.04 & 1.04 \\
R$^{2}$ & 0.979 & 0.857 & 0.973 & 0.973 & 0.974 \\ 
\hline 
\hline \\[-1.8ex] 
\multicolumn{2}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} & \\ 
\end{tabular} 
\end{subtable}
\end{table}

\pagebreak

\begin{table}[htbp]
  \ContinuedFloat
  \centering
  \caption*{\textit{Continued} \\[+ 2.5mm]}
\begin{subtable}{1\textwidth}
  \centering
  \caption{Value-added specification} 
  \label{tab:comparison_value} 
\begin{tabular}{@{\extracolsep{5pt}}lccccc} 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
 & \multicolumn{5}{c}{\textit{Model:}} \\ 
\cline{2-6} 
\\[-1.8ex] & OLS & FE & OP & ACF & WD \\ 
\\[-1.8ex] & (1) & (2) & (3) & (4) & (5) \\ 
\hline \\[-1.8ex] 
 Capital & 0.136$^{***}$ & 0.095$^{***}$ & 0.268$^{***}$ & 0.107$^{***}$ & 0.277$^{***}$ \\ 
  & (0.005) & (0.017) & (0.037) & (0.079) & (0.027) \\ 
\\ 
 Labour & 0.874$^{***}$ & 0.693$^{***}$ & 0.889$^{***}$ & 0.891$^{***}$ & 0.901$^{***}$ \\ 
  & (0.009) & (0.022) & (0.011) & (0.185) & (0.004) \\ 
\\
 R\&D & & & & & \\ 
  & & & & & \\ 
\\
\hline \\[-1.8ex]
Observations & 24,438 & 24,438 & 24,215 & 24,360 & 24,360 \\ 
No. of Firms & 5,056 & 5,056 & 5,055 & 5,047 & 5,047 \\
Returns to scale & 1.01 & 0.788 & 1.16 & 0.693 & 1.19 \\
R$^{2}$ & 0.820 & 0.193 & 0.733 & 0.678 & 0.690 \\ 
\hline 
\hline \\[-1.8ex] 
\multicolumn{2}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} &\\ 
\end{tabular}
\end{subtable}
\begin{flushleft} 
\justify{
\textit{Note:} Standard errors in parentheses, clustered at the firm level. Standard errors of control function estimates are generated using 50 bootstrap repetitions and not accounting for firm exit. Controls include two-digit industry dummies, year dummies, and a dummy for East Germany. Due to zero values in the investment or the energy expenditures variables some observations are dropped.\\[+ 2.5mm] \textit{Source}: CAF AFiD panel of industrial firms, 2003-2007, covering firms in the manufacturing sector with 20 or more persons employed, own calculations.}
\end{flushleft}
\end{table}
%
\lipsum[3-5]\par
%
\end{document}

答案1

较大的空间是由\pagebreak命令强制的,删除该命令允许第一页填充文本,但在注释中似乎您宁愿用表格填充它,因此您需要在源中尽早移动它以便它可以适合该[h]位置。

在此处输入图片描述

\documentclass[hidelinks,12pt,a4paper]{article} %hidelinks

\usepackage[T1]{fontenc} % Font encoding (e.g. hyphenation w/ accented characters)
\usepackage[utf8]{inputenc} % utf-8 support
\usepackage[main=english,german]{babel} % English as main language 
\usepackage{kpfonts}

\usepackage[margin=25mm]{geometry}
\usepackage{ragged2e}
\usepackage{microtype} % Adjustment of interword spacing, character protrusion etc.
\usepackage{lipsum}

\linespread{1.5}
\renewcommand{\baselinestretch}{1.3} % ~ 1.5 line spacing
\setlength{\parskip}{2pt} % "subtle" space between parag.

\usepackage{tabu} % tabu-environment, \tabulinesep
\usepackage{booktabs} % horizontal lines in tables
\usepackage{longtable} % tables with page break
\usepackage{float} % determining the position of e.g. tables
\usepackage[font=normalsize,labelfont=bf,skip=0pt]{caption} % formatting of captions
\usepackage[list=true,listformat=simple]{subcaption} % captions for subtables / subfigures
\usepackage{subcaption} % for subfigure-environment

\widowpenalty=10000 % no single lines at the top of a page
\clubpenalty=10000 % no single lines at the end of a page
\displaywidowpenalty=10000 % \widowpenalty im "math mode"
\interfootnotelinepenalty=10000 % footnotes always on one page

\begin{document}
\lipsum[3]\par
%
\begin{table}[htbp]
  \centering
  \caption{Comparison of production function estimators \\[+ 2.5mm]} 
  \label{tab:comparison}
\begin{subtable}{1\textwidth}
  \centering  
  \caption{Gross output specification} 
  \label{tab:comparison_gross}
\begin{tabular}{@{\extracolsep{5pt}}lccccc} 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
 & \multicolumn{5}{c}{\textit{Model:}} \\ 
\cline{2-6} 
\\[-1.8ex] & OLS & FE & OP & LP & WD \\ 
\\[-1.8ex] & (1) & (2) & (3) & (4) & (5) \\ 
\hline \\[-1.8ex] 
 Capital & 0.036$^{***}$ & 0.023$^{***}$ & 0.07$^{***}$ & 0.044$^{***}$ & 0.064$^{***}$ \\ 
  & (0.001) & (0.005) & (0.008) & (0.009) & (0.009) \\ 
\\ 
 Labour & 0.241$^{***}$ & 0.208$^{***}$ & 0.236$^{***}$ & 0.246$^{***}$ & 0.241$^{***}$ \\ 
  & (0.005) & (0.009) & (0.004) & (0.004) & (0.001) \\ 
\\ 
 Intermediates & 0.714$^{***}$ & 0.705$^{***}$ & 0.726$^{***}$ & 0.731$^{***}$ & 0.736$^{***}$ \\ 
  & (0.003) & (0.006) & (0.003) & (0.003) & (0.001) \\ 
\\ 
 R\&D & & & & & \\ 
  & & & & & \\ 
\\
\hline \\[-1.8ex]
Observations & 24,438 & 24,438 & 24,215 & 24,360 & 24,360 \\ 
No. of Firms & 5,056 & 5,056 & 5,055 & 5,047 & 5,047 \\
Returns to scale & 0.991 & 0.936 & 1.02 & 1.04 & 1.04 \\
R$^{2}$ & 0.979 & 0.857 & 0.973 & 0.973 & 0.974 \\ 
\hline 
\hline \\[-1.8ex] 
\multicolumn{2}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} & \\ 
\end{tabular} 
\end{subtable}
\end{table}

\pagebreak

\begin{table}[htbp]
  \ContinuedFloat
  \centering
  \caption*{\textit{Continued} \\[+ 2.5mm]}
\begin{subtable}{1\textwidth}
  \centering
  \caption{Value-added specification} 
  \label{tab:comparison_value} 
\begin{tabular}{@{\extracolsep{5pt}}lccccc} 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
 & \multicolumn{5}{c}{\textit{Model:}} \\ 
\cline{2-6} 
\\[-1.8ex] & OLS & FE & OP & ACF & WD \\ 
\\[-1.8ex] & (1) & (2) & (3) & (4) & (5) \\ 
\hline \\[-1.8ex] 
 Capital & 0.136$^{***}$ & 0.095$^{***}$ & 0.268$^{***}$ & 0.107$^{***}$ & 0.277$^{***}$ \\ 
  & (0.005) & (0.017) & (0.037) & (0.079) & (0.027) \\ 
\\ 
 Labour & 0.874$^{***}$ & 0.693$^{***}$ & 0.889$^{***}$ & 0.891$^{***}$ & 0.901$^{***}$ \\ 
  & (0.009) & (0.022) & (0.011) & (0.185) & (0.004) \\ 
\\
 R\&D & & & & & \\ 
  & & & & & \\ 
\\
\hline \\[-1.8ex]
Observations & 24,438 & 24,438 & 24,215 & 24,360 & 24,360 \\ 
No. of Firms & 5,056 & 5,056 & 5,055 & 5,047 & 5,047 \\
Returns to scale & 1.01 & 0.788 & 1.16 & 0.693 & 1.19 \\
R$^{2}$ & 0.820 & 0.193 & 0.733 & 0.678 & 0.690 \\ 
\hline 
\hline \\[-1.8ex] 
\multicolumn{2}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} &\\ 
\end{tabular}
\end{subtable}
\begin{flushleft} 
\textit{Note:} Standard errors in parentheses, clustered at the firm level. Standard errors of control function estimates are generated using 50 bootstrap repetitions and not accounting for firm exit. Controls include two-digit industry dummies, year dummies, and a dummy for East Germany. Due to zero values in the investment or the energy expenditures variables some observations are dropped.\\[+ 2.5mm] \textit{Source}: CAF AFiD panel of industrial firms, 2003-2007, covering firms in the manufacturing sector with 20 or more persons employed, own calculations.
\end{flushleft}
\end{table}
%

\clearpage

\lipsum[4-5]\par
\lipsum[3-5]\par
%
\end{document}

答案2

  • 使用talltblrtable(相当于tabularray的包threeparttable)时,表格可以包含注释和备注,也可以更紧凑。因此需要的空间更少。
  • 删除\pagebreak(如@DavidCarlisle 在他的评论和回答中所建议的:+1)以删除表格上方的空白区域。
  • 表被插入到组中,其中确定sisetup两个表是共同的
\documentclass[hidelinks,12pt,a4paper]{article}
\usepackage[vmargin=25mm]{geometry}
\renewcommand{\baselinestretch}{1.3}

\usepackage{kpfonts}
\usepackage{microtype} % Adjustment of inter word spacing, character protrusion etc.

\usepackage[main=english,german]{babel} % English as main language

\usepackage[skip=0pt]{caption}
\usepackage[list=true,listformat=simple]{subcaption}

\usepackage{ragged2e}  % not used
\usepackage{xcolor}    % not used
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx, counter}
%
\SetTblrStyle{note}{font=\footnotesize}
\SetTblrStyle{remark}{font=\footnotesize\linespread{0.92}\selectfont}
\SetTblrStyle{remark-tag}{\par\vspace{-0.75ex}}

\usepackage{lipsum}

\usepackage{etoolbox}
\AtBeginEnvironment{table}{\renewcommand{\baselinestretch}{1}}


\begin{document}
\lipsum[1-2]\par
%
\begingroup % for tables common setup
\sisetup{
    input-open-uncertainty  =,
    input-close-uncertainty =,
    table-format={(}1.3{$^{***}$}, 
         }
    \begin{table}[!b]
\caption{Gross output specification}
\label{tab:comparison_gross}

\begin{subtable}{\linewidth}
\caption{Gross output specification}
\label{tab:comparison_gross}
    \begin{talltblr}[
 label = none,
 entry = none,
note{} = {Standard errors in parentheses:
          *:    $p<0.10$,\quad
          **:   $p<0.05$,\quad
          ***:  $p<0.01$.
          },
                    ]{colspec={ l *{5}{X[c, si]} },
                     rowsep   = {1pt},
                     row{1,2} = {font=\bfseries},
                     row{1-3} = {guard},
                     row{odd[4-9]} = {abovesep=0pt, belowsep=1ex}
                     }
    \toprule
    &   \SetCell[c=5]{c}    Model
                &           &           &           &       \\
    \cmidrule{2-6}
    & OLS       & FE        & OP        & LP        & WD    \\
    & (1)       & (2)       & (3)       & (4)       & (5)   \\
    \midrule
Capital
    & 0.036\TblrNote{***}
                & 0.023\TblrNote{***}
                            & 0.07\TblrNote{***}
                                        & 0.044\TblrNote{***}
                                                    & 0.064\TblrNote{***}   \\
    & (0.001)   & (0.005)   & (0.008)   & (0.009)   & (0.009) \\
%    \addlinespace
Labour
    & 0.241\TblrNote{***}
                & 0.208\TblrNote{***}
                            & 0.236\TblrNote{***}
                                        & 0.246\TblrNote{***}
                                                    & 0.241\TblrNote{***}   \\
    & (0.005)   & (0.009)   & (0.004)   & (0.004)   & (0.001)   \\
%    \addlinespace
Intermediates
    & 0.714\TblrNote{***}
                & 0.705\TblrNote{***}
                            & 0.726\TblrNote{***}
                                        & 0.731\TblrNote{***}
                                                    & 0.736\TblrNote{***}   \\
    & (0.003)   & (0.006)   & (0.003)   & (0.003)   & (0.001)   \\
%    \addlinespace
R\&D
    & {?}       & {?}       & {?}       & {?}       & {?}       \\
    \midrule
Observations
    & {24,438}  & {24,438}  & {24,215}  & {24,360}  & {24,360}  \\
No. of Firms
    & {5,056}   & {5,056}   & {5,055}   & {5,047}   & {5,047}   \\
Returns to scale
    & 0.991     & 0.936     & 1.02      & 1.04      & 1.04      \\
$R^2$
    & 0.979     & 0.857     & 0.973     & 0.973     & 0.974     \\
    \bottomrule
    \end{talltblr}
\end{subtable}
\end{table}

\begin{table}[!t]
  \ContinuedFloat
\caption[]{Gross output specification -- \textit{Continued}}

\begin{subtable}{\linewidth}
\caption{Value-added specification}
\label{tab:comparison_value}
    \begin{talltblr}[
 label = none,
 entry = none,
note{} = {Standard errors in parentheses:
          *:    $p<0.10$,\quad
          **:   $p<0.05$,\quad
          ***:  $p<0.01$.
          },
remark{Note} = {
Standard errors in parentheses, clustered at the firm level. Standard errors of control function estimates are generated using 50 bootstrap repetitions and not accounting for firm exit. Controls include two-digit industry dummies, year dummies, and a dummy for East Germany. Due to zero values in the investment or the energy expenditures variables some observations are dropped.},
%
remark{Source} = {
CAF AFiD panel of industrial firms, 2003-2007, covering firms in the manufacturing sector with 20 or more persons employed, own calculations.}
                    ]{colspec={ l *{5}{X[c, si]} },
                     rowsep   = {1pt},
                     row{1,2} = {font=\bfseries},
                     row{1-3} = {guard},
                     row{odd[4-9]} = {belowsep=1ex}
                     }
    \toprule
    &   \SetCell[c=5]{c}    Model
                &           &           &           &       \\
    \cmidrule{2-6}
    & OLS       & FE        & OP        & LP        & WD    \\
    & (1)       & (2)       & (3)       & (4)       & (5)   \\
    \midrule
Capital
    & 0.136\TblrNote{***}
                & 0.095\TblrNote{***}
                            & 0.268\TblrNote{***}
                                        & 0.107\TblrNote{***}
                                                    & 0.277\TblrNote{***}   \\
    & (0.005)   & (0.017)   & (0.037)   & (0.079)   & (0.027)   \\
Labour
    & 0.874\TblrNote{***}
                & 0.693\TblrNote{***}
                            & 0.889\TblrNote{***}
                                        & 0.891\TblrNote{***}
                                                    & 0.901\TblrNote{***}   \\
    & (0.009)   & (0.022)   & (0.011)   & (0.185)   & (0.004)   \\
R\&D
    & {?}       & {?}       & {?}       & {?}       & {?}       \\
    \midrule
Observations
    & {24,438}  & {24,438}  & {24,215}  & {24,360}  & {24,360}  \\
No. of Firms
    & 5,056     & 5,056     & 5,055     & 5,047     & 5,047     \\
Returns to scale
    & 1.01      & 0.788     & 1.16      & 0.693     & 1.19      \\
$R^2$
    & 0.820     & 0.193     & 0.733     & 0.678     & 0.690     \\
    \bottomrule
    \end{talltblr}
\end{subtable}
\end{table}
\endgroup
%
\lipsum[3-5]
%
\end{document}

在此处输入图片描述

相关内容