Vertical spacing in tables with math
You can insert a strut in each row, instead of acting on \arraystretch
:
\rowcolors{1}{}{RoyalBlue!20} % alternate row coloring
\newlength{\oldtabcolsep} % keep track of old \tabcolsep
\setlength{\oldtabcolsep}{\tabcolsep} % 6.0pt
\setlength{\tabcolsep}{0pt} % so coloring doesn't run off
% ends of the table
\newcommand{\mystrut}{\vrule height 20pt depth 10pt width 0pt }
\begin{tabular}
{>{\mystrut}l<{\hspace{\oldtabcolsep}}
l<{\hspace{\oldtabcolsep}}
l
}
\toprule
\multicolumn{1}{l}{Estimator\hspace*{\oldtabcolsep}} & ME & MAE \\
\specialrule{\lightrulewidth}{0pt}{0pt} % so row-coloring aligns
\(\widehat{JV}_{\text{na\"{\i}ve}}\) & 4.37e-07 & 4.37e-07 \\
\(\widetilde{JV}_{\text{na\"{\i}ve}}\) & 3.88e-07 & 3.88e-07 \\
\(\widehat{JV}\) & 1.33e-06 & 1.33e-06 \\
\(\widetilde{JV}\) & 1.20e-06 & 1.20e-06 \\
\bottomrule
\end{tabular}
Since the strut is automatically inserted in the first column, you have to correct it in the header line. Here the dimensions set for the strut are exaggerated; a perhaps satisfying setting may be
\newcommand{\mystrut}{\vrule height 3ex depth 1.5ex width 0pt }
Until now you haven't gave any feedback. Now I will switch my comment to an answer.
First of all don't use the environment center
inside the floating environment. An explanation is given in the answer: Should I use center or centering for figures
I know inside beamer figure
and co. are not floating-environment in the LaTeX meaning.
The package cellspace:
The package cellspace have a simple syntax. It provides only 2 length and a special column prefix S
.
The two length are \cellspacebottomlimit
and \cellspacetoplimit
which can be changed by \setlength
. In your example I set both length to 5pt.
\documentclass[xcolor=table,svgnames]{beamer}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{cellspace}
\begin{document}
%==============================================================================%
\begin{frame}{}
\begin{table}
\centering
\cellspacebottomlimit=5pt
\cellspacetoplimit=5pt
% \begin{center}
\rowcolors{1}{}{RoyalBlue!20} % alternate row coloring
\newlength{\oldtabcolsep} % keep track of old \tabcolsep
\setlength{\oldtabcolsep}{\tabcolsep} % 6.0pt
\setlength{\tabcolsep}{0pt} % so coloring doesn't run off
% ends of the table
\renewcommand{\arraystretch}{1.3} % because math expressions
% almost run into each other
\begin{tabular}{Sl<{\hspace{\oldtabcolsep}}l<{\hspace{\oldtabcolsep}}l}
\toprule
Estimator & ME & MAE \\
\specialrule{\lightrulewidth}{0pt}{0pt} % so row-coloring aligns
\(\widehat{JV}_{\text{na\"{\i}ve}}\) & 4.37e-07 & 4.37e-07 \\
\(\widetilde{JV}_{\text{na\"{\i}ve}}\) & 3.88e-07 & 3.88e-07 \\
\(\widehat{JV}\) & 1.33e-06 & 1.33e-06 \\
\(\widetilde{JV}\) & 1.20e-06 & 1.20e-06 \\
\bottomrule
\end{tabular}
% \end{center}
\end{table}
\end{frame}
\end{document}
The result is seen in picture below:
Note: The package cellspace
is incompatible with siunitx
. If you want to use both packages you have to create your own file Mycellspace.sty
and copy the contents of cellspace
in the new file. Now you have to change
\newcolumntype{S}[1]{>{\bcolumn #1\@nil}#1<{\ecolumn}}
to
\newcolumntype{O}[1]{>{\bcolumn #1\@nil}#1<{\ecolumn}}
You need a unknown column type.
The package tabu:
The package tabu offers more flexibility as shown below. The package provides the lengths \tabulinesep
and \extrarowsep
to control the space. In the example I set \tabulinesep=1.5mm
\documentclass[xcolor=table,svgnames]{beamer}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{tabu}
\begin{document}
%==============================================================================%
\begin{frame}{}
\begin{table}
\centering
\tabulinesep=1.5mm
\rowcolors{1}{}{RoyalBlue!20} % alternate row coloring
\newlength{\oldtabcolsep} % keep track of old \tabcolsep
\setlength{\oldtabcolsep}{\tabcolsep} % 6.0pt
\setlength{\tabcolsep}{0pt} % so coloring doesn't run off
% ends of the table
\renewcommand{\arraystretch}{1.3} % because math expressions
% almost run into each other
\begin{tabu}{l<{\hspace{\oldtabcolsep}}l<{\hspace{\oldtabcolsep}}l}
\toprule
Estimator & ME & MAE \\
\specialrule{\lightrulewidth}{0pt}{0pt} % so row-coloring aligns
\(\widehat{JV}_{\text{na\"{\i}ve}}\) & 4.37e-07 & 4.37e-07 \\
\(\widetilde{JV}_{\text{na\"{\i}ve}}\) & 3.88e-07 & 3.88e-07 \\
\(\widehat{JV}\) & 1.33e-06 & 1.33e-06 \\
\(\widetilde{JV}\) & 1.20e-06 & 1.20e-06 \\
\bottomrule
\end{tabu}
\end{table}
\end{frame}
\end{document}
The result is similar to cellspace
but it works with siunitx
: