1

I have the following MWE for a Beamer presentation to create a simple color table:

\documentclass[xcolor={dvipsnames,table}]{beamer}

\usepackage{multicol}
\usepackage{multirow}

\usepackage{array}
\newcommand*{\arraycolor}[1]{\protect\leavevmode\color{#1}}
\newcolumntype{A}{>{\columncolor{red!20}}c}
\newcolumntype{B}{>{\columncolor{blue!20}}c}

\usepackage{makecell}

\mode<presentation> {
    \usetheme[compress]{Singapore}
    \usecolortheme{orchid}
}

\begin{document}

\begin{frame}
\centering
\sffamily
\arrayrulecolor{white}
\arrayrulewidth=1pt
\renewcommand{\arraystretch}{1}
\rowcolors[\hline]{2}{.!50!White}{}
\begin{tabular}{A|A|A|A|A|B|B|B}
    \rowcolor{.!50!Black}
    \multicolumn{5}{A}{\arraycolor{White}\bfseries {\footnotesize 14 affected subjects}} & \multicolumn{3}{B}{\arraycolor{White}\bfseries {\footnotesize 10 healthy subjects}}\\
    \rowcolor{.!60!Black}
    \multicolumn{3}{A}{\arraycolor{White} {\footnotesize Surface sampling}} & \multicolumn{2}{A}{\arraycolor{White} {\footnotesize Follicular extraction}} & \multicolumn{3}{B}{\arraycolor{White} {\footnotesize Surface sampling}}\\
    {\tiny No lesion} & {\tiny \makecell{Non-inf\\lesion}} & {\tiny Inf lesion} & {\tiny \makecell{Non-inf\\lesion}} & {\tiny Inf lesion} & {\tiny Cheek} & {\tiny Forehead} & {\tiny Nose}\\
    14 & 15 & 19 & 42 & 42 & 10 & 10 & 10\\
    \end{tabular}
\end{frame} 

\end{document}

It produces this table, which shows some problems:

figure1

There is no space between multicolumn cells, see how "Surface sampling" and "Follicular extraction" are fused together.

When using \makecell to split a cell in two lines, the cell is grayed out, see "Non-inf lesion".

The last thing is I have to change the text size of each cell one by one, but I do not seem to find a way to apply that to a whole row; see how the second row should be all \footnotesize, and the third row all \tiny.

I would appreciate if someone could help me out with these problems. Many thanks!

Troy
  • 13,741
DaniCee
  • 2,217
  • For the space between multicolumn cells, see this answer: https://tex.stackexchange.com/a/236156/117534 – Troy Jul 13 '17 at 03:30
  • Any clue about how to avoid the greying-out of cells when the text needs to be splitted in two lines? – DaniCee Nov 29 '17 at 10:58

0 Answers0