@@ -91,6 +91,12 @@ rangeslider <- function(p, start = NULL, end = NULL, ...) {
9191# ' @param collaborate include the collaborate mode bar button (unique to the R pkg)?
9292# ' @param cloud include the send data to cloud button?
9393# ' @param locale locale to use. See [here](https://github.com/plotly/plotly.js/tree/master/dist#to-include-localization) for more info.
94+ # ' @param mathjax whether or not to add [MathJax rendering support](https://github.com/plotly/plotly.js/tree/master/dist#to-support-mathjax).
95+ # ' Note that plotly uses SVG-based mathjax rendering which won't play nicely with
96+ # ' HTML-based rendering (e.g., rmarkdown documents). In this case, you may want to
97+ # ' consider `<iframe>`-ing your plotly graph(s) into the larger document.
98+ # ' Currently mathjax is loaded externally (meaning an internet
99+ # ' connection is needed to view the graph). Future versions may not have this requirement.
94100# ' @author Carson Sievert
95101# ' @export
96102# ' @examples
@@ -103,16 +109,18 @@ rangeslider <- function(p, start = NULL, end = NULL, ...) {
103109# ' # remove the plotly logo and collaborate button from modebar
104110# ' config(p, displaylogo = FALSE, collaborate = FALSE)
105111# '
112+ # ' # enable mathjax
113+ # ' # see more examples at https://plot.ly/r/LaTeX/
114+ # ' plot_ly(x = c(1, 2, 3, 4), y = c(1, 4, 9, 16)) %>%
115+ # ' layout(title = "$\\text{Some mathjax: }\\alpha+\\beta x$") %>%
116+ # ' config(mathjax = TRUE)
117+ # '
106118# ' # japanese
107119# ' config(p, locale = "ja")
108120# ' # german
109121# ' config(p, locale = "de")
110- # ' # swiss-german
111- # ' config(p, locale = "de-CH")
112122# ' # spanish
113123# ' config(p, locale = "es")
114- # ' # french
115- # ' config(p, locale = "fr")
116124# ' # chinese
117125# ' config(p, locale = "zh-CN")
118126# '
@@ -129,7 +137,7 @@ config <- function(p, ..., collaborate = TRUE, cloud = FALSE, locale = NULL, mat
129137
130138 if (! identical(mathjax , FALSE )) {
131139 p $ dependencies <- c(
132- list (mathjax_dependency ()),
140+ list (mathjax_cdn ()),
133141 p $ dependencies
134142 )
135143 }
0 commit comments