# mathjax-electron

> A trimmed down version of the MathJax library for use with Electron and modern browsers

Latest version **3.0.0** (published 2018-10-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install mathjax-electron
pnpm add mathjax-electron
yarn add mathjax-electron
bun add mathjax-electron
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2018-10-11 |
| First published | 2016-04-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 899.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Lukas Geiger |
| Maintainers | lgeiger |
| Keywords | mathjax, math, latex, tex, electron, chrome, essential |

## Links

- npm: https://www.npmjs.com/package/mathjax-electron
- Repository: https://github.com/nteract/mathjax-electron
- Homepage: https://github.com/nteract/mathjax-electron#readme
- Issues: https://github.com/nteract/mathjax-electron/issues
- npm.io page: https://npm.io/package/mathjax-electron

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

- 3.0.0 (latest) — 2018-10-11
- 2.0.1 — 2017-04-22
- 2.0.0 — 2017-04-07
- 1.2.1 — 2017-04-04
- 1.2.0 — 2016-11-02
- 1.1.1 — 2016-09-15
- 1.1.0 — 2016-09-02
- 1.0.0 — 2016-07-15
- 0.2.0 — 2016-04-25
- 0.1.0 — 2016-04-11

## README

# mathjax-electron

[![Build Status](https://travis-ci.org/nteract/mathjax-electron.svg?branch=master)](https://travis-ci.org/nteract/mathjax-electron)

A trimmed down version of the [MathJax](https://www.mathjax.org/) library for use with electron and modern browsers.

`mathjax-electron` allows you to render math inside your application while keeping the package size at a minimum. To achieve this we provide a preconfigured MathJax environment with only the necessary bits of the MathJax Library included.

The package size is ~1 MB compared to 66 MB for a full MathJax installation. If you need support for different output formats and legacy browsers try [`mathjax-node`](https://github.com/mathjax/MathJax-node).

## Installation

```bash
npm install mathjax-electron
```

## Usage

### Loading MathJax

Place the following line in the `<head>` section of your document:

```html
<script type="text/javascript" src="./node_modules/mathjax-electron/resources/MathJax/MathJax.js?config=electron"></script>
```

Now you can use MathJax inside you application.

To trigger a rendering on a specific container, you can either use our helper module:

```javascript
const { typesetMath } = require("mathjax-electron");

const container = document.createElement("div");
container.innerHTML = "$$\\sum\\limits_{i=0}^{\\infty} \\frac{1}{n^2}$$";
typesetMath(container);
```

or the MathJax global:

```javascript
const container = document.createElement("div");
container.innerHTML = "$$\\sum\\limits_{i=0}^{\\infty} \\frac{1}{n^2}$$";

MathJax.Hub.Queue(["Typeset", MathJax.Hub, container]);
```

For more information about synchronizing your code, consult the [MathJax documentation](http://docs.mathjax.org/en/latest/advanced/synchronize.html).

### Loading MathJax Dynamically

To load MathJax dynamically, you can do:

```javascript
const { loadAndTypeset } = require("mathjax-electron");

const container = document.createElement("div");
container.innerHTML = "$$\\sum\\limits_{i=0}^{\\infty} \\frac{1}{n^2}$$";

loadAndTypeset(document, container);
```

If used for the first time it will initialize MathJax and trigger a rendering. After that it won't load MathJax again and only trigger the rendering.

### Manually Loading MathJax

For applications to manually loaded, or directly injected into the HTML, `mathjax-electron` exports the absolute path to load the configured MathJax Library.

```javascript
const { mathJaxPath } = require("mathjax-electron");
// /.../node_modules/mathjax-electron/MathJax-2.7.5/MathJax.js?config=nteract
```

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