[Tex/LaTex] Table row height, text vertical center and color

colortablesvertical alignment

So I have the table in the following working example.

I used the solution at Column and row padding in tables but still the text inside each cell is not centered vertically …

Besides, I wanted to give it a fancier look like in Beamer table drop shadow but I don't seem to be able to include \rowcolors{1}{RoyalBlue!20}{RoyalBlue!5} when working with \multicolumn, same for the drop shadow.

\documentclass[ignorenonframetext, xcolor={dvipsnames,table}]{beamer}
\mode<presentation> {
\usetheme{Berkeley}
\usecolortheme{dolphin}

\usepackage{multirow}
\usepackage{pbox}
}

\begin{document}
\begin{frame}
\begin{center}
{\small
\begin{tabular}{l|c|c|c|}
    \multicolumn{1}{r}{}
        & \multicolumn{1}{c}{\textbf{\pbox{20cm}{Tissue-specific\\penetrance}}}
        & \multicolumn{1}{c}{\textbf{\pbox{20cm}{Ubiquitous\\penetrance}}}
        & \multicolumn{1}{c}{}\\
    \cline{2-4}
        \textbf{\pbox{20cm}{Tissue-specific\\expression}}
        & \textit{\pbox{20cm}{CLASS 1\\12 genes}}
        & \textit{\pbox{20cm}{CLASS 4\\8 genes}}
        & \textcolor{green!70!black}{20 genes}\\
    \cline{2-4}
        \textbf{\pbox{20cm}{Ubiquitous\\expression}}
        & \textit{\pbox{20cm}{CLASS 3\\32 genes}}
        & \textit{\pbox{20cm}{CLASS 2\\20 genes}}
        & \textcolor{pink}{52 genes}\\
    \cline{2-4}
    \cline{2-4}
        & \textcolor{red!70!black}{44 genes}
        & \textcolor{RoyalBlue}{28 genes}
        & \textbf{\pbox{20cm}{72 genes}}\\
    \cline{2-4}
\end{tabular}
}
\end{center}
\end{frame}
\end{document}

Best Answer

I'd suggest "cals" tables:

\documentclass[ignorenonframetext, xcolor={dvipsnames,table}]{beamer}
\mode<presentation> {
\usetheme{Berkeley}
\usecolortheme{dolphin}
}
\usepackage{cals}

\iffalse
\makeatletter
\let\olderow=\erow
\def\erow{\ht\cals@current@row=1.2cm \olderow}
\let\oldbrow=\brow
\def\browI{\oldbrow\def\cals@bgcolor{RoyalBlue!20}\let\brow=\browII}
\def\browII{\oldbrow\def\cals@bgcolor{RoyalBlue!5}\let\brow=\browI}
\let\brow=\browI
\fi

\begin{document}
\begin{frame}
\begin{center}
\small
\makeatletter
\begin{calstable}


\colwidths{{27mm}{27mm}{28mm}{20mm}}
\brow
\cell{}
\cell{\bfseries Tissue-specific\\penetrance}
\cell{\bfseries Ubiquitous\\penetrance}
\cell{}
\erow
\brow
\cell{\bfseries Tissue-specific\\expression}
\cell{CLASS 1\\12 genes}
\cell{CLASS 4\\8 genes}
\cell{\textcolor{green!70!black}{20 genes}}
\erow
\brow
\cell{\bfseries Ubiquitous\\expression}
\cell{CLASS 3\\32 genes}
\cell{CLASS 2\\20 genes}
\cell{\textcolor{pink}{52 genes}}
\erow
\brow
\cell{}
\cell{\textcolor{red!70!black}{44 genes}}
\cell{\textcolor{RoyalBlue}{28 genes}}
\cell{\bfseries 72 genes}
\erow
\end{calstable}
\end{center}
\end{frame}
\end{document}

The table looks good even without tuning:

Slide with a table

If you want to experiment with row colors and height, change "iffalse" to "iftrue". I have no experience with drop shadows, therefore can't recommend anything.

Related Question