texto ajustado en una celda de tabla

texto ajustado en una celda de tabla

Escribo látex con la IEEEtranclase de documento, con TexLive 2022.

Me gustaría haber ajustado el texto en una de las celdas de una tabla ("El número de participantes") de la siguiente manera:

expectativa

\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}

Sin embargo, el resultado es el siguiente.

resultado

¿Qué código se debe agregar para que las palabras "El número de participantes" puedan agruparse en dos líneas?

Gracias.

Respuesta1

Puedes usar \makecelldel makecellpaquete.

\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}

resultado

No está relacionado pero captionno es compatible con IEEEtrany \captionofrompe la configuración de los títulos de la tabla.

información relacionada