# timelyportfolio/katexR

Switch branches/tags
Nothing to show
Fetching contributors…
Cannot retrieve contributors at this time
42 lines (29 sloc) 1.58 KB
 --- title: "katexR Example" author: "timelyportfolio" date: "February 3, 2015" output: html_document --- This is an R Markdown document. Let's see how we might use it with the katexR htmlwidget. ### OMG, Look at My KaTeX {r} library(katexR) library(htmltools) as.tags(katex( "\\frac{1}{n} \\sum_{i=i}^{n} x_{i}", tag="p", style = "font-size:300%;" )) # without the as.tags() enclosure katex( "\\frac{1}{n} \\sum_{i=i}^{n} x_{i}", tag="span", style = "font-size:300%;" )  ### KaTeX the hard way Now, since we get the KaTeX dependencies with katexR, we can also use them bare. If you don't anticipate already having a katex(...) call in the document, then you can just do an empty katex() to bring in the dependencies. 
with katexR

with katexR
### Inline KaTeX Now, let's go back to one rendered by our katexR function like this with some inline R code to see how we get it in a paragraph. Also, when inlining, you will probably want to set inline=T. In r as.tags(katex("\\KaTeX",tag="span",inline=T)) mean would look something like this r as.tags(katex("\\frac{1}{n} \\sum_{i=i}^{n} x_{i}",tag="span",inline=T)). Unfortunately, you might notice, that we have to **enclose it in as.tags(...)** to make it work, but hey it does work.