A JavaScript tool to convert mathml string to LaTeX equation string.
Go to file
2021-06-06 14:54:40 -03:00
__tests__ feat: always use space wrapper and remove no space wrapper class 2021-04-11 18:37:03 -03:00
.github/workflows Create stale.yml 2021-06-06 14:54:40 -03:00
.vscode config files setup 2020-09-12 17:11:18 -03:00
src feat: always use space wrapper and remove no space wrapper class 2021-04-11 18:37:03 -03:00
.eslintignore chore: add no src folders to .eslintignore file 2020-10-03 13:32:11 -03:00
.eslintrc.js chore: add and fix prettier 2020-09-27 02:23:15 -03:00
.gitignore chore: add dist folder to .gitignore file 2020-10-03 13:32:37 -03:00
.huskyrc.json chore: add husky as dev dependency 2020-09-26 16:48:40 -03:00
.lintstagedrc.json chore: add tests to lint-staged 2020-09-26 16:53:48 -03:00
.npmignore fix: add .prettierrc.js and .eslintignore to npmignore file 2020-10-03 14:57:32 -03:00
.prettierrc.js chore: add and fix prettier 2020-09-27 02:23:15 -03:00
.tool-versions chore: new node version 2021-04-11 18:23:57 -03:00
jest.config.js chore: remove alias path and fix export default 2020-10-03 14:42:56 -03:00
LICENSE.md Create LICENSE.md 2020-09-26 16:37:11 -03:00
package-lock.json feat: always use space wrapper and remove no space wrapper class 2021-04-11 18:37:03 -03:00
package.json chore: new npm version. It's now v1.1.0 2021-04-11 18:38:45 -03:00
README.md feat: update readme file with basic description and usage 2020-10-03 15:05:07 -03:00
tsconfig.json chore: remove alias path and fix export default 2020-10-03 14:42:56 -03:00

mathml-to-latex

It converts MathML to LaTeX.

Instalation

If you use NPM

npm install mathml-to-latex --save

If you use Yarn

yarn add mathml-to-latex

Usage

const Mathml2latex = require('mathml-to-latex');

const mathml = `
      <math>
        <mrow>
          <mn>a</mn>
          <mo>+</mo>
          <mn>b</mn>
        </mrow>
      </math>
      `;

Mathml2latex.convert(mathml);
// => a + b
const Mathml2latex = require('mathml-to-latex');

const mathml = `
    <math>
        <mrow>
            <mi>A</mi>
            <mo>=</mo>
            <mfenced open = "[" close="]">
            <mtable>
                <mtr>
                <mtd><mi>x</mi></mtd>
                <mtd><mi>y</mi></mtd>
                </mtr>
                <mtr>
                <mtd><mi>z</mi></mtd>
                <mtd><mi>w</mi></mtd>
                </mtr>
            </mtable>
            </mfenced>
        </mrow>
    </math>
    `;

Mathml2latex.convert(mathml);
// => A = \begin{bmatrix} x & y \\ z & w \end{bmatrix}