Hi,
It looks like xtable is "sanitizing" special characters in the LaTeX output by
default, by adding a double backslash, so that LaTeX will process the
characters as literals, rather than specials. It is not parsing the boundary
'$' characters to define insertion of math symbols inside text mo
You could use kable() from the knitr package.
kable(mytable, format = "latex", escape = FALSE)
\begin{tabular}{l}
\hline
$\beta_0$\\
\hline
aa\\
\hline
bb\\
\hline
cc$\alpha_1$\\
\hline
\end{tabular}
ir. Thierry Onkelinx
Statisticus / Statistician
Vlaamse Overheid / Government of Flanders
INST
I'd like to have $\alpha_1$ in my table, and the column name is $\beta_0$
library(xtable)
mytable <- data.frame(beta_0 = c("aa","bb","cc$\\alpha_1$"))
colnames(mytable) <- "$\\beta_0$"
print(xtable(mytable), include.rownames = F, sanitize.colnames.function =
identity)
No problem with \be
3 matches
Mail list logo