Skip to content

udfordria/TeX-to-SVG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tex-to-svg

tex svg

This MathJax wrapper converts TeX to Scalable Vector Graphics (SVG). This package doesn't use any webworkers, webviews ; so It can be used for your NodeJS, React and React Native projects.

Installation

npm install tex-to-svg --save

Examples

JS (with the options parameter)

const TeXToSVG = require("tex-to-svg");

const myTeXEquation = "\\frac{n!}{k!(n-k)!} = \\binom{n}{k}";

const options = {
    width: 1280,
    ex: 8,
    em: 16
};

const SVGEquation = TeXToSVG(myTeXEquation, options); // returns <svg style="vertical-align: -2.172ex" xmlns="http://www.w3.org/2000/svg" width="18.199ex" height="5.451ex" role="img" focusable="false" viewBox="0 -1449.5 8044 2409.5" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path ...

TS (without the options parameter)

import TeXToSVG from "tex-to-svg";

const myTeXEquation = "\\frac{n!}{k!(n-k)!} = \\binom{n}{k}";

const SVGEquation = TeXToSVG(myTeXEquation); // returns <svg style="vertical-align: -2.172ex" xmlns="http://www.w3.org/2000/svg" width="18.199ex" height="5.451ex" role="img" focusable="false" viewBox="0 -1449.5 8044 2409.5" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path ...

Documentation

TeXToSVG(equation, options) : string The returned Scalable Vector Graphics equation

equation : string The TeX equation

options ?: object The options of the retuned Scalable Vector Graphics

width ?: number The width of container in pixels

ex ?: number The ex-size in pixels

em ?: number The em-size in pixels

Notation

?: = optional parameter

Notes

Useful links

This wrapper comes from this project : https://github.com/mathjax/MathJax-demos-node/tree/master/direct.

Typescript

You DON'T have to install any types @types/tex-to-svg.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •