It's a javascript library to convert mathML to latex
Clone this repo and run npm run build
, It'll generate belowing files:
lib
├── mathml2latex.browser.cjs.js
├── mathml2latex.browser.es.js
├── mathml2latex.browser.umd.js
├── mathml2latex.cjs.js
├── mathml2latex.es.js
└── mathml2latex.umd.js
dist
└── mathml2latex.js
In browser environment, you need to build the library first, then load it:
<script src="https://github.com/mika-cn/mathml2latex/raw/master/dist/mathml2latex.js"></script>
Using with npm
npm install mathml2latex
const MathMl2LaTeX = require('mathml2latex')
const mathmlHtml = '<math display="block"><mfrac><mi>a</mi><mi>b</mi></mfrac></math>';
const latex = MathML2LaTeX.convert(mathmlHtml); // => \frac{a}{b}