
右の列のテキストを左の列のテキストに近づけたいです。同時に、現在のように長いテキストをテーブルにうまく収めたいです。この結果を実現する 1 つの方法は、左の列の幅を制限し、右の列の幅を広げ、右の列の左余白を左に移動することです。しかし、その方法がわかりません。
\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
2 番目の列の指定を から に変更し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}