/mathrender

math rendering

Primary LanguageJavaScript

Render Latex into an image

This code mainly tries to turn LaTeX into SVG/PNG, with the intention of running a Telegram bot.

In particular diagrams would be nice to draw, but...

  • While the amscd package is supported, the tikz package is not
  • MathJax itself probably won't ever support tikz (#41).
  • This is based on mathjax-full

Uses mathjax and svg2img to render LaTeX or (TBD) ASCIIMath into an SVG or PNG image.

Example:

let mathrender = require('mathrender')

// input document
let latex = 'F : \\mathcal(C) \\to \\mathcal(C)'

let svg = mathrender.latexToSVG(latex) // string
let png = mathrender.latexToPNG(latex) // Buffer

// write to filesystem
require('fs').writeFileSync('output.png', png)

TODO