texto quebrado em uma célula da tabela

texto quebrado em uma célula da tabela

Escrevo látex com a IEEEtranclasse document, com TexLive 2022.

Gostaria de quebrar o texto em uma das células de uma tabela ("O número de participantes") da seguinte forma:

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}

No entanto, o resultado é o seguinte.

resultado

Que código precisa ser adicionado para que as palavras “Número de participantes” possam ser agrupadas em duas linhas?

Obrigado.

Responder1

Você pode usar \makecelldo makecellpacote

\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

Não relacionado, mas captionnão é compatível com IEEEtrane \captionofquebra as configurações de legenda da tabela.

informação relacionada