Skip to content

Instantly share code, notes, and snippets.

@jeroen
Last active August 29, 2015 14:15
Show Gist options
  • Save jeroen/c09fdb0465f7e9382163 to your computer and use it in GitHub Desktop.
Save jeroen/c09fdb0465f7e9382163 to your computer and use it in GitHub Desktop.
KaTeX proof of concept
library(V8)
ct <- new_context()
ct$source("http://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.1/katex.min.js")
html <- ct$call("katex.renderToString", "f(x, \\mu, \\sigma) = \\frac{1}{\\sigma \\sqrt{2\\pi} } e^{ -\\frac{(x-\\mu)^2}{2\\sigma^2}}");
tmp <- tempfile(fileext = ".html")
writeLines(c('<html><head><meta charset="UTF-8"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.1/katex.min.css"></head><body>', html, '</body></html>'), tmp)
browseURL(tmp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment