Latex 表格格式

Latex 表格格式

我正在尝试在 Latex 中添加如下所示的表格。有人可以帮忙吗?

桌子

以下是我所拥有的:

    \documentclass{article}
    \usepackage[table]{xcolor}
    \begin{document}
    \renewcommand{\arraystretch}{1.3}

{\columncolor{2}{green!80!yellow!50}{green!70!yellow!40}
\begin{tabular}{ |p{1cm}|p{1cm} |p{1cm}|p{1cm}|  }
\hline
\multicolumn{2}{|c|}{t = 5} \\
\hline
Selection & EC  & Selection & EC  \\
\hline
AF & AF & Selection & EC  \\
Ala    & ALA & Selection & EC  \\
\hline
\end{tabular}
}
    \end{document}

但是,这会改变行的颜色而不是列的颜色,而且我无法添加其他列。

更新:

我正在尝试 Bernerd 发布的以下代码:

\begin{tabular}{ || *{2}{>{\columncolor{blue!30!white!50}}p{1.5cm}| >{\columncolor{white}}p{1.5cm}|| }}
\hline
\rowcolor{white} \multicolumn{2}{||c|}{t = 5} & \multicolumn{2}{||c||}{t = 10}  \\
\hline
\hline
Selection & EC & Selection & EC \\
\hline
Afghan & AF & Afghan & AF\\
Aland  & ALA & Aland  & ALA \\
\hline
\end{tabular}

但是,列分隔线没有对齐!

答案1

这是你想要的吗?

\documentclass{article}%
\usepackage{geometry} 
\usepackage[table, svgnames]{xcolor}
\usepackage{hhline, booktabs}
\begin{document}

{\setlength{\arrayrulewidth}{1mm}
\setlength{\tabcolsep}{12pt}
\renewcommand{\arraystretch}{2.5}
\setlength{\aboverulesep}{0pt}
\setlength{\belowrulesep}{0pt}
\sffamily
\begin{tabular}{ |l |*{2}{>{\columncolor{green!80!yellow!50}}p{2.2cm} >{\columncolor{green!50!yellow!40}}p{2.3cm}| }}
\hline
\rowcolor{white} & \multicolumn{2}{c|}{\bfseries t = 5} & & \\
\hhline{|~|>{\arrayrulecolor{Aquamarine}}-->{\arrayrulecolor{black}}|>{\arrayrulecolor{Aquamarine}}-->{\arrayrulecolor{black}}|} 
Packet & Selection & EC & Selection & EC \\
\hhline{|~|>{\arrayrulecolor{Aquamarine}}-->{\arrayrulecolor{black}}|>{\arrayrulecolor{Aquamarine}}-->{\arrayrulecolor{black}}|}
Switching & Afghanistan & AF & Afghanistan & AF\\
\arrayrulecolor{Aquamarine}\midrule[1.2pt] \arrayrulecolor{black}
Energy & Aland Islands & ALA &Aland Islands & ALA \\
\hline
\end{tabular}
 }

 \end{document}

在此处输入图片描述

相关内容