A JavaScript tool to convert mathml string to LaTeX equation string.
Go to file
Michal Szczepanski caf0044d01 fix: bump xmldom to ^0.8.6 2023-03-25 18:11:05 +01:00
.github/workflows ci: add both main and master branch as workflow logic 2021-09-20 22:35:41 -03:00
.vscode config files setup 2020-09-12 17:11:18 -03:00
__tests__ test: implement test for many missing argument cases 2021-09-20 22:18:08 -03:00
src fix: bump xmldom to ^0.8.6 2023-03-25 18:11:05 +01: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 chore: add new files to npmignore 2021-09-20 22:28:51 -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
Dockerfile.test ci: add test setup and workflow 2021-09-20 22:23:12 -03:00
LICENSE.md Create LICENSE.md 2020-09-26 16:37:11 -03:00
README.md feat: update readme file with basic description and usage 2020-10-03 15:05:07 -03:00
docker-compose.test.yml ci: add test setup and workflow 2021-09-20 22:23:12 -03:00
jest.config.js chore: remove alias path and fix export default 2020-10-03 14:42:56 -03:00
makefile ci: add test setup and workflow 2021-09-20 22:23:12 -03:00
package-lock.json fix: bump xmldom to ^0.8.6 2023-03-25 18:11:05 +01:00
package.json fix: bump xmldom to ^0.8.6 2023-03-25 18:11:05 +01:00
tsconfig.json chore: remove alias path and fix export default 2020-10-03 14:42:56 -03:00

README.md

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}