# @wordpress/latex-to-mathml

> Convert LaTeX math syntax to MathML.

Latest version **2.2.0** (published 2026-11-18) · GPL-2.0-or-later license · 0 weekly downloads

## Install

```sh
npm install @wordpress/latex-to-mathml
pnpm add @wordpress/latex-to-mathml
yarn add @wordpress/latex-to-mathml
bun add @wordpress/latex-to-mathml
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; popular repo.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2026-11-18 |
| First published | 2025-10-17 |
| Weekly downloads | 0 |
| License | GPL-2.0-or-later |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.13.0 |
| Dependencies | 1 |
| Unpacked size | 52.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11791 |
| Author | The WordPress Contributors |
| Maintainers | garypendergast, adamsilverstein, gziolo, ntwb, riad, noisysocks, kadamwhite, gutenbergplugin, jorgefilipecosta, ellatrix, iandunn206, whyisjake, ockham, sirreal, nosolosw, wpisabel, ntsekouras, nerrad, desrosj, talldanwp, peterwilsoncc, ryanwelcher, mamaduka, aduth, johnbillion |
| Keywords | wordpress, gutenberg, latex, mathml, math |

## Links

- npm: https://www.npmjs.com/package/@wordpress/latex-to-mathml
- Repository: https://github.com/WordPress/gutenberg
- Homepage: https://github.com/WordPress/gutenberg/tree/HEAD/packages/latex-to-mathml/README.md
- Issues: https://github.com/WordPress/gutenberg/issues
- npm.io page: https://npm.io/package/@wordpress/latex-to-mathml

## Dependencies (1)

- [temml](https://npm.io/package/temml.md) ^0.10.33

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 2.2.0 (latest) — 2026-11-18
- 1.23.1-next.v.202609171837.0 (next) — 2026-09-17
- 1.8.1 (wp-7.0) — 2026-06-30
- 1.1.2 (wp-6.9) — 2025-11-11
- 2.1.0 — 2026-11-04
- 2.0.0 — 2026-10-20
- 1.25.0 — 2026-10-07
- 1.24.0 — 2026-09-23
- 1.23.0 — 2026-09-10
- 1.22.1-next.v.202609031004.0 — 2026-09-03
- 1.22.1-next.v.202608281122.0 — 2026-08-28
- 1.22.0 — 2026-08-26
- 1.21.0 — 2026-08-12
- 1.20.0 — 2026-07-29
- 1.19.0 — 2026-07-14
- … 50 more at https://npm.io/package/@wordpress/latex-to-mathml/versions

## README

# LaTeX to MathML

Convert LaTeX math syntax to MathML.

## Installation

Install the module:

```bash
npm install @wordpress/latex-to-mathml --save
```

## Usage

```js
import latexToMathML from '@wordpress/latex-to-mathml';

// Convert LaTeX to MathML (display mode, for block equations)
const mathML = latexToMathML( 'E = mc^2' );

// Convert LaTeX to MathML (inline mode)
const inlineMathML = latexToMathML( 'x^2', { displayMode: false } );
```

## API

### `latexToMathML( latex, options )`

Converts LaTeX math syntax to MathML.

#### Parameters

- `latex` (`string`): The LaTeX string to convert.
- `options` (`Object`): Optional conversion options.
    - `displayMode` (`boolean`): Whether to render in display mode (block) or inline mode. Default: `true`.

#### Returns

- (`string`): The MathML string.

#### Throws

- Will throw an error if the LaTeX syntax is invalid.

## Contributing to this package

This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects.

To find out more about contributing to this package or Gutenberg as a whole, please read the project's main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md).

<br /><br /><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>

---
_Source: https://npm.io/package/@wordpress/latex-to-mathml · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
