Skip to content

profdemiurgo/algebra-latex

This branch is up to date with viktorstrate/algebra-latex:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

02afc25 · Nov 10, 2020
Nov 1, 2020
Nov 9, 2020
Nov 9, 2020
Nov 9, 2020
Feb 11, 2017
Dec 19, 2017
Oct 31, 2018
Oct 14, 2018
Aug 15, 2020
Feb 8, 2017
Oct 30, 2018
Jun 13, 2017
Nov 9, 2020
Nov 10, 2020

Repository files navigation

algebra-latex

Build Status npm version

An npm module, with no dependencies, for parsing LaTeX math to a regular math string (ascii math), that can be parsed to other algebra or math libraries like algebrite and algebra.js

Example

const AlgebraLatex = require('algebra-latex')

// Parse from LaTeX ...
const latexInput = '\\frac{1}{\\sqrt{2}}\\cdot x=10'
const algebraObj = new AlgebraLatex().parseLatex(latexInput)

// ... or parse from regular math string
const mathInput = '1/sqrt(2)*x=10'
const algebraObj = new AlgebraLatex().parseMath(mathInput)

console.log(algebraObj.toMath()) // output: 1/sqrt(2)*x=10
console.log(algebraObj.toLatex()) // output: \frac{1}{\sqrt{2}}\cdot x=10

Parse to other libraries

Supported libraries

NOTE: The above libraries are optional, and have to be installed before use

continuing from example above

...

var algebraJS = require('algebra.js')
var algebrite = require('algebrite')
var coffeequate = require('coffeequate')

// For algebra.js
algebraObj.toAlgebra(algebraJS) // Will either return an algebra.js expression or equation

// For algebrite
algebraObject.toAlgebrite(algebrite)

// For coffequate
algebraObject.toCoffeequate(coffeequate)

About

Parse and calculate latex formatted math

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%