我有一个表格,其中有一列包含跨多行的较长描述。因此我使用列类型p
,这要求我指定固定的列宽。是否可以这样指定列,使表格列简单地“抓取”所有可用的水平空间?
\documentclass[ngerman]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
% I would like to avoid hard coding the column width here
\begin{tabular}{l p{5cm}}
column 1 & column 2 \\
name & The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. \\
\end{tabular}
\end{document}
答案1
尝试表格型包裹:
\usepackage{tabularx}
...
\begin{tabularx}{\linewidth}{l X}
...
\end{tabularx}
列类型X
提供您所需要的内容。