答案1
我建议使用booktabs
这种类型的表的包。如需进一步了解,请查看手动的。
\documentclass[varwidth=\maxdimen]{standalone}
\usepackage{booktabs,multirow}
\begin{document}
\begin{table}[htbp!]
\begin{tabular}{@{}lllll@{}}
\toprule
\multirow{2}{*}{\textbf{Heat transfer resistance}} & \multicolumn{4}{c}{\textbf{Direction of heat flow rate}} \\ \cmidrule{2-5}
& upward & horizontal & downward & contact with ground \\ \midrule
R\_\{si\} & 0.1 & 0.13 & 0.17 & 0 \\
R\_\{se\} & 0.04 & 0.04 & 0.04 & 0 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
此外,还有其他双方,您可以在其中生成此类复杂的表格。
编辑
如果您同意@egreg,我稍微修改了代码。
\documentclass[varwidth=\maxdimen]{standalone}
\usepackage{booktabs,multirow}
\begin{document}
\begin{table}[htbp!]
\begin{tabular}{@{}lllll@{}}
\toprule
& \multicolumn{4}{c}{\textbf{Direction of heat flow rate}} \\ \cmidrule(l){2-5}
\textbf{Heat transfer resistance} & upward & horizontal & downward & contact with ground \\ \midrule
R\_\{si\} & 0.1 & 0.13 & 0.17 & 0 \\
R\_\{se\} & 0.04 & 0.04 & 0.04 & 0 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案2
tabularx
另一种解决方案是 基于booktabs
和 hhline
:
\documentclass{article}
\usepackage{geometry}
\usepackage[table, svgnames]{xcolor}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{hhline}
\newcommand{\vblack}{>{\arrayrulecolor{black}}|>{\arrayrulecolor{Gainsboro}}}
\renewcommand{\tabularxcolumn}[1]{>{\raggedleft\arraybackslash}m{#1}}
\begin{document}
\begin{table}[!ht]
\setlength{\tabcolsep}{4pt}
\setlength{\aboverulesep}{0pt}
\setlength{\belowrulesep}{0pt}
\centering\sffamily
\begin{tabularx}{\linewidth}{!{\color{Gainsboro}\vrule}l!{\vrule width 0.05em} >{\hsize=0.8\hsize}X!{\color{Gainsboro}\vrule}>{\hsize=0.95\hsize}X!{\color{Gainsboro}\vrule}>{\hsize=1.05\hsize}X!{\color{Gainsboro}\vrule}>{\hsize=1.2\hsize}X|}
\arrayrulecolor{Gainsboro}\toprule[0.3pt]\arrayrulecolor{black}
& \multicolumn{4}{c|}{\bfseries Direction of heat flow rate} \\[-0.08em]
\cmidrule[0.05em]{2-5}
\bfseries Heat transfer resistance & \makecell[lb]{upward} & \makecell[lb]{horizontal} & \makecell[lb]{downward} & \makecell[lb]{\rlap{contact with ground}} \\
\midrule[0.08em]
R\_{si} & 0.1\phantom{0} & 0.13 & 0.17 & 0 \\
\arrayrulecolor{Gainsboro}
\hhline{|->{\arrayrulecolor{black}}|>{\arrayrulecolor{Gainsboro}}-|-|-|->{\arrayrulecolor{black}}|} %\midrule
R\_{se} & 0.04 & 0.04 & 0.04 & 0 \\
\arrayrulecolor{black} \midrule
\end{tabularx}
\end{table}
\end{document}
答案3
我会避免使用那些没有任何用处并且实际上会妨碍阅读的垂直规则。
我们可以把第一个标题分成两行来节省一些空间。
使用siunitx
特征可以更好地定位图形。
\documentclass{article}
\usepackage{booktabs,siunitx}
\newcommand{\doubleheader}[1]{%
\smash{\begin{tabular}[t]{@{}c@{}}#1\end{tabular}}%
}
\begin{document}
\begin{tabular}{
@{}
l
*{3}{S[table-format=1.2]}
S[table-format=1.0]
@{}
}
\toprule
\doubleheader{Heat transfer \\ resistance} &
\multicolumn{4}{c}{Direction of heat flow rate} \\
\cmidrule(l){2-5}
& {upward} & {horizontal} & {downward} & {contact with ground} \\
\midrule
$R_{\mathrm{si}}$ & 0.1 & 0.13 & 0.17 & 0 \\
$R_{\mathrm{se}}$ & 0.04 & 0.04 & 0.04 & 0 \\
\bottomrule
\end{tabular}
\end{document}