Function to sanitize strings for LaTeX compilation?
问题 While xtable() has a sanitize.text.function argument which allows to sanitize strings with special charaters to stop LaTeX compilation from breaking in Sweave/knitr documents, the package does not export the function to the userspace. How can I sanitize strings like asdf_text outside of the xtable context, so as to have it transformed to something like asdf\_text ? (If possible I would prefer a small, self-contained solution.) 回答1: Unless I misunderstand your question, I think you've