[Tex/LaTex] Table too tall for page

spacingtables

I have a table that is slightly too tall to fit on the same page as the section header. I would like to know the best way to make the table fit, without affecting margin spacing elsewhere in the document. That is, I'd like the solution to only affect this page, and not others. I would also like to avoid shrinking the table, as I think there is room enough for the table to fit. Here is a minimum working example:

\documentclass[letterpaper,12pt]{article}
\usepackage{geometry}
\geometry{verbose,letterpaper,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
\usepackage{booktabs}

\begin{document}

 \section{Using Unallocated Census Data} \label{app:Unallocated}

%This table fits on the page with the title.

\begin{table}[h]
\caption{Effects of Merit Aid Eligibility, Ages 24 to 32, Omitting Allocated Data}  \label{tab:Unallocated}
\begin{center}
\small
\begin{tabular}{lccccc}

\toprule
 & (1) & (2) & (3) & (4) & (5) \\
\midrule
Outcome & & & \multicolumn{2}{c}{Merit \&} & \\
& \multicolumn{2}{c}{All States}  &  \multicolumn{2}{c}{Southern States}  & Merit States \\
 \cmidrule(lr){2-3} \cmidrule(lr){4-5}\cmidrule(lr){6-6}


 Living In-State & -0.005 & 0.005 & 0.007 & 0.008 & 0.006 \\
 & (0.009) & (0.007) & (0.007) & (0.007) & (0.008) \\
 \\
 Living In-State w/ BA & -0.003 & 0.002 & 0.002 & 0.003 & 0.002 \\
 & (0.003) & (0.003) & (0.003) & (0.004) & (0.004) \\
 \\
 Living In-State w/ Some College & 0.003 & 0.006 & 0.008* & 0.008* & 0.006 \\
 & (0.005) & (0.004) & (0.004) & (0.005) & (0.005) \\
 \\
 BA Degree & -0.003 & -0.001 & -0.001 & -0.002 & -0.002 \\
 & (0.003) & (0.003) & (0.003) & (0.003) & (0.003) \\
 \\
 Some College Attendance & 0.006 & 0.001 & 0.002 & 0.001 & 0.000 \\
 & (0.005) & (0.004) & (0.004) & (0.004) & (0.004) \\
 \\
 Currently Enrolled in College & 0.005*** & 0.003*** & 0.003* & 0.003** & 0.004** \\
 & (0.002) & (0.001) & (0.002) & (0.001) & (0.001) \\
 \\
 Currently Enrolled in College In-State & 0.005** & 0.005*** & 0.003 & 0.006*** & 0.006*** \\
 & (0.002) & (0.002) & (0.003) & (0.002) & (0.002) \\
 \midrule
$N$ & 5,049 & 5,049 & 2,178 & 2,178 & 1,485 \\ 
Trend & N & Y & N & Y & N \\

\bottomrule

\end{tabular}  
\end{center}
\footnotesize Note: 
Includes unallocated 2000 Decennial and 2001-2010 ACS survey data at the state-cohort-year level. The dependent variable is the share of a cohort born in a state and aged 24 to 32 at the time of the survey for whom the designated outcome
is true. Each regression includes state, year, cohort and age fixed effects. Where indicated, the regression also includes a trend in year of birth relative to the year the first treated cohort was born for states with merit aid programs. Regressions are weighted by the number of observations in the given state-cohort-year cell. Standard errors are clustered at the state level. ***, ** and * indicate statistically significant coefficients at the one, five and ten percent levels respectively.
 \end{table}

\clearpage

%This Time, the Table doesn't fit

 \section{Using Unallocated Census Data} \label{app:Unallocated}

\begin{table}[h]
\caption{Effects of Merit Aid Eligibility, Ages 24 to 32, Omitting Allocated Data}  \label{tab:Unallocated}
\begin{center}
\small
\begin{tabular}{lccccc}

\toprule
 & (1) & (2) & (3) & (4) & (5) \\
\midrule
Outcome & & & \multicolumn{2}{c}{Merit \&} & \\
& \multicolumn{2}{c}{All States}  &  \multicolumn{2}{c}{Southern States}  & Merit States \\
 \cmidrule(lr){2-3} \cmidrule(lr){4-5}\cmidrule(lr){6-6}


 Living In-State & -0.005 & 0.005 & 0.007 & 0.008 & 0.006 \\
 & (0.009) & (0.007) & (0.007) & (0.007) & (0.008) \\
 \\
 Living In-State w/ BA & -0.003 & 0.002 & 0.002 & 0.003 & 0.002 \\
 & (0.003) & (0.003) & (0.003) & (0.004) & (0.004) \\
 \\
 Living In-State w/ Some College & 0.003 & 0.006 & 0.008* & 0.008* & 0.006 \\
 & (0.005) & (0.004) & (0.004) & (0.005) & (0.005) \\
 \\
 BA Degree & -0.003 & -0.001 & -0.001 & -0.002 & -0.002 \\
 & (0.003) & (0.003) & (0.003) & (0.003) & (0.003) \\
 \\
 Some College Attendance & 0.006 & 0.001 & 0.002 & 0.001 & 0.000 \\
 & (0.005) & (0.004) & (0.004) & (0.004) & (0.004) \\
 \\
 Currently Enrolled in College & 0.005*** & 0.003*** & 0.003* & 0.003** & 0.004** \\
 & (0.002) & (0.001) & (0.002) & (0.001) & (0.001) \\
 \\
 Currently Enrolled in College In-State & 0.005** & 0.005*** & 0.003 & 0.006*** & 0.006*** \\
 & (0.002) & (0.002) & (0.003) & (0.002) & (0.002) \\
 \midrule
 \\ % By adding this additional vertical space, we get pushed to the next page.
$N$ & 5,049 & 5,049 & 2,178 & 2,178 & 1,485 \\ 
Trend & N & Y & N & Y & N \\    
\bottomrule

\end{tabular}  
\end{center}
\footnotesize Note: 
Includes unallocated 2000 Decennial and 2001-2010 ACS survey data at the state-cohort-year level. The dependent variable is the share of a cohort born in a state and aged 24 to 32 at the time of the survey for whom the designated outcome
is true. Each regression includes state, year, cohort and age fixed effects. Where indicated, the regression also includes a trend in year of birth relative to the year the first treated cohort was born for states with merit aid programs. Regressions are weighted by the number of observations in the given state-cohort-year cell. Standard errors are clustered at the state level. ***, ** and * indicate statistically significant coefficients at the one, five and ten percent levels respectively.
 \end{table}

\end{document}

As you can see, the first table fits on the page with the section title. There seems to be plenty of space below the table. The second table has one additional line, which I've highlighted in the code. Now, the table and the section title cannot coexist on the same page. In practice, this table will be a part of an entire document, where the margin spacing is fine everywhere else. So, I would like a solution that does not affect the margin spacing globally.

If possible, I would not like to affect the size of the visual parts of the table, i.e., the font size, etc., so that it is consistent with the rest of the tables in the document. In other words, I see empty space between the end of the table note and the page number, and I believe some invisible part (bounding box?) of the table is running up against a spacing constraint. I would like to perhaps relax that constraint, without having to actually shrink the visible parts of the table.

Best Answer

I have two suggestions, not ranked in any order. Implementing either suggestion should save more than enough vertical whitespace to make the sectioning header and the table both fit on a single page.

  • Don't use \begin{center} ... \end{center}, because the center environment introduces a lot of vertical whitespace. Instead, use a \centering directive. You might have something like the following instructions near the top of the table

    \caption{Effects of Merit Aid Eligibility, Ages 24 to 32, Omitting Allocated Data}  
    \label{tab:Unallocated}
    
    \medskip     % introduce some vertical whitespace (but not as much as center env. does)
    \bgroup      % start a "group" to contain scope of next two statements
    \centering
    \small
    

    and the following statements close to the bottom of the table:

    \bottomrule
    \end{tabular}  
    \egroup         % end of scope of \centering and \small
    
    \medskip        % some vertical separation to the footnoty stuff
    \footnotesize Note: 
    

    Separately, you may have noticed that the table is currently wider (by a tiny amount) than \textwidth; hence, neither the center environment nor the \centering directive actually have an effect. A suggestion on how to overcome this is provided below.

  • The amount of vertical whitespace between each of the groups of two rows is quite generous. Instead of a full blank line, you might employ a bit less vertical space by stating it explicitly as follows

    \\[1.25ex]  % a full blank line is equivalent to \\[1\baselineskip] ...
    
  • The following example implements both ideas, i.e., it doesn't use the center environment, and it uses 1.25ex as the amount of whitespace between groups of two rows. With these two adjustments in place, the table now fits very comfortably in the page.

    It also fixes the issue that the table is wider than the textblock. The fix comes in two parts: First, I omit the horizontal whitespace to the left of the first column and to the right of the final column. This actually makes the table ever so slightly less wide than the textblock. Centering such a table looks a bit like an accident. Thus, in a second step, I replace the tabular environment with a tabular* environment of width \textwidth, inserting the at first odd-looking expression @{\extracolsep{\fill}} in the specification of the tabular* environment; as its name (hopefully) suggests, this directive tells LaTeX to insert a bit of "stretchable" whitespace (\fill) between columns, thus making the entire table exactly as wide as \textwidth.

enter image description here

\documentclass[letterpaper,12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{booktabs}

\begin{document}

\section{Using Unallocated Census Data} 
\label{app:Unallocated}

\begin{table}[h]
\caption{Effects of Merit Aid Eligibility, Ages 24 to 32, Omitting Allocated Data}  
\label{tab:Unallocated}

\medskip

\small
\begin{tabular*}{\textwidth}{@{} l @{\extracolsep{\fill}} ccccc @{}}
\toprule
Outcome & (1) & (2) & (3) & (4) & (5) \\
\midrule
 & & & \multicolumn{2}{c}{Merit \&} & \\
& \multicolumn{2}{c}{All States}  &  \multicolumn{2}{c}{Southern States}  & Merit States \\
 \cmidrule(lr){2-3} \cmidrule(lr){4-5}\cmidrule(l){6-6}
Living In-State & -0.005 & 0.005 & 0.007 & 0.008 & 0.006 \\
 & (0.009) & (0.007) & (0.007) & (0.007) & (0.008) \\[1.25ex]
Living In-State w/ BA & -0.003 & 0.002 & 0.002 & 0.003 & 0.002 \\
 & (0.003) & (0.003) & (0.003) & (0.004) & (0.004) \\[1.25ex]
Living In-State w/ Some College & 0.003 & 0.006 & 0.008* & 0.008* & 0.006 \\
 & (0.005) & (0.004) & (0.004) & (0.005) & (0.005) \\[1.25ex]
BA Degree & -0.003 & -0.001 & -0.001 & -0.002 & -0.002 \\
 & (0.003) & (0.003) & (0.003) & (0.003) & (0.003) \\[1.25ex]
Some College Attendance & 0.006 & 0.001 & 0.002 & 0.001 & 0.000 \\
 & (0.005) & (0.004) & (0.004) & (0.004) & (0.004) \\[1.25ex]
 Currently Enrolled in College & 0.005*** & 0.003*** & 0.003* & 0.003** & 0.004** \\
 & (0.002) & (0.001) & (0.002) & (0.001) & (0.001) \\[1.25ex]
 Currently Enrolled in College In-State & 0.005** & 0.005*** & 0.003 & 0.006*** & 0.006*** \\
 & (0.002) & (0.002) & (0.003) & (0.002) & (0.002) \\
 \midrule
Sample Size & 5,049 & 5,049 & 2,178 & 2,178 & 1,485 \\ 
Trend & N & Y & N & Y & N \\
\bottomrule
\end{tabular*}  

\medskip
\footnotesize 
\emph{Notes}: 
Includes unallocated 2000 Decennial and 2001--2010 ACS survey data at the state-cohort-year level. The dependent variable is the share of a cohort born in a state and aged 24 to 32 at the time of the survey for whom the designated outcome is true. 

Each regression includes state, year, cohort and age fixed effects. Where indicated, the regression also includes a trend in year of birth relative to the year the first treated cohort was born for states with merit aid programs. Regressions are weighted by the number of observations in the given state-cohort-year cell. 

Standard errors are clustered at the state level. 

***, ** and * indicate statistically significant coefficients at the 1, 5, and 10 percent levels, respectively.
\end{table}

\end{document}