下表从美观角度来看不够理想。
段落行之间的垂直间距大于表格行之间的垂直间距,例如第二行和第三行。
水平尺寸是硬编码的(两种不同的长度,即第 2+3 列和仅第 3 列)。
\documentclass{article}
\usepackage{multirow,bigdelim}
\begin{document}
\begin{table}
\begin{minipage}{\textwidth}
\renewcommand{\arraystretch}{1.1}
\begin{tabular}{lcp{0.75\textwidth}}
\texttt{aaaaaaaaa} & \multicolumn{2}{l}{\parbox[t]{0.8\textwidth}{Blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah.}}\\
\texttt{bbbbbbb} & \multicolumn{2}{l}{\parbox[t]{0.8\textwidth}{Blah blah blah
blah blah blah blah blah blah.}}\\
\texttt{ccccccccccc} & \multicolumn{2}{l}{\parbox[t]{0.8\textwidth}{Blah blah
blah blah blah blah blah blah blah blah blah blah blah.}}\\
\texttt{ddddddddd} & \multicolumn{2}{l}{\parbox[t]{0.8\textwidth}{Blah blah blah
blah blah blah blah blah blah blah blah blah.}}\\
\texttt{eeeeeeeee} & \rdelim\}{2}{0pt} & \multirow{2}{*}{%
\parbox[t]{0.75\textwidth}{Blah blah blah blah blah blah blah blah blah blah
blah blah.}}\\
\texttt{ffffffff} & & \\
\end{tabular}
\end{minipage}
\end{table}
\end{document}
有没有更好的方法?如何解决上述问题?
multirow
(关于和还有多个其他问题,multicolumn
但我没有找到一个看起来相同的问题。)
答案1
\documentclass{article}
\usepackage{array}
\usepackage{bigdelim}
\begin{document}
\begin{table}
\renewcommand{\arraystretch}{1.1}
\begin{tabular}{>{\ttfamily}lp{0.75\textwidth}}
aaaaaaaaa & Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.\\
bbbbbbb & Blah blah blah blah blah blah blah blah blah.\\
ccccccccccc & Blah blah blah blah blah blah blah blah blah blah blah blah blah.\\
ddddddddd & Blah blah blah blah blah blah blah blah blah blah blah blah.\\
eeeeeeeee &\rdelim\}{2}{0.75\textwidth}[\parbox{\dimexpr 0.75\textwidth-9pt}{Blah blah blah blah blah blah blah blah blah blah
blah blah.}] \\
ffffffff & \\
\end{tabular}
\end{table}
\end{document}
这是一个稍微自动化一些的解决方案,几乎完美地适合文本宽度,但仍然需要您根据最宽的条目明确设置第一列的宽度:
\documentclass{article}
\usepackage{array}
\usepackage{bigdelim}
\usepackage{calc}
\newlength{\myfirstcol}
\newlength{\mysecondcol}
\newlength{\mythirdcol}
\setlength{\myfirstcol}{\widthof{\texttt{ccccccccccc}}}
\setlength{\mysecondcol}{\textwidth-4\tabcolsep-\myfirstcol}
\setlength{\mythirdcol}{\mysecondcol-\widthof{$\Bigg\}$}}
\begin{document}
\begin{table}
\renewcommand{\arraystretch}{1.1}
\begin{tabular}{>{\ttfamily}wl{\myfirstcol}p{\mysecondcol}}
aaaaaaaaa & Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.\\
bbbbbbb & Blah blah blah blah blah blah blah blah blah.\\
ccccccccccc & Blah blah blah blah blah blah blah blah blah blah blah blah blah.\\
ddddddddd & Blah blah blah blah blah blah blah blah blah blah blah blah.\\
eeeeeeeee &\rdelim\}{2}{\mysecondcol}[\parbox{\mythirdcol}{Blah blah blah blah blah blah blah blah blah blah
blah blah.}] \\
ffffffff & \\
\end{tabular}
\end{table}
\end{document}
答案2
解决方案(和更简单的代码)如下tabularx
:
\documentclass{article}
\usepackage{multirow,bigdelim}
\usepackage{tabularx}
\begin{document}
\begin{table}
\setlength{\extrarowheight}{4pt}
\begin{tabularx}{\linewidth}{l@{\,}c@{}X@{}}
\texttt{aaaaaaaaa} & & Blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah.\\
\texttt{bbbbbbb} & & Blah blah blah
blah blah blah blah blah blah. \\
\texttt{ccccccccccc} & & Blah blah
blah blah blah blah blah blah blah blah blah blah blah. \\
\texttt{ddddddddd} & & Blah blah blah
blah blah blah blah blah blah blah blah blah. \\
\texttt{eeeeeeeee} & & \\
\texttt{ffffffff} & \llap{\rdelim\}{-1.6}{*}}\enspace& \multirow{-1.6}{=}{Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.} \\
\end{tabularx}
\end{table}
\end{document}
添加:获取所需内容的方法,关于大括号的对齐方式:
\begin{tabularx}{\linewidth}{l@{\,}X@{}}
\texttt{aaaaaaaaa} & Blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah.\\
\texttt{bbbbbbb} & Blah blah blah
blah blah blah blah blah blah. \\
\texttt{ccccccccccc} & Blah blah
blah blah blah blah blah blah blah blah blah blah blah. \\
\texttt{ddddddddd} & Blah blah blah
blah blah blah blah blah blah blah blah blah. \\
\texttt{eeeeeeeee} & \\
\texttt{ffffffff} & \rdelim\}{-1.6}{*}[\,\parbox{0.97\hsize}{Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.}]
\end{tabularx}
答案3
最新版本的解决方案nicematrix
(v. 5.11 2021-02-22)。括号的大小是根据单元格的内容自动计算的(无需手动调整)。
\documentclass{article}
\usepackage{multirow}
\usepackage{nicematrix}
\usepackage{bigdelim}
\begin{document}
\begin{table}
\renewcommand{\arraystretch}{1.1}
\begin{NiceTabular}{>{\ttfamily}lp{0.75\textwidth}}
aaaaaaaaa & Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.\\
bbbbbbb & Blah blah blah blah blah blah blah blah blah.\\
ccccccccccc & Blah blah blah blah blah blah blah blah blah blah blah blah blah.\\
ddddddddd & Blah blah blah blah blah blah blah blah blah blah blah blah.\\
eeeeee & \multirow{2}{=}{\advance \leftskip by 1 em Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.} \\
ffffffff & \\
\CodeAfter \SubMatrix{.}{5-1}{6-1}\}[right-xshift=2\tabcolsep]
\end{NiceTabular}
\end{table}
\end{document}
您需要多次编译(因为nicematrix
使用 PGF/Tikz 节点)。