仅包含底部规则且表格单元格内有多行的框架框

仅包含底部规则且表格单元格内有多行的框架框

我想要一个带有多行和底部规则的单元格的表格。

我试过了

\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}

在此处输入图片描述

相关内容