[R] How to break line in column title to be (S)weaved?
Ivan Krylov
|kry|ov @end|ng |rom d|@root@org
Sun Mar 22 20:17:39 CET 2026
В Sat, 21 Mar 2026 11:16:29 +0000
iagogv via R-help <r-help using r-project.org> пишет:
> 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
More information about the R-help
mailing list