I have a bizarre problem with the arrangement of a figure and table. With the following code, I get the figure and table immediately after each other with a very small gap:
\begin{figure}
\centering\includegraphics[width=0.65\textwidth,height=0.65\textwidth,keepaspectratio]{top wealth shares.png}
\caption{Top Wealth Shares}
\label{top_wealth}
\vspace{30pt}
\end{figure}
\begin{table}
\centering
\begin{tabular}{@{} *5l @{}} \toprule
\textbf{Variable} & \textbf{Mean} & \textbf{Standard Deviation} & \textbf{Non-missing observations} \\midrule
Gross Revenue (millions) & 1508.02 & 8476.63 & 266,905 \
Firm Lifespan (years) & 19.60 & 11.50 & 266,905 \
Employees (thousands) & 6.22 & 32.05 & 240,004\
Capital Investment (millions) & 111.12 & 705.21 & 251,308\ \bottomrule
\end{tabular}
\caption{Descriptive Statistics}
\label{descriptive}
\end{table}
When I change the vspace from 30pt to 35pt, suddenly a huge gap appears.
I am using the following packages:
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in,footskip=1cm}
\usepackage{float}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{setspace}
\usepackage{hyperref}
\usepackage{booktabs}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{floatrow}
\usepackage[section]{placeins}
I thought it might be placeins but when I removed that the problem was still there. Any ideas?
\vspaceat the end of afigureenvironment doesn't make sense. TeX is going to float it elsewhere in your document, so you can't know how much space you need. If you don't give TeX enough options, it ends up with a bad page break. The giveaway for that is if you have a large unbreakable block at the top of the next page. – Teepeemm Aug 31 '22 at 19:04