Still dealing with fancy tables, now I am trying to get one with multicolumn and multirow cells.
I can get multicolumn cells right, but I am still struggling with multirow ones.
MWE in Beamer:
\documentclass[xcolor={dvipsnames,table}]{beamer}
%%TABLE
\usepackage{multirow}
\newcommand*{\arraycolor}[1]{\protect\leavevmode\color{#1}}
\newcolumntype{A}{>{\columncolor{red!20}}c}
\newcolumntype{B}{>{\columncolor{blue!20}}c}
\mode<presentation> {
\usetheme[compress]{Singapore}
\usecolortheme{orchid}
}
\begin{document}
\begin{frame}
\sffamily
\arrayrulecolor{white}
\arrayrulewidth=1pt
\renewcommand{\arraystretch}{1}
\rowcolors[\hline]{2}{.!50!White}{}
\resizebox{\linewidth}{!}{%
\begin{tabular}{A|A|A|A|A|B|B|B|A}
\rowcolor{.!50!Black}
\multicolumn{5}{A|}{\arraycolor{White}\bfseries 14 subjects} &
\multicolumn{3}{B|}{\arraycolor{White}\bfseries 10 subjects} &
\multirow{2}{*}{\arraycolor{White}\bfseries Control}\\
\rowcolor{.!50!Black}
\multicolumn{3}{A|}{\arraycolor{White} Surface} &
\multicolumn{2}{A|}{\arraycolor{White} Follicle} &
\multicolumn{3}{B|}{\arraycolor{White} Surface} & \\
No les & Non-inf & Inf & Non-inf & Inf & Cheek & Fh & Nose & Mock\\
\end{tabular}
}%
\end{frame}
\end{document}
I need to make the "Control" cell span 2 rows properly, is it possible? Thanks!
EDIT!
I looked at the answers in the possible duplicate question suggested, but I still do not seem to get it right... I feel like it is almost there though.
Please check my updated MWE below:
\documentclass[xcolor={dvipsnames,table}]{beamer}
%%TABLE
\usepackage{makecell, multirow}
\renewcommand\theadfont{\arraycolor{White}\bfseries}
\newcommand*{\arraycolor}[1]{\protect\leavevmode\color{#1}}
\newcolumntype{A}{>{\columncolor{red!20}}c}
\newcolumntype{B}{>{\columncolor{blue!20}}c}
\mode<presentation> {
\usetheme[compress]{Singapore}
\usecolortheme{orchid}
}
\begin{document}
\begin{frame}
\sffamily
\arrayrulecolor{white}
\arrayrulewidth=1pt
\renewcommand{\arraystretch}{1}
\rowcolors[\hline]{2}{.!50!White}{}
\resizebox{\linewidth}{!}{%
\begin{tabular}{A|A|A|A|A|B|B|B|A}
\rowcolor{.!50!Black}
\multicolumn{5}{A|}{\arraycolor{White}\bfseries 14 subjects} &
\multicolumn{3}{B|}{\arraycolor{White}\bfseries 10 subjects} & \\
\rowcolor{.!50!Black}
\multicolumn{3}{A|}{\arraycolor{White} Surface} &
\multicolumn{2}{A|}{\arraycolor{White} Follicle} &
\multicolumn{3}{B|}{\arraycolor{White} Surface} &
\multirow{-2}{*}{\thead{Control}}\\
No les & Non-inf & Inf & Non-inf & Inf & Cheek & Fh & Nose & Mock\\
\end{tabular}
}%
\end{frame}
\end{document}
Which produces:
\multirow{2}...
in the first, but\multirow{-2}...
in the second line. This way "Control" isn't covered by the effects of\rowcolor
. The white line between the cells isn't covered this way.multicol
package.>{\hsize=\hsize\tabcolsep\arrayrulewidth\relax}
instructions do? If I'm not mistaken, removing those doesn't make a difference.\multirow{-2}
in the second line, I still observe the line break, and "Control" isn't aligned vertically in the center of the double cell anymore...