[R] xtable and column headings

Ian Kennedy ian_kennedy at hc-sc.gc.ca
Thu Feb 1 15:52:02 CET 2007

When I generate a LaTeX table using xtable I have been setting column names
to strings with LaTeX code in order to get features like subscripts in the
column headings. I recently had to reinstall xtable and discovered that all
my LaTeX column headings were printing out in LaTeX code rather than with
LaTeX formatting. For example, with the older xtable I could give my column
a name something like "$A_b$" to get printed column heading of "A" with the
subscript "b." Now my printed column heading is "$A_b$" and the LaTeX code
in the .tex file generated by Sweave is "\$A\_b\$". It seems that the
newest version of print.xtable takes all my LaTeX special characters and
inserts backslashes, making LaTeX print the special characters rather than
interpreting them.

Is there a way to keep xtable from "fixing" my column names like this? Is
there another (maybe better) way to get nicely LaTeX formatted column
headings from xtable?


More information about the R-help mailing list