This escapes a string for LaTeX, HTML or RTF.

sanitize(str, type = c("latex", "html", "rtf"))

Arguments

str

A character object.

type

"latex", "html" or "rtf".

Value

The sanitized character object.

Details

HTML and LaTeX code was copied over from xtable::sanitize().

Examples

txt <- "Make $$$ with us"
sanitize(txt, type = "latex")
#> [1] "Make \\$\\$\\$ with us"