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

2020-11-06 Thread Marc Schwartz via R-help
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

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

2020-11-06 Thread Thierry Onkelinx via R-help
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

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

2020-11-06 Thread John
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