This escapes a string for LaTeX, HTML or RTF.
sanitize(str, type = c("latex", "html", "rtf"))
str | A character object. |
---|---|
type |
|
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"