Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qwinsi/tex2typst
JavaScript library for conversion between TeX/LaTeX and Typst math formula code.
https://github.com/qwinsi/tex2typst
latex math-formula tex typst
Last synced: 1 day ago
JSON representation
JavaScript library for conversion between TeX/LaTeX and Typst math formula code.
- Host: GitHub
- URL: https://github.com/qwinsi/tex2typst
- Owner: qwinsi
- License: gpl-3.0
- Created: 2024-07-15T00:08:06.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-01-28T16:43:58.000Z (17 days ago)
- Last Synced: 2025-02-07T12:12:29.388Z (8 days ago)
- Topics: latex, math-formula, tex, typst
- Language: TypeScript
- Homepage: https://qwinsi.github.io/tex2typst-webapp/
- Size: 400 KB
- Stars: 15
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tex2typst
JavaScript library for conversion between TeX/LaTeX and Typst math formula code.Despite the name `tex2typst` due to the initial goal of converting TeX to Typst, the library can also convert Typst to TeX since version 0.3.0.
## Try it online
A Web UI wrapper is available at [https://qwinsi.github.io/tex2typst-webapp/](https://qwinsi.github.io/tex2typst-webapp/).
## Installation
## Installing it in a Node.js project
```bash
npm install tex2typst
```## Or just loading it in a web page
```html
```
Replace `0.3.0` with the latest version number in case this README is outdated.
## Usage
```javascript
import { tex2typst, typst2tex } from 'tex2typst';let tex = "e \overset{\text{def}}{=} \lim_{{n \to \infty}} \left(1 + \frac{1}{n}\right)^n";
let typst = tex2typst(tex);
console.log(typst);
// e eq.def lim_(n arrow.r infinity)(1 + frac(1, n))^nlet tex_recovered = typst2tex(typst);
console.log(tex_recovered);
// e \overset{\text{def}}{=} \lim_{n \rightarrow \infty} \left(1 + \frac{1}{n} \right)^n
```If you are using the library in a web page via a `` tag, you don't need the line of `import`, function `tex2typst` and `typst2tex` should be available in the global scope.
## Open-source license
GPL v3. See [LICENSE](LICENSE) for details.
## Contributing
Feel free to open an issue or submit a pull request.