我的文档中有下表:
\documentclass[12pt]{article}
\usepackage{tabu}
\begin{document}
\[
\begin{tabu} {c | c c c c c c}
\firsthline
f & a_{11} & a_{12} & a_{21} & a_{22} & b_1 & b_2 \\ \hline
1 & a_{11}^1 & a_{12}^1 & a_{21}^1 & a_{22}^1 & b_1^1 & b_2^1 \\
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\
n & a_{11}^n & a_{12}^n & a_{21}^n & a_{22}^n & b_1^n & b_2^n \\
\lasthline
\end{tabu}
\]
\end{document}
第二行和最后一行距离水平线有点太近了。我该如何在它们之间增加一些空间?
更新:我尝试\tabulinesep=5pt
在序言中使用,看起来更好。
但是,vdots
现在似乎放置得太靠下,并且lasthline
不再显示为“粗体”。我该如何修复这个问题?
答案1
我可能会用array
这个但无论如何都\extrarowheight
可以使用相同的参数:
\documentclass[12pt]{article}
\usepackage{tabu}
\begin{document}
a
\[
\begin{tabu} {c | c c c c c c}
\firsthline
f & a_{11} & a_{12} & a_{21} & a_{22} & b_1 & b_2 \\ \hline
1 & a_{11}^1 & a_{12}^1 & a_{21}^1 & a_{22}^1 & b_1^1 & b_2^1 \\
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\
n & a_{11}^n & a_{12}^n & a_{21}^n & a_{22}^n & b_1^n & b_2^n \\
\lasthline
\end{tabu}
\]
b
\[\setlength\extrarowheight{2pt}
\begin{tabu} {c | c c c c c c}
\firsthline
f & a_{11} & a_{12} & a_{21} & a_{22} & b_1 & b_2 \\ \hline
1 & a_{11}^1 & a_{12}^1 & a_{21}^1 & a_{22}^1 & b_1^1 & b_2^1 \\
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\
n & a_{11}^n & a_{12}^n & a_{21}^n & a_{22}^n & b_1^n & b_2^n \\
\lasthline
\end{tabu}
\]
\end{document}
答案2
tabu
这样做的方法是使用\tabulinesep
。摘自手册:
应用于您的代码(具有很大的演示空间)
\documentclass[12pt]{article}
\usepackage{tabu}
\begin{document}
\[\tabulinesep=1cm %<--------------------------adjust 1cm
\begin{tabu} {c | c c c c c c}
\firsthline
f & a_{11} & a_{12} & a_{21} & a_{22} & b₁ & b₂ \\ \hline
1 & a_{11}¹ & a_{12}¹ & a_{21}¹ & a_{22}¹ & b₁¹ & b₂¹ \\
⋮ & ⋮ & ⋮ & ⋮ & ⋮ & ⋮ & ⋮ \\
n & a_{11}^n & a_{12}^n & a_{21}^n & a_{22}^n & b₁^n & b₂^n \\
\lasthline
\end{tabu}
\]
\end{document}