我得到了类似的东西
\documentclass[]{article}
\usepackage{tabularx, colortbl, booktabs}
\usepackage[table]{xcolor}
\begin{document}
\rowcolors{1}{cyan!30}{white}
\begin{table}[htbp!]
\begin{tabularx}{1\textwidth}{l*5{>{\centering\arraybackslash}X}}
\toprule
\rowcolor{cyan!60}
$l$ & 0 & 1 & 2 & 3 & 4 \\ \midrule
letter & $s$ & $p$ & $d$ & $f$ & $g$ \\
letter & $s$ & $p$ & $d$ & $f$ & $g$ \\
letter & $s$ & $p$ & $d$ & $f$ & $g$ \\
letter & $s$ & $p$ & $d$ & $f$ & $g$ \\
letter & $s$ & $p$ & $d$ & $f$ & $g$ \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
有没有简单的方法可以控制 booktabs 元素(颜色、厚度、距离……)?
答案1
\documentclass[]{article}
\usepackage[table]{xcolor}
\usepackage{booktabs, cellspace, colortbl, tabularx}
\begin{document}
\begin{table}[htbp!]
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}
\setlength\aboverulesep{0pt}
\setlength\belowrulesep{0pt}
\arrayrulecolor{blue}% select color according to your wish/taste
\rowcolors{2}{cyan!20}{white}
\begin{tabularx}{1\textwidth}{l*5{>{\centering\arraybackslash}X}}
\toprule[4pt]% <-- option for rule thicknes
\rowcolor{cyan!40}
$l$ & 0 & 1 & 2 & 3 & 4 \\ \midrule
letter & $s$ & $p$ & $d$ & $f$ & $g$ \\
letter & $s$ & $p$ & $d$ & $f$ & $g$ \\
letter & $s$ & $p$ & $d$ & $f$ & $g$ \\
letter & $s$ & $p$ & $d$ & $f$ & $g$ \\
letter & $s$ & $p$ & $d$ & $f$ & $g$ \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}