# Vertical space between tables vspace won't work

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.

-

## migrated from stackoverflow.comAug 28 '13 at 4:09

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.SX! Your post was migrated here from another Stack Exchange site. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question –  texenthusiast Aug 28 '13 at 4:12
I couldn't reproduce your problem. Actually, I couldn't run it at all (emergency stop). –  John Kormylo Aug 28 '13 at 4:58
Your example document compiles fine for me and produces space between the tables. It still works okay when I had sections and subsections and surrounding text. Can you post a minimal working example (MWE) demonstrating the problem, e.g. using the lipsum package to fill out with some text. –  Andrew Swann Aug 28 '13 at 9:32
The lipsum package wouldn't work for some reason. I tried taking the section out of my report in to a seperate tex file and it worked fine. It's only as part of my report that I get a problem. I have got round it by using \clearpage to move them on to a new page and then vspace works. –  Jonny Phelps Aug 28 '13 at 18:08
Sorry about earlier, I missed the "\end{document}" when I made the copy. You could try replacing the \vspace{10mm} with a \rule{1pt}{10mm}. Maybe it is showing up somewhere else in your document. –  John Kormylo Aug 29 '13 at 3:25

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.

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


-

Put both tabulars into one table environment. Then your \vspace works. Everything inside of table is local, there is no need for grouping its contents:

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

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

\begin{document}

\begin{table}[h!]
\caption{MCMC mixing results for the MH within Gibbs sampler} % title of Table
\label{mix} % is used to refer this table in the text
\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
\label{mix2} % is used to refer this table in the text
\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}
\end{table}

\end{document}


-
Sorry if I sound like a grumpy old man, but is it really necessary to add an answer that doesn't add anything new compared to the existing one? –  Torbjørn T. May 4 '14 at 7:44