This is copied over from xtable::sanitize().
xtable::sanitize()
sanitize(str, type = "latex")
str
A character object.
type
"latex" or "html".
"latex"
"html"
The sanitized character object.
foo <- 'Make $$$ with us' sanitize(foo, type = 'latex')