我需要使表格的边框变粗,如下图所示:
我怎样才能做到这一点?
我的代码是:
\documentclass[]{article}
\usepackage[table]{xcolor}
\begin{document}
\begingroup
\def\arraystretch{2.2}%
\begin{tabular}[]{|p{25mm}|c|c|c|}
\hline
\multicolumn{4}{|c|}{aaaaa} \\ % <===============================
\hline
\rowcolor{cyan}
1 & 1e-1 & 1e-2 & 1e-2 \\
\hline
2 & 1e-1 & 1e-2 & 1e-2 \\
\hline
3 & 1e-1 & 1e-2 & 1e-2 \\
\hline
4 & 1e-1 & 1e-2 & 1e-2 \\
\hline
5 & 1e-1 & 1e-2 & 1e-2 \\
\hline
\end{tabular}
\endgroup
\end{document}
答案1
如果我很清楚你想要什么,那么很容易boldline
:
\documentclass[]{article}
\usepackage[table]{xcolor}
\usepackage{boldline}
\begin{document}
\begingroup
\def\arraystretch{2.2}%
\begin{tabular}[]{V{4}p{25mm}|c|c|cV{4}}
\hlineB{4}
\multicolumn{4}{V{4}cV{4}}{aaaaa} \\ % <===============================
\hline
\rowcolor{cyan}
1 & 1e-1 & 1e-2 & 1e-2 \\
\hline
2 & 1e-1 & 1e-2 & 1e-2 \\
\hline
3 & 1e-1 & 1e-2 & 1e-2 \\
\hline
4 & 1e-1 & 1e-2 & 1e-2 \\
\hline
5 & 1e-1 & 1e-2 & 1e-2 \\
\hlineB{3}
\end{tabular}
\endgroup
\end{document}
答案2
一种选择是将表插入具有粗边框的 tikz 节点。
\documentclass[]{article}
\usepackage[table]{xcolor}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\renewcommand\arraystretch{2.2}%
\node[draw,ultra thick,inner sep=.4pt]{\begin{tabular}[]{|p{25mm}|c|c|c|}
\hline
\multicolumn{4}{|c|}{aaaaa} \\ % <===============================
\hline
\rowcolor{cyan}
1 & 1e-1 & 1e-2 & 1e-2 \\
\hline
2 & 1e-1 & 1e-2 & 1e-2 \\
\hline
3 & 1e-1 & 1e-2 & 1e-2 \\
\hline
4 & 1e-1 & 1e-2 & 1e-2 \\
\hline
5 & 1e-1 & 1e-2 & 1e-2 \\
\hline
\end{tabular}};
\end{tikzpicture}
\end{document}
答案3
您可以将整个内容放在tabular
里面\fbox
:
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{booktabs}
\begin{document}
\begingroup
\renewcommand\arraystretch{2.2}%
\setlength{\fboxsep}{0pt}%
\setlength{\fboxrule}{2.6pt}%
\fbox{%
\begin{tabular}{|p{25mm}|c|c|c|}
\hline
\multicolumn{4}{|c|}{aaaaa} \\
\hline
\rowcolor{cyan}
1 & 1e-1 & 1e-2 & 1e-2 \\
\hline
2 & 1e-1 & 1e-2 & 1e-2 \\
\hline
3 & 1e-1 & 1e-2 & 1e-2 \\
\hline
4 & 1e-1 & 1e-2 & 1e-2 \\
\hline
5 & 1e-1 & 1e-2 & 1e-2 \\
\hline
\end{tabular}%
}
\endgroup
\bigskip
\begin{tabular}{ p{25mm} *{3}{c} }
\toprule
\multicolumn{4}{c}{aaaaa} \\
\midrule
\rowcolor{cyan}%
1 & 1e-1 & 1e-2 & 1e-2 \\
2 & 1e-1 & 1e-2 & 1e-2 \\
3 & 1e-1 & 1e-2 & 1e-2 \\
4 & 1e-1 & 1e-2 & 1e-2 \\
5 & 1e-1 & 1e-2 & 1e-2 \\
\bottomrule
\end{tabular}
\end{document}
我更倾向于使用booktabs
摆桌子: