防止表格跳转到下一页

防止表格跳转到下一页

我试图将此表格放入已有文本的页面中。表格跳转到下一页,原本应该在下一页的文本跳转到表格所在的页面上。

  • 我应该怎么办?

\begin{table}[]
\centering
\caption{Regression results }
\begin{tabular}{llll}
    \hline
    \textbf{FDI} & \begin{tabular}[c]{@{}l@{}}OLS\\ (1)\end{tabular}    & \begin{tabular}[c]{@{}l@{}}FE\\ (2)\end{tabular}             & \begin{tabular}[c]{@{}l@{}}FGLS\\ (3)\end{tabular}          \\ \hline
    FDI.L1    & \begin{tabular}[c]{@{}l@{}}0.65*\\ (0.02)\end{tabular}   & \begin{tabular}[c]{@{}l@{}}0.93**\\ (0.4)\end{tabular}  & \begin{tabular}[c]{@{}l@{}}0.72*\\ (0.00)\end{tabular}  \\
    INFR      & \begin{tabular}[c]{@{}l@{}}0.42***\\ (0.13)\end{tabular} & \begin{tabular}[c]{@{}l@{}}0.4072***\\ (0.1504)\end{tabular} & \begin{tabular}[c]{@{}l@{}}0.45*\\ (0.0)\end{tabular}  \\
    EXCH      & \begin{tabular}[c]{@{}l@{}}0.40***\\ (0.17)\end{tabular} & \begin{tabular}[c]{@{}l@{}}0.49***\\ (0.15)\end{tabular} & \begin{tabular}[c]{@{}l@{}}0.45*\\ (0.36)\end{tabular}  \\
    MRKTS     & \begin{tabular}[c]{@{}l@{}}1.51\\ (0.73)\end{tabular}    & \begin{tabular}[c]{@{}l@{}}1.1\\ (0.7)\end{tabular}    & \begin{tabular}[c]{@{}l@{}}1.1*\\ (0.08)\end{tabular}  \\
    MRKTS.L1  & \begin{tabular}[c]{@{}l@{}}0.85***\\ (0.26)\end{tabular} & \begin{tabular}[c]{@{}l@{}}0.55***\\ (0.24)\end{tabular} & \begin{tabular}[c]{@{}l@{}}0.7477*\\ (0.2261)\end{tabular}  \\
    UNMP      & \begin{tabular}[c]{@{}l@{}}-0.0236\\ (0.09)\end{tabular}   & \begin{tabular}[c]{@{}l@{}}-0.06\\ (0.07)\end{tabular}   & \begin{tabular}[c]{@{}l@{}}-0.04\\ (0.00)\end{tabular}  \\
    NEWS      & \begin{tabular}[c]{@{}l@{}}0.56***\\ (0.25)\end{tabular} & \begin{tabular}[c]{@{}l@{}}0.56***\\ (0.29)\end{tabular} & \begin{tabular}[c]{@{}l@{}}0.58*\\ (0.28)\end{tabular}  \\
    NEGT      & \begin{tabular}[c]{@{}l@{}}0.23***\\ (0.02)\end{tabular} & \begin{tabular}[c]{@{}l@{}}0.23***\\ (0.7)\end{tabular} & \begin{tabular}[c]{@{}l@{}}0.31**\\ (0.17)\end{tabular} \\
    CANDC     & \begin{tabular}[c]{@{}l@{}}0.02\\ (0.08)\end{tabular}    & \begin{tabular}[c]{@{}l@{}}0.02\\ (0.00)\end{tabular}    & \begin{tabular}[c]{@{}l@{}}0.01\\ (0.17)\end{tabular}   \\
    Country 2 & \begin{tabular}[c]{@{}l@{}}-0.10\\ (0.13)\end{tabular}   & -                                                            & \begin{tabular}[c]{@{}l@{}}-0.24\\ (0.17)\end{tabular}  \\
    Country 3 & \begin{tabular}[c]{@{}l@{}}0.07\\ (0.33)\end{tabular}    & -                                                            & \begin{tabular}[c]{@{}l@{}}-0.18\\ (0.26)\end{tabular}  \\
    Country 4 & \begin{tabular}[c]{@{}l@{}}1.60***\\ (0.69)\end{tabular} & -                                                            & \begin{tabular}[c]{@{}l@{}}1.56**\\ (0.67)\end{tabular} \\
\end{tabular}
\end{table}

答案1

与其花时间尝试将表格定位在当前页面上,我更愿意努力使表格更具可读性——并在视觉上吸引读者。例如,加载包dcolumn并将所有数字对齐到各自的小数点标记上。在这样做的同时,一定要抓住机会简化代码急剧地,按照以下示例所示,它只包含 1 个tabular环境,而不是 40 个 [!!]。

在此处输入图片描述

\documentclass{article}
\usepackage{booktabs,dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\begin{document}
\begin{table}[h!] % place table on current page, if at all possible
\centering
\caption{Regression results}
\begin{tabular}{@{} >{\scshape}l *{3}{d{2.5}} @{}}
    \addlinespace
    \toprule
    FDI    & \mc{OLS} & \mc{FE}  & \mc{FGLS} \\
           & \mc{(1)} & \mc{(2)} & \mc{(3)} \\ 
    \midrule
    fdi.l1 &  0.65^{*}   &  0.93^{**}  &  0.72^{*} \\
           & (0.02)   & (0.4)    & (0.00) \\
    infr   &  0.42^{***} & 0.4072^{***}&  0.45^{*} \\ 
           & (0.13)   & (0.1504) & (0.0)  \\
    exch   &  0.40^{***} &  0.49^{***} &  0.45^{*} \\
           & (0.17)   & (0.15)   & (0.36) \\
    mrkts  &  1.51    &  1.1     &  1.1^{*}  \\
           & (0.73)   & (0.7)    & (0.08) \\
    mrkts.l1& 0.85^{***} &  0.55^{***} &  0.7477^{*} \\
           & (0.26)   & (0.24)   & (0.2261) \\
    unmp   & -0.0236  & -0.06    & -0.04  \\ 
           & (0.09)   & (0.07)   & (0.00) \\
    news   &  0.56^{***} &  0.56^{***} &  0.58^{*} \\
           & (0.25)   & (0.29)   & (0.28) \\
    negt   &  0.23^{***} &  0.23^{***} &  0.31^{**} \\
           & (0.02)   & (0.7)    & (0.17) \\
    candc  &  0.02    &  0.02    &  0.01  \\
           & (0.08)   & (0.00)   & (0.17) \\
    country 2 &-0.10  & \mc{--}  & -0.24  \\
           & (0.13)   &          & (0.17) \\
    country 3 & 0.07  & \mc{--}  & -0.18  \\
           & (0.33)   &          & (0.26) \\
    country 4 & 1.60^{***} & \mc{--}& 1.56^{**} \\
           & (0.69)   &          & (0.67) \\
    \bottomrule
\end{tabular}
\end{table}

\end{document}

答案2

那怎么样longtable?它将从您希望有表格的地方开始,但它的结束将在下一页,例如这样:

在此处输入图片描述

下面的 MWE 基于米科很好地完善了您的代码:

\documentclass{article}
\usepackage{booktabs, dcolumn, longtable}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\usepackage{lipsum}

\begin{document}
\lipsum[1-3]
\begin{longtable}{@{} >{\scshape}l *{3}{d{2.5}} @{}}
\caption{Regression results\newline}                           \\
\endfirsthead
\caption{Regression results (cont.)}     \\
    \toprule
\endhead
\midrule[0.6pt]
\multicolumn{4}{>{\footnotesize}r}{continue on the next page}
\endfoot
\endlastfoot
    \toprule
    FDI    & \mc{OLS} & \mc{FE}  & \mc{FGLS}            \\
           & \mc{(1)} & \mc{(2)} & \mc{(3)}             \\
    \midrule
    fdi.l1 &  0.65^{*}   &  0.93^{**}  &  0.72^{*}      \\
           & (0.02)   & (0.4)    & (0.00)               \\
    infr   &  0.42^{***} & 0.4072^{***}&  0.45^{*}      \\
           & (0.13)   & (0.1504) & (0.0)                \\
    exch   &  0.40^{***} &  0.49^{***} &  0.45^{*}      \\
           & (0.17)   & (0.15)   & (0.36)               \\
    mrkts  &  1.51    &  1.1     &  1.1^{*}             \\
           & (0.73)   & (0.7)    & (0.08)               \\
    mrkts.l1& 0.85^{***} &  0.55^{***} &  0.7477^{*}    \\
           & (0.26)   & (0.24)   & (0.2261)             \\
    unmp   & -0.0236  & -0.06    & -0.04                \\
           & (0.09)   & (0.07)   & (0.00)               \\
    news   &  0.56^{***} &  0.56^{***} &  0.58^{*}      \\
           & (0.25)   & (0.29)   & (0.28)               \\
    negt   &  0.23^{***} &  0.23^{***} &  0.31^{**}     \\
           & (0.02)   & (0.7)    & (0.17)               \\
    candc  &  0.02    &  0.02    &  0.01                \\
           & (0.08)   & (0.00)   & (0.17)               \\
    country 2 &-0.10  & \mc{--}  & -0.24                \\
           & (0.13)   &          & (0.17)               \\
    country 3 & 0.07  & \mc{--}  & -0.18                \\
           & (0.33)   &          & (0.26)               \\
    country 4 & 1.60^{***} & \mc{--}& 1.56^{**}         \\
           & (0.69)   &          & (0.67) \\
    \bottomrule
\end{longtable}
\lipsum
\end{document}

相关内容