LaTeX - 表格上的全宽行 - 单元格占据多个单元格

问题描述

我正在尝试在 Latex 上重新创建此表: https://i.imgur.com/0Yu3rgp.png 但我不知道如何让一个单元格占据三个单元格而不是一个单元格(例如 Tritanomaly 百分比条目)。

这是迄今为止我能做到的最好的:

\usepackage{slashBox}
\usepackage[table]{xcolor}

\begin{document}

\begin{table}[h]
\centering
{\rowcolors{2}{gray!15}{gray!0}
\begin{tabular}{|l||c|c|c|}
\hline
\backslashBox{CVD}{Sex}
&Male&Female&\textbf{Any}\\\hline\hline
Deuteranomaly & 5\% & 0.35\% & 2.68\% \\\hline
Deuteranopia & 1\% & 0.1\% & 0.56\% \\\hline
Protanomaly & 1.08\% & 0.03\% & 0.55\% \\\hline
Protanopia & 1.01\% & 0.01\% & 0.51\% \\\hline
Tritanomaly* &&  0.02\% & \\ \hline
Tritanopia* && 0.01\% &\\\hline
Monochromacy* && 0.0001\% &\\\hline
\textbf{Total} & \textbf{8.12}\% & \textbf{0.52}\% & \textbf{4.32}\% \\\hline
\end{tabular}
\end{table}

\end{document}

提前致谢

解决方法

\multicolumn 是您最好的新朋友:

\documentclass{article}

\usepackage{slashbox}
\usepackage[table]{xcolor}

\begin{document}

\begin{table}[h]
\centering
\rowcolors{2}{gray!15}{gray!0}
\begin{tabular}{|l||c|c|c|}
\hline
\backslashbox{CVD}{Sex}
&Male&Female&\textbf{Any}\\\hline\hline
Deuteranomaly & 5\% & 0.35\% & 2.68\% \\\hline
Deuteranopia & 1\% & 0.1\% & 0.56\% \\\hline
Protanomaly & 1.08\% & 0.03\% & 0.55\% \\\hline
Protanopia & 1.01\% & 0.01\% & 0.51\% \\\hline
Tritanomaly* & \multicolumn{3}{c|}{0.02\%} \\ \hline
Tritanopia* &\multicolumn{3}{c|}{0.02\%}\\\hline
Monochromacy* &\multicolumn{3}{c|}{0.02\%}\\\hline
\textbf{Total} & \textbf{8.12}\% & \textbf{0.52}\% & \textbf{4.32}\% \\\hline
\end{tabular}
\end{table}

\end{document}

enter image description here