This escapes a string for LaTeX, HTML or RTF.
sanitize(str, type = c("latex", "html", "rtf"))
A character object.
"latex"
, "html"
or "rtf"
.
The sanitized character object.
HTML and LaTeX code was copied over from xtable::sanitize()
.
txt <- "Make $$$ with us"
sanitize(txt, type = "latex")
#> [1] "Make \\$\\$\\$ with us"