[R] backslash in xtable (generate latex code from R)

John m|@ojpm @end|ng |rom gm@||@com
Fri Nov 6 13:39:31 CET 2020

I'd like to have $\alpha_1$ in my table, and the column name is $\beta_0$
mytable <- data.frame(beta_0 = c("aa","bb","cc$\\alpha_1$"))
colnames(mytable) <- "$\\beta_0$"
print(xtable(mytable), include.rownames = F, sanitize.colnames.function =

No problem with \beta_0, but a problem with \alpha_1:

$\beta_0$ \\
aa \\
  bb \\
  cc\$$\backslash$alpha\_1\$ \\

How may I fix the $\alpha_1$? Thanks!

	[[alternative HTML version deleted]]

More information about the R-help mailing list