Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/xnacly/tex2math
- Owner: xNaCly
- Created: 2023-11-20T09:58:39.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-11-20T11:56:53.000Z (about 1 year ago)
- Last Synced: 2024-11-17T18:10:20.563Z (3 months ago)
- Topics: latex, mathml
- Language: Go
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 mainimport (
"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 |
| ----------- | ------ | ------ |