我希望右列中的文本片段更接近左列中的文本片段。同时,我希望表格能够很好地容纳长文本片段,就像现在这样。实现此结果的一种方法是限制左列的宽度,增加右列的宽度,并将右列的左边距向左移动。但我不知道该怎么做。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\begin{tabular}{*{2}{p{.425\linewidth}}}
\toprule
first & second second second second second second second second second second\\
\midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth fourth fourth \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
感谢您的帮助。
答案1
据我理解这个问题,我会尝试
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\begin{tabular}{l p{0.5\linewidth}}
\toprule
first & second second second second second second second second second second\\
\midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth fourth fourth \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
获得
答案2
正如 @Werner 在评论中指出的那样,对于您的格式化目标,一个很好的候选解决方案是加载包tabularx
并使用tabularx
环境(将整体宽度设置为\textwidth
)而不是tabular
。然后,将第一列规范从更改为p{...}
,l
并将第二列规范从更改p{...}
为X
。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{tabularx} % for "tabularx" env. and "X" column type
\begin{document}
\begin{table}
\begin{tabularx}{\textwidth}{@{} l X @{}}
\toprule
first & second second second second second second second
second second second second second second second second \\
\midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth
fourth fourth fourth fourth \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}