On Fri, 27 Apr 2007, Pfaff, Bernhard Dr. wrote: > Dear R-Devel subscriber, > > I encountered the following problem for tex-formatted table with > xtable(). Suppose I do want the following matrix as a table in LaTeX: > > library(xtable) > a11 <- "\\color{green}\\textbf{big green}" > a21 <- "\\color{red}\\textbf{big red}" > a12 <- "\\color{green}green" > a22 <- "\\color{red}red" > A <- matrix(c(a11, a21, a12, a22), nrow = 2, ncol = 2) > colnames(A) <- c("big", "normal") > rownames(A) <- c("green", "red") > A > xtable(A, vsep=c('@{\\hspace{0.1cm}}', rep('@{\\hspace{0.4cm}}', 6), > '@{\\hspace{0.1cm}}')) > > I do get the following output: > > % latex table generated in R 2.5.0 by xtable 1.4-3 package > % Fri Apr 27 13:19:43 2007 > \begin{table}[ht] > \begin{center} > \begin{tabular}{rll} > \hline > & big & normal \\ > \hline > green & $\backslash$color\{green\}$\backslash$textbf\{big green\} & > $\backslash$color\{green\}green \\ > red & $\backslash$color\{red\}$\backslash$textbf\{big red\} & > $\backslash$color\{red\}red \\ > \hline > \end{tabular} > \end{center} > \end{table} > > > Please, note that the curly braces are prefixed with a backslash and the > double backslashes are interpreted as math backslashes. The above code > snippet worked fine in R 2.4.1 and I reckon that this behaviour might be > due to: > > o There is a warning if \ is used unnecessarily in a string when > being parsed, e.g. "\." where probably "\\." was intended. > ("\." is valid, but the same as ".".) Thanks to Bill Dunlap > for the suggestion.
How can a warning that you are not showing (and I don't see when running your code) have anything to do with this? That change is just to add a warning: there is no change in the parsed code. I get the same behaviour in 2.4.1 with xtable 1.4-3. Have you perhaps updated 'xtable' as well as R and are blaming R for an 'xtable' change? As ?print.xtable says From version 1.4-3, all non-numeric columns are sanitized, and all LaTeX special characters are sanitised for LaTeX output. See the vignette for an example of customising the sanitization. [...] -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel