我正在用 LaTeX 写表格。但是,似乎有一个问题,左侧做得很好,但右侧在主要内容上方有一个间隙。我没有使用页眉或页脚。相反,我使用作为页眉。multicolumn{}{}{}
它看起来像这样:
___________________________________________
___________________________________________
|| Something ||
||_________________________________________||
|| <-- GAP!!!
||
|| Item #1 Item #2 ||
|| Item #3 Item #4 ||
||_________________________________________||
|| Something else ||
_____________________________________________
_____________________________________________
这张桌子比较私密,所以我尽力复制它。
\begin{center}
\begin{tabular}{||l r||}
\hline
\hline
\multicolumn{2}{||c||}{Dummy text}\\
\hline\\[2ex]
Stuff & Blah blah\\
Somethingorother & Junk text\\
Spacefiller & Prop\\[5ex]
\hline
\multicolumn{2}{||c||}{Whatever}\\
\hline
\hline
\end{tabular}
\end{center}
答案1
双垂直线中的间隙是由于行结束得太早造成的。用 替换\hline \\[2ex]
可以\hline & \\[2ex]
消除这个间隙。由于您似乎坚持保留由这个空行引入的垂直空白,因此这里有两个版本的表格。在第一个版本中,我做了上述更改,而hhline
在第二个示例中,我使用了包来改善表格角落处两条双线的交叉点:
\documentclass{article}
\usepackage{hhline}
\begin{document}
\begin{center}
\begin{tabular}{||l r||}
\hline
\hline
\multicolumn{2}{||c||}{Dummy text}\\
\hline
& \\[2ex] % <--- added the & here to remove gap in wirght double vertical line
Stuff & Blah blah\\
Somethingorother & Junk text\\
Spacefiller & Prop\\[5ex]
\hline
\multicolumn{2}{||c||}{Whatever}\\
\hline
\hline
\end{tabular}
\end{center}
\begin{center}
\begin{tabular}{||l r||}
\hhline{|t:==:t|} % <-- replaced double \hline with appropriate \hhline from hhline package
\multicolumn{2}{||c||}{Dummy text}\\
\hhline{||--||} % <-- replaced \hline with appropriate \hhline from hhline package
& \\[2ex]
Stuff & Blah blah\\
Somethingorother & Junk text\\
Spacefiller & Prop\\[5ex]
\hhline{||--||} % <-- replaced \hline with appropriate \hhline from hhline package
\multicolumn{2}{||c||}{Whatever}\\
\hhline{|b:==:b|} % <-- replaced double \hline with appropriate \hhline from hhline package
\end{tabular}
\end{center}
\end{document}
答案2
\centering
\begin{tabular}{lr}
\toprule
\rowcolor{red!20!yellow} \multicolumn{2}{c}{Dummy text}\\
\midrule
\rowcolor{gray!30} Stuff & Blah blah\\
\rowcolor{blue!30} Somethingorother & Junk text\\
\rowcolor{green!30} Spacefiller & Prop\\
\midrule
\rowcolor{red!20!yellow} \multicolumn{2}{c}{Whatever}\\
\bottomrule
\end{tabular}