# tex-to-svg

> The MathJax wrapper to convert TeX to SVG

Latest version **0.2.0** (published 2020-09-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install tex-to-svg
pnpm add tex-to-svg
yarn add tex-to-svg
bun add tex-to-svg
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2020-09-08 |
| First published | 2020-09-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | @CreatifCreateur |
| Maintainers | creatif-createur |
| Keywords | SVG, TeX, MathJax |

## Links

- npm: https://www.npmjs.com/package/tex-to-svg
- Repository: https://github.com/CreatifCreateur/TeX-to-SVG
- Homepage: https://github.com/CreatifCreateur/TeX-to-SVG#readme
- Issues: https://github.com/CreatifCreateur/TeX-to-SVG/issues
- npm.io page: https://npm.io/package/tex-to-svg

## Dependencies (1)

- [mathjax-full](https://npm.io/package/mathjax-full.md) ^3.1.0

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

- 0.2.0 (latest) — 2020-09-08
- 0.1.0 — 2020-09-08

## README

# tex-to-svg

This MathJax wrapper converts TeX to Scalable Vector Graphics (SVG). This package doesn't use any webworkers, webviews ; so It can be used for your NodeJS, React and React Native projects.

**This project is still in its early development stages.**

For any bugs, typos, errors, feel free to open an issue on the associated Github repository.

## Installation

```cli
npm install tex-to-svg --save
```

## Examples

### JS (with the `options` parameter)

```js
const TeXToSVG = require("tex-to-svg");

const myTeXEquation = "\\frac{n!}{k!(n-k)!} = \\binom{n}{k}";

const options = {
    width: 1280,
    ex: 8,
    em: 16
};

const SVGEquation = MMLToSVG(myTeXEquation, options); // returns <svg style="vertical-align: -2.172ex" xmlns="http://www.w3.org/2000/svg" width="18.199ex" height="5.451ex" role="img" focusable="false" viewBox="0 -1449.5 8044 2409.5" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path ...
```

### TS (without the `options` parameter)

```ts
import TeXToSVG from "tex-to-svg";

const myTeXEquation = "\\frac{n!}{k!(n-k)!} = \\binom{n}{k}";

const SVGEquation = MMLToSVG(myTeXEquation); // returns <svg style="vertical-align: -2.172ex" xmlns="http://www.w3.org/2000/svg" width="18.199ex" height="5.451ex" role="img" focusable="false" viewBox="0 -1449.5 8044 2409.5" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path ...
```

## Documentation

`MMLToSVG(equation, options)` : **string** _The returned Scalable Vector Graphics equation_

> `equation` : **string** _The TeX equation_
>
> `options` ?: **object** _The options of the retuned Scalable Vector Graphics_
>
> > `width` ?: **number** _The width of container in pixels_
> >
> > `ex` ?: **number** _The ex-size in pixels_
> >
> > `em` ?: **number** _The em-size in pixels_

### Notation

?: = optional parameter

## Notes

### Useful links

This wrapper is inspired by this project : https://github.com/mathjax/MathJax-demos-node/tree/master/direct.

### Typescript

You **DON'T** have to install any types `@types/tex-to-svg`.

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