表形式の環境で列の幅を制御する

表形式の環境で列の幅を制御する

右の列のテキストを左の列のテキストに近づけたいです。同時に、現在のように長いテキストをテーブルにうまく収めたいです。この結果を実現する 1 つの方法は、左の列の幅を制限し、右の列の幅を広げ、右の列の左余白を左に移動することです。しかし、その方法がわかりません。

これまでに私が得たMWEは次のとおりですテーブル:

\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{...}l2 番目の列の指定を から に変更し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} 

関連情報