Fixed #115
diff --git a/R/footnote.R b/R/footnote.R
index d67382b..4d1894e 100644
--- a/R/footnote.R
+++ b/R/footnote.R
@@ -83,8 +83,8 @@
footnote_contents <- lapply(footnote_contents, escape_html)
footnote_titles <- lapply(footnote_titles, escape_html)
} else {
- footnote_contents <- lapply(footnote_contents, escape_latex)
- footnote_titles <- lapply(footnote_titles, escape_latex)
+ footnote_contents <- lapply(footnote_contents, escape_latex2)
+ footnote_titles <- lapply(footnote_titles, escape_latex2)
}
}
footnote_table <- footnote_table_maker(
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) {