
Escrevo látex com a IEEEtran
classe 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:
\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.
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 \makecell
do makecell
pacote
\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}
Não relacionado, mas caption
não é compatível com IEEEtran
e \captionof
quebra as configurações de legenda da tabela.