Fixed #115
diff --git a/R/from_knitr.R b/R/from_knitr.R
index 1948795..205148d 100644
--- a/R/from_knitr.R
+++ b/R/from_knitr.R
@@ -14,6 +14,15 @@
x
}
+escape_latex2 <- function(x) {
+ x = gsub('\\\\', '\\\\\\\\textbackslash', x)
+ x = gsub('([#$%&_{}])', '\\\\\\\\\\1', x)
+ x = gsub('\\\\textbackslash', '\\\\\\\\textbackslash{}', x)
+ x = gsub('~', '\\\\\\\\textasciitilde{}', x)
+ x = gsub('\\^', '\\\\\\\\textasciicircum{}', x)
+ x
+}
+
# escape special HTML characters
# @author Yihui Xie
escape_html <- function(x) {