
Intenté centrar pero no funcionó:
\begin{longtabu}{|r|r|} %\textwidth
\hline
\centering \boldmath $X$ & \centering \boldmath $Y$ \tabularnewline
\hline
$-9.644$ & $93.000$ \\
\hline
$1.997$ & $3.988$ \\
\hline
\end{longtabu}
Respuesta1
Respuesta2
Lo habitual \multicolumn{1}{<alignment>}{<content>}
puede ayudar. Además, utilícelo \mathbf{X}
para obtenerX
negrita en modo matemático en lugar de \boldmath X
. Además, en lugar de cambiar manualmente al modo matemático en cada celda, >{$} r <{$}
será suficiente la especificación en el encabezado.
\documentclass{article}
\usepackage{longtable,tabu}
\begin{document}
\begin{longtabu}{| >{$}r<{$} | >{$}r<{$} |} %\textwidth
\hline
\multicolumn{1}{|c|}{$\mathbf{X}$} & \multicolumn{1}{c|}{$\mathbf{Y}$} \\
\hline
-9.644 & 93.000 \\
\hline
1.997 & 3.988 \\
\hline
\end{longtabu}
\end{document}
Respuesta3
Utilice tabu
el \rowfont [alignment]{font spec}
comando:
\documentclass{article}
\usepackage{tabu}
\begin{document}
\begin{tabu} to 15em {| X[r] | X[r] |} \hline
\everyrow{\hline}
\rowfont[c]{\bfseries}
X & Y \\
-9.644 & 93.000 \\
1.997 & 3.988 \\
\end{tabu}
\end{document}
(Si no desea que la primera línea esté en negrita, puede usar \rowfont[c]{}
, por supuesto).
Desafortunadamente, \rowfont[c]
parece ignorado cuando está en modo matemático, no entiendo por qué. Pero si no necesita el modo matemático, en mi humilde opinión es la solución más simple y bonita.