
表のセルに (varwidth) ボックスを挿入し、ボックスのサイズをその列の自動サイズに合わせて幅を制限し、ボックスに挿入するテキストをその幅で折り返すようにしたいと考えています。
最初はこんなことをしたいと思っていました
\begin{tabular}{ccc}
Column 1 & Column 2 & Column 3\tabularnewline
stuff &
\begin{varwidth}{\columnwidth}
This text should be wrapped to the width of the column
but instead it makes the entire column extremely wide
\end{varwidth}
& stuff\tabularnewline
some other stuff & some other stuff & some other stuff\tabularnewline
\end{tabular}
テキストを挿入したいセルにミニページを配置しましたvarwidth
が、\columnwidth は、ページの最終的なレイアウト方法に関して列の幅のみを反映しているようで、個々のテーブル列の推奨幅は反映していません。さらに悪いことに、この例ではテーブルが右余白を超えてオーバーフローします。
私の要件が不明瞭な場合は事前にお詫び申し上げますが、具体的な質問がある場合は、すぐに対応し、この質問のテキストを適切に明確にするよう努めます。
答え1
以下は、最も幅の広いエントリを手動で決定する必要があるため、実際には自動ではありませんが、説明した内容に近いものが得られる可能性があります。
\documentclass{article}
\usepackage{calc}
\usepackage{ragged2e}
\usepackage{array}
\newcolumntype{C}[1]{>{\Centering\arraybackslash\hspace{0pt}}p{#1}}
\begin{document}
\begin{tabular}{cC{\widthof{some other stuff}}c}
Column 1 & Column 2 & Column 3\tabularnewline
stuff &
This text should be wrapped to the width of the column
but instead it makes the entire column extremely wide
& stuff\tabularnewline
some other stuff & some other stuff & some other stuff\tabularnewline
\end{tabular}
\end{document}