Beamer:花式表中的多行

Beamer:花式表中的多行

跟进这个问题我之前问过,我面临着类似的情况,但就我而言,我似乎无法用上面问题提供的解决方案来解决问题,而且我没有任何线索......

以下是 MWE,我想要做的就是垂直合并行(多行),以便“RA 的预防影响”及其对应的“G5 车辆 UVB 40h”跨越 4 行,而“RP 的预防影响”及其对应的“G5 车辆 UVB 40h”跨越 3 行。

我该怎么做?非常感谢!!

\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|B|A}
            \rowcolor{.!50!Black}
            \arraycolor{White}\bfseries {\footnotesize Question} & \arraycolor{White}\bfseries {\footnotesize A} & \arraycolor{White}\bfseries {\footnotesize B}\\
            \bfseries {\scriptsize UVB impact on primary keratinocytes} & {\scriptsize G5 vehicle UVB 40h} & {\scriptsize G6 vehicle noUVB 40h}\\
            \bfseries {\scriptsize Preventative impact of RA} & {\scriptsize G1 RA\_1nM UVB 40h} & {\scriptsize G5 vehicle UVB 40h}\\
            & {\scriptsize G1 RA\_10nM UVB 40h} &\\
            & {\scriptsize G1 RA\_100nM UVB 40h} &\\
            & {\scriptsize G1 RA\_1$\mu$M UVB 40h} &\\
            \bfseries {\scriptsize Preventative impacts of RP} & {\scriptsize G2 RP\_0.1$\mu$M UVB 40h} & {\scriptsize G5 vehicle UVB 40h}\\
            & {\scriptsize G2 RP\_1$\mu$M UVB 40h} &\\
            & {\scriptsize G2 RP\_10$\mu$M 40h} &\\
        \end{tabular}
    }%
\end{frame} 

\end{document}

测试

答案1

具有(≥ 6.1 {NiceTabular}nicematrix截至 2021-08-20)。

\documentclass[xcolor={dvipsnames}]{beamer}
\usepackage{nicematrix}

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

\begin{document}

\begin{frame}
\begin{center}
\sffamily
\renewcommand{\arraystretch}{1.4}
\tiny
\begin{NiceTabular}
  [
    rules = {color=white,width=2pt} ,
    hvlines-except-borders ,
    cell-space-limits=3pt,
  ]
  {>{\bfseries}ccc}
\CodeBefore
  \rowcolors{2}{red!20}{red!10}[cols={1,3},respect-blocks]
  \rowcolors{2}{blue!20}{blue!10}[cols=2]
  \cellcolor{red!50!black}{1-1,1-3}
  \cellcolor{blue!50!black}{1-2}
\Body
  \RowStyle[color=White]{\footnotesize}
  Question                                & \bfseries A           & \bfseries B \\
  UVB impact on primary keratinocytes     & G5 vehicle UVB 40h    & G6 vehicle noUVB 40h \\
  \Block{4-1}{Preventative impact of RA}  & G1 RA\_1nM UVB 40h    & \Block{4-1}{G5 vehicle UVB 40h} \\
                                          & G1 RA\_10nM UVB 40h   \\
                                          & G1 RA\_100nM UVB 40h  \\
                                          & G1 RA\_1$\mu$M UVB 40h  \\
  \Block{3-1}{Preventative impacts of RP} & G2 RP\_0.1$\mu$M UVB 40h & \Block{3-1}{G5 vehicle UVB 40h} \\
                                          & G2 RP\_1$\mu$M UVB 40h  \\
                                          & G2 RP\_10$\mu$M 40h     \\
\end{NiceTabular}
\end{center}
\end{frame} 

\end{document}  

您需要多次编译(因为nicematrix在后台使用 PGF/Tikz 节点)。

上述代码的输出

相关内容