How to break line in column title to be (S)weaved?
iagogv via R-help <[email protected]> Sat, 21 Mar 2026 11:16:29 +0000
| Newsgroups | gmane.comp.lang.r.general |
|---|---|
| Message-ID | <[email protected]> |
Hi all, I am doing a LaTeX document with R, so .Rnw file, which I 'Sweave' to get the .tex file I will 'LaTeX' to .pdf. In that document, I want to include a small data.frame, let's call `data`, therefore I use the xtable package and include something like <<echo=FALSE,results=tex>>= print(xtable(data)) @ One of the names of data is too long, let's say 'This column has a long name' and I want it to be displayed in two rows. Therefore, among other things, in the tex file the two rows should be separated by '\\', so it should appear, for example, as 'This column\\ has a long name'. If in the .Rnw file I include \\ in the name, it is (S)weaved to $\backslash$. I I include \textbackslash, Sweave returns extbackslash. Therefore, my question is how can I do to get column name in multiple rows. I am open to use other packages than xtable, but I want this working with Sweave (so no Rmarkdown/knitr solutions, please). Thanks! Iago [[alternative HTML version deleted]]