# mathlifier2

> Enabling 'write once, run anywhere' for web + LaTeX documents

Latest version **1.3.5** (published 2024-01-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install mathlifier2
pnpm add mathlifier2
yarn add mathlifier2
bun add mathlifier2
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.3.5 |
| Published | 2024-01-05 |
| First published | 2023-01-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 27.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | Kelvin Soh |
| Maintainers | kelvinsjk |
| Keywords | math, maths, mathematics, LaTeX, KaTeX, mathlify, mathlifier, mathlifier2, mathlified |

## Links

- npm: https://www.npmjs.com/package/mathlifier2
- Repository: https://github.com/kelvinsjk/mathlified
- Homepage: https://github.com/kelvinsjk/mathlified/blob/fce2b0eb417397719e1fe641912e7c5e59676289/packages/mathlifier/README.md
- Issues: https://github.com/kelvinsjk/mathlified/issues
- npm.io page: https://npm.io/package/mathlifier2

## 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

- 1.3.5 (latest) — 2024-01-05
- 1.3.4 — 2023-02-01
- 1.3.3 — 2023-01-22
- 1.3.2 — 2023-01-22
- 1.3.1 — 2023-01-21
- 1.3.0 — 2023-01-16

## README

# Mathlifier2

Mathlifier2, together with [Mathlifier](https://www.npmjs.com/package/mathlifier), provides
a set of utilities to typeset Mathematics. Mathlifier converts code into HTML-ready
KaTeX markup while Mathlifier2 converts code into LaTeX-ready markup ready to be
inserted into a `.tex` document and compiled.

[![mathlifier2 npm version](https://img.shields.io/npm/v/mathlifier2)](https://github.com/kelvinsjk/mathlified/tree/main/packages/mathlifier2)
[![mathlifier2 minzip size](https://img.shields.io/bundlephobia/minzip/mathlifier2)](https://github.com/kelvinsjk/mathlified/tree/main/packages/mathlifier2)

---

## What are the features of Mathlifier2?

The following features are unified in Mathlifier and Mathlifier2.

### Mathematical typesetting

- `math('x')` to produce `${x}$` and `math('x', {wrap: true})` to produce `$x$`
- `display('x')` to produce `$$x$$`

### Mathematical environments

- `equation('x=3')` to produce `\begin{equation} x=3 \end{equation}`
- `equationStar('')` for the `equation*` environment
- `align()`
- `alignStar()`
- `alignat('x&=2& \quad 'y&=3', 2)`
- `alignatStar()`
- `gather()`
- `gatherStar()`

### General typesetting

- `linebreak`
- `newline`
- `bold()`, `strong()`
- `emph()`, `em()`,
- `newParagraph`

## Installing Mathlifier2

```bash
npm i mathlifier2
```

## Using Mathlifier2

```js
// import functions
import { math, display } from 'mathlifier2';
// example of using these functions
const inlineMath = math('ax^2+bx+c=0');
const displayedMath = display('x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}');
```

Subsequently, attach the string(s) to a TeX document.

## Upcoming Mathlified framework

We are working on a SvelteKit + TeX framework (in the form of a Vite plugin)
that uses Mathlifier and Mathlifier2 to generate a SvelteKit website/webapp
along with TeX and pdf files all from the same codebase. Stay tuned.

## Credits

[KaTeX](https://katex.org/)

## License

[MIT](https://github.com/kelvinsjk/mathlified/blob/896289c646c1a7c8b1a6a52a74a4a22fd2d6d500/packages/mathlifier/LICENSE)

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