[Tex/LaTex] Prevent tabular from jumping to next page

page-breakingtables

I am trying to get this tabular into a page that already has text in it. The table jumps to the next page and the text that was supposed to be on the next page, jumps up on the page where the table should be.

  • What should I do?

\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}

Best Answer

Rather than spend any time on trying to position the table on the current page, I'd make more of an effort to make the table more readable -- and visually appealing to your readers. For instance, load the dcolumn package and align all numbers on their respective decimal markers. While you're at it, do take the opportunity to simplify the code drastically, say along the lines shown in the following example, which contains just 1 tabular environment rather than 40 [!!].

enter image description here

\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}