
Escribo látex con la IEEEtran
clase 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:
\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.
¿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 \makecell
del makecell
paquete.
\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}
No está relacionado pero caption
no es compatible con IEEEtran
y \captionof
rompe la configuración de los títulos de la tabla.