Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
R
 
 
 
 
man
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

katexR htmlwidget

note: pre-Alpha

katexR is a R htmlwidget that brings the power of KaTeX to R. Try it out with a couple lines of code.

#devtools::install_github("timelyportfolio/katexR")
library(katexR)
katex("\\KaTeX")

katex( "Var(X)= E(X^2)-(E(X))^2" )

More than likely you might like to integrate katexR in your other HTML content. With tags from htmltools, we could put it all together like this.

#devtools::install_github("timelyportfolio/katexR")
library(katex)
library(htmltools)

# use the example from the KaTeX site
html_print(
  tagList(
    tags$pre(
      "f(x) = \\int_{-\\infty}^\\infty
          \\hat f(\\xi)\\,e^{2 \\pi i \\xi x}
          \\,d\\xi"
    )
    ,tags$p( " will become this ")
    ,as.tags(
      katex(
        "f(x) = \\int_{-\\infty}^\\infty
            \\hat f(\\xi)\\,e^{2 \\pi i \\xi x}
            \\,d\\xi"
      )
    )
  )
)

Like all htmlwidgets, katexR will integrate beautifully with rmarkdown. If you write research in R, I think you'll definitely want to try out katexR.

katexR is the htmlwidget of the week at Building Widgets. See the writeup on katexR and all of the other htmlwidgets from the project on the blog.

You can’t perform that action at this time.