我想要一个带有多行和底部规则的单元格的表格。
我试过了
\begin{tabular}{cc}
\renewcommand{\arraystretch}{1.5}
Title & \parbox{18em}{\centering A very very very very very very very very very very very very very very very long title}\\\cmidrule(lr){2-2}
SubTitle & \parbox{18em}{\centering A not that long title}\\\cmidrule(lr){2-2}
\end{tabular}
看起来效果不错。但是第二个cmidrule
距离文本稍远。
我的第一次尝试开始于
\uline\makebox[18em][c]{A very very very very very very very very very very very \\ very very very very long title}
但显然它不支持在框内断线。
我也尝试过\parbox
(\ul
在灵魂包中)但出现错误。
我认为最接近的方法是结合\framebox
,\parbox
但我不知道如何仅有底部规则。
答案1
包裹fbox
提供可选命令来fbox
决定绘制周围框的哪条边。
\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{fbox}
\begin{document}
\begin{tabular}{c>{\centering\arraybackslash}p{18em}}
\renewcommand{\arraystretch}{1.5}
Title & \fbox[b]{\parbox[t]{18em}{A very very very very very very very very very very very very very very very long title}}\\
SubTitle & \fbox[b]{A not that long title}\\
\end{tabular}
\end{document}
答案2
我不确定这是你想要实现的,但\cmidrule
可以缩短所需的量,请参阅:如何使 \cline 或 \cmidrule 变窄?
\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{c>{\centering\arraybackslash}p{18em}}
\renewcommand{\arraystretch}{1.5}
Title & A very very very very very very very very very very very very very very very long title\\\cmidrule(lr){2-2}
SubTitle & A not that long title\\\cmidrule(l{4.5em}r{4.5em}){2-2}
\end{tabular}
\end{document}