Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xnacly/tex2math

tex2mathml - fast, small and embeddable latex math to mathml compiler
https://github.com/xnacly/tex2math

latex mathml

Last synced: 24 days ago
JSON representation

tex2mathml - fast, small and embeddable latex math to mathml compiler

Awesome Lists containing this project

README

        

# tex2math

> _Warning_
>
> `tex2math` is currently in development, do not yet use it in production.

Compile latex math to mathml.

## Features:

- embedable library & standalone cli tool
- low memory footprint
- very fast conversion
- high performance
- zero dependencies
- custom macros

## Usage

### Cli tool

```shell
$ cat math.tex
\sqrt{5} \pm x_i
$ tex2math -i math.tex



5

±



x
i

```

### Library

```go
package main

import (
"fmt"
"github.com/xnacly/tex2math" t2m
)

func main() {
expression := "\sqrt{5} \pm x_i"
converter := t2m.New() // creates necessary internal structures for high performance conversion
mathml, err := converter.Convert(expression)
if err != nil {
panic(err) // can occur on invalid symbols, expressions, missing closing braces, etc
}
fmt.Println(mathml) // resulting output
}
```

## Supported features

> Math features taken from [LaTeX/Mathematics](https://en.wikibooks.org/wiki/LaTeX/Mathematics)

### Relation symbols

### Binary operations

### Set, Logic

### Delimiters

| Implemented | Symbol | Script |
| ----------- | ------ | ------------ |
| | \| | `\|`, `\mid` |
| | { | `\{` |
| | ↑ | `\uparrow` |
| | ↓ | `\downarrow` |
| | ‖ | `\|` |
| | } | `\}` |
| | ⇑ | `\Uparrow` |
| | ⇓ | `\Downarrow` |
| | / | `/` |
| | ⟨ | `\langle` |
| | ⌈ | `\lceil` |
| | ⌊ | `\lfloor` |
| | ∖ | `\backslash` |
| | ⟩ | `\rangle` |
| | ⌉ | `\rceil` |
| | ⌋ | `\rfloor` |

### Greek Letters

| Implemented | Symbol | Script |
| ----------- | ------- | ------------------------------ |
| | A, α | `A`, `\alpha` |
| | B, β | `B`, `\beta` |
| | Γ, γ | `\Gamma`, `\gamma` |
| | Δ, δ | `\Delta`, `\delta` |
| | E, ϵ, ε | `E`, `\epsilon`, `\varepsilon` |
| | Z, ζ | `Z`, `\zeta` |
| | H, η | `H`, `\eta` |
| | Θ, θ, ϑ | `\Theta`, `\theta`, \vartheta |
| | I, ι | `I`, `\iota` |
| | K, κ | `\kappa`, `\varkappa` |
| | Λ, λ | `\Lambda`, `\lambda` |
| | M, μ | `M`, `\mu` |

### Trigonometric functions

| Implemented | Symbol | Script |
| ----------- | ------ | --------- |
| | sin | `\sin` |
| | cos | `\cos` |
| | tan | `\tan` |
| | cot | `\cot` |
| | arcsin | `\arcsin` |
| | arccos | `\arccos` |
| | arctan | `\arctan` |
| | sinh | `\sinh` |
| | cosh | `\cosh` |
| | tanh | `\tanh` |
| | coth | `\coth` |
| | sec | `\sec` |
| | csc | `\csc` |

### Other

| Implemented | Symbol | Script |
| ----------- | ------ | ------ |