![如何创建具有双线列的表格?](https://linux22.com/image/350312/%E5%A6%82%E4%BD%95%E5%88%9B%E5%BB%BA%E5%85%B7%E6%9C%89%E5%8F%8C%E7%BA%BF%E5%88%97%E7%9A%84%E8%A1%A8%E6%A0%BC%EF%BC%9F.png)
答案1
对我来说下表更合适:
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}[ht]
\centering
\caption{Caption for the table}
\label{tab:table1}
\begin{tabular}{ l r }
\toprule
Corpus & Tokens \\ \midrule
a & b \\
d & e \\
f & g \\ \midrule
total & 193,001,930 \\ \bottomrule
\end{tabular}
\end{table}
\end{document}
附录:
如果您坚持使用带有规则的表,那么hhline
包可以在双重规则中设置规则之间的距离:
\setlength\doublerulesep{0.5pt}
这使:
上图的完整MWE为:
\documentclass{article}
\usepackage{hhline}
\begin{document}
\begin{table}[h!]
\centering
\setlength\doublerulesep{0.5pt}% <-- set distance between double rule
\caption{Caption for the table}
\label{tab:table1}
\begin{tabular}{ | l | r |}
\hline
Corpus & Tokens \\ \hhline{==}
a & b \\ \hline
d & e \\ \hline
f & g \\ \hhline{==}
total & 193,001,930 \\ \hline
\end{tabular}
\end{table}
\end{document}
附录(2):
如果您喜欢以下结果:
\hhline{==}
那么您只需要用和“\hhline{|--|}”\hhline{|==|}
替换即可。\hline
答案2
您可以创建一个具有所需高度的“假”行,multicolumn
整个表格长度仅在其外部边框处有垂直线:
\documentclass{article}
\usepackage{array}
\renewcommand*{\arraystretch}{1.3}%extra vertical spacing between rows
\begin{document}
\begin{table}[h!]
\centering
\caption{Caption for the table}\label{tab:table1}
\begin{tabular}{ | l | r |}
\hline
Corpus & Tokens \\ \hline
\multicolumn{2}{|c|}{} \\[-14pt]% adjust this value according to your needs
\hline
a & b \\ \hline
d & e \\ \hline
f & g \\ \hline
\multicolumn{2}{|c|}{} \\[-14pt]% adjust this value according to your needs
\hline
total & 193,001,930 \\ \hline
\end{tabular}
\end{table}
\end{document}
答案3
您可以使用\usepackage{hhline}
和\setlength{\doublerulesep}{2pt}
(双行空间定义)。
\documentclass{article}
\usepackage{hhline}
\setlength{\doublerulesep}{2pt}
\begin{document}
\begin{table}[h!]
\centering
\caption{Caption for the table}
\label{tab:table1}
\begin{tabular}{ | l | r |}
\hline
Corpus & Tokens \\ \hhline{|=|=|}
a & b \\ \hline
d & e \\ \hline
f & g \\ \hhline{|=|=|}
total & 193,001,930 \\ \hline
\end{tabular}
\end{table}
\end{document}
更新: 用 ...: 定义行距。
\setlength{\doublerulesep}{2pt}
(感谢@Bernard 的评论。)
Bernard:只需在序言中更改 \doublerulesep 的值:大多数标准类中的默认值是 \setlength{\doublerulesep}{2pt}。