Skip to content
Latex and ASCIIMath evaluator for Javascript.
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
test Revamped the project page, added minified version May 3, 2018
.gitignore Ignored IDEA files May 2, 2018
.travis.yml Remove need for tags when pushing docs May 3, 2018
LICENSE Edit "development" disclaimer from README Sep 28, 2018
package.json v2.1.2 May 3, 2018


Evaluatex is a parser that reads and evaluates LaTeX and ASCII math. Use in Node, Angular, or with vanilla Javascript on both clients and servers.

Evaluatex can safely resolve math without relying Javascript's native eval() function. It can also support custom variables and functions, so you can pass in arbitrary values without having to hard-code the math.

Evaluatex is reasonably stable. It has been tested for common patterns and use cases, but when provoked it may do weird and unexpected things such as eating your cat.


npm install evaluatex
# or
yarn install/add evaluatex
const evaluatex = require("evaluatex");
// or
import evaluatex from "evaluatex";


Get yarn and do yarn install.

yarn build transpiles ES6 sources to dist/.

yarn test runs tests in the test/ directory.


const fn = evaluatex(expression, constants = {}, options = {});
const result = fn(variables = {});
  • evaluatex() compiles a text math expression into a function fn.
    • expression is an ASCII or LaTeX expression to be parsed and evaluated.
    • constants is a map of constant values - values that don't change if you invoke fn more than once.
    • options is a map of options for the compiler.
  • result is the numerical result of the calculation.
    • variables is a map of variables that can change between invocations.

Features and usage

A complete manual is available on the project page.

You can’t perform that action at this time.