[Tex/LaTex] Vertical space between tables vspace won’t work

tablesvertical alignment

I have 2 tables, one above the other. At the moment I can't make any space between them in my report. The strange thing is I moved them in to a new blank document with all the same preamble and \vspace worked. I don't really know what the problem is but it's frustrating that they are stuck together. My tables are within a subsection of a section. My preamble and table code are below:

\documentclass[a4paper,12pt,reqno]{amsart}

\usepackage{tikz}        % only needed if you include TpX drawings
\usepackage{graphicx} % only needed if you include graphics files other than TpX
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{verbatim}
\usepackage{epstopdf}
\usepackage{color}
\usepackage{pdflscape}
\usepackage[section]{placeins}
\usepackage{amsfonts}
\usepackage{xfrac}
\usepackage{mathrsfs}
\usepackage{array}
\usepackage{subfig}
\usepackage{titletoc}
\usepackage{hyperref}


\theoremstyle{definition}
\newtheorem{example}{Example}
\numberwithin{figure}{section}
\numberwithin{equation}{section}
\numberwithin{table}{section}

\newcommand{\by}{\bf y} 
\newcommand{\bx}{\bf X} 
\newcommand{\T}{\text{T}} 


\newcommand{\bb}[1]{{\bf#1}}
\newcommand{\bo}[1]{\boldsymbol{#1}}
\newcommand{\E}[1]{{\mathbb E}\left[ #1 \right]}
\newcommand{\Var}[1]{{\mathbb {V}}\left(#1 \right)}

\newcommand{\ssc}[1]{\ensuremath{^{\textrm{#1}}}}

\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\parsep}{\parskip}%
}%
\item[]}{\end{list}}

\setlength\extrarowheight{0pt}

\let\stdsection\section
\renewcommand\section{\newpage\stdsection}

\setlength\parindent{0pt}


\setcounter{tocdepth}{3}% to get subsubsections in toc

\let\oldtocsection=\tocsection

\let\oldtocsubsection=\tocsubsection

\let\oldtocsubsubsection=\tocsubsubsection

\renewcommand{\tocsection}[2]{\hspace{0em}\oldtocsection{#1}{#2}}
\renewcommand{\tocsubsection}[2]{\hspace{1em}\oldtocsubsection{#1}{#2}}
\renewcommand{\tocsubsubsection}[2]{\hspace{2em}\oldtocsubsubsection{#1}{#2}}


\begin{document}

\begin{table}[h!]
\caption{MCMC mixing results for the MH within Gibbs sampler} % title of Table
\centering % used for centering table
\bgroup
\def\arraystretch{2}
\begin{tabular}{c c c} % centered columns (4 columns)
     \bb{Response}: & \bb{ESS} (\%) & \bb{Acceptance rate} (\%) \\ \hline
     \bb{TST} & 100.0 & 52.90 \\
     \bb{WASO} & 99.90 & 56.68  \\
     \bb{N2} & 98.56 & 50.23 \\
     \bb{R} & 99.33 & 63.19  \\
\hline
\end{tabular}
\egroup
\label{mix} % is used to refer this table in the text
\end{table}
\vspace*{10mm}

\begin{table}[h!]
\caption{MCMC mixing results for the strongest and weakest models for benchmark $g$ for response \bb{TST}.} % title of Table
\centering % used for centering table
\bgroup
\def\arraystretch{2}
\begin{tabular}{c c c} % centered columns (4 columns)
     \bb{Model}: & \bb{ESS} (\%) & \bb{Acceptance rate} (\%) \\ \hline
     Strongest & 87.04 & 69.3 \\
     Weakest & 6.74 & 10.9 \\
\hline
\end{tabular}
\egroup
\label{mix2} % is used to refer this table in the text
\end{table}    

\end{document}

Any help is appreciated.

Best Answer

table is a floating environment, meaning that LaTeX can move it around, e.g. to avoid getting a large blank space at the end of page, if the table doesn't fit (for more details on how that works, see How to influence the position of float environments like figure and table in LaTeX?). For that reason, adding a \vspace between two table environments doesn't really make sense, as the they can move away from that space.

If the two tables should be placed just after one another, you can place both tabulars in the same table environment, and add the \vspace between them, inside the table. See code below.

Some other comments:

\documentclass[a4paper,12pt,reqno]{amsart}

\newcommand{\bb}[1]{\textbf{#1}}
\usepackage{lipsum}
\begin{document}

\begin{table}
\caption{MCMC mixing results for the MH within Gibbs sampler} % title of Table
\centering % used for centering table
\def\arraystretch{2}
\begin{tabular}{c c c} % centered columns (4 columns)
     \bb{Response}: & \bb{ESS} (\%) & \bb{Acceptance rate} (\%) \\ \hline
     \bb{TST} & 100.0 & 52.90 \\
     \bb{WASO} & 99.90 & 56.68  \\
     \bb{N2} & 98.56 & 50.23 \\
     \bb{R} & 99.33 & 63.19  \\
\hline
\end{tabular}

\vspace{10mm}

\caption{MCMC mixing results for the strongest and weakest models for benchmark $g$ for response \bb{TST}.} % title of Table
\begin{tabular}{c c c} % centered columns (4 columns)
     \bb{Model}: & \bb{ESS} (\%) & \bb{Acceptance rate} (\%) \\ \hline
     Strongest & 87.04 & 69.3 \\
     Weakest & 6.74 & 10.9 \\
\hline
\end{tabular}
\label{mix2} % is used to refer this table in the text
\end{table}

\end{document}

enter image description here

Related Question