Re: How to break line in column title to be (S)weaved?
Ivan Krylov via R-help <[email protected]> Sun, 22 Mar 2026 22:17:39 +0300
| Newsgroups | gmane.comp.lang.r.general |
|---|---|
| Message-ID | <20260322221739.53af2a6a@Tarkus> |
В Sat, 21 Mar 2026 11:16:29 +0000 iagogv via R-help <[email protected]> пишет: > If in the .Rnw file I include \\ in the name, it is (S)weaved to > $\backslash$. I I include \textbackslash, Sweave returns extbackslash. The good news is that it's print.xtable escaping the column names, so in order to sneak LaTeX-special characters into the document, you just need to print(xtable(table), sanitize.colnames.function = identity). The bad news is that inserting a line break into a table cell will take some effort: https://tex.stackexchange.com/questions/2441/how-to-add-a-forced-line-break-inside-a-table-cell https://stackoverflow.com/questions/3068555/how-to-insert-manual-line-breaks-inside-latex-tables I think the least cumbersome solution is to specify the width of the column in the 'align' argument and use '\\newline' for the line break. -- Best regards, Ivan