
IEEEtran
私はTexLive 2022を使用して、ドキュメントクラスでLaTeXを記述します。
次のように、テーブルのセルの 1 つ (「参加者数」) に折り返されたテキストを配置したいと思います。
\documentclass[journal]{IEEEtran}
\usepackage{tabualarx,caption}
\begin{document}
\begin{table}[ht]
\renewcommand{\arraystretch}{1.25}
\captionof{table}{Participation}
\label{tab:example_MRT}
\noindent\begin{tabularx}{\linewidth} { |
c |
>{\raggedright\arraybackslash}X |
}
\hline
\textbf{The number of participants} & \textbf{Destination} \\
\hline
$1$ & A \\
\hline
$2$ & B \\
\hline
$3$ & C\\
\hline
$4$ & D\\
\hline
\end{tabularx}
\end{table}
\end{document}
しかし、結果は以下のようになります。
「参加者数」という単語を 2 行に折り返すには、どのようなコードを追加する必要がありますか?
ありがとう。
答え1
パッケージ\makecell
からそのまま使えますmakecell
\documentclass[journal]{IEEEtran}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{makecell}
\begin{document}
\begin{table}[ht]
\renewcommand{\arraystretch}{1.25}
\captionof{table}{Participation}
\label{tab:example_MRT}
\noindent\begin{tabularx}{\linewidth} { |
c |
>{\raggedright\arraybackslash}X |
}
\hline
\textbf{\makecell{The number of\\participants}} & \textbf{Destination} \\
\hline
$1$ & A \\
\hline
$2$ & B \\
\hline
$3$ & C\\
\hline
$4$ & D\\
\hline
\end{tabularx}
\end{table}
\end{document}
は無関係ですが、 とcaption
互換性がなく、テーブルのキャプション設定が壊れます。IEEEtran
\captionof