表のヘッダータイトルを分割する方法

表のヘッダータイトルを分割する方法

表内のヘッダータイトルを分割するにはどうすればよいでしょうか?

\begin{table}[H]
\begin{tabular}[h]{|p{2cm}||p{2cm}} 
\hline
{title one} & {title two}   \\ \hline\hline
\end{tabular}
\caption{title}
\end{table}

ありがとう。

答え1

行変更コマンドでは esを使用できます\parbox。ボックス内では、\centering を使用してコンテンツを中央揃えにすることができます。

\documentclass{article}

\begin{document}

\begin{table}
\centering
\begin{tabular}{|p{2cm}|p{2cm}|} 
\hline
\parbox[t]{2cm}{\centering title \\ one} & \parbox[t]{2cm}{\centering title \\ two} \\[3ex]
some text & some text \\
some text & some text \\
\hline
\end{tabular}
\caption{title}
\end{table}

\end{document}

ここに画像の説明を入力してください

縦罫線は視覚的な参照点として使用しました。ちなみに、列が狭い場合は、不揃いに設定することを検討してください。

関連情報