Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ntsd/svelte-tex
Svelte component to convert TeX/LaTeX to MathML or SVG
https://github.com/ntsd/svelte-tex
hacktoberfest latex math mathml svelte svg tex
Last synced: 29 days ago
JSON representation
Svelte component to convert TeX/LaTeX to MathML or SVG
- Host: GitHub
- URL: https://github.com/ntsd/svelte-tex
- Owner: ntsd
- License: mit
- Created: 2023-08-11T02:51:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-16T13:03:02.000Z (about 1 month ago)
- Last Synced: 2024-11-16T13:33:24.461Z (about 1 month ago)
- Topics: hacktoberfest, latex, math, mathml, svelte, svg, tex
- Language: Svelte
- Homepage: https://ntsd.github.io/svelte-tex/
- Size: 449 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# svelte-tex
[![npm version](https://badge.fury.io/js/svelte-tex.svg)](https://www.npmjs.com/package/svelte-tex)
Svelte Component to convert [TeX](https://en.wikipedia.org/wiki/TeX) to rendered SVG using [MathJax](https://github.com/mathjax/MathJax) or rendered MathML using [Temml](https://github.com/ronkok/Temml).
[Try It Online](https://ntsd.github.io/svelte-tex)
*Svelte 5 Ready*
## Features
- Convert TeX to SVG using [MathJax](https://github.com/mathjax/MathJax)
- Convert TeX to MathML using [Temml](https://github.com/ronkok/Temml)
- Support MathJax options
- Support Temml options## Installation
`npm install svelte-tex`
## Usage
> **`MathML` is more recommended since `MathSVG` bundle size is not small.**
### MathML
```ts
import MathML from 'svelte-tex/package/MathML.svelte';
// use String.raw to escape `\`
const tex = String.raw`\frac{(n^2+n)(2n+1)}{6}`;// or include Temml options
```
### MathSVG
```ts
import MathSVG from 'svelte-tex/package/MathSVG.svelte';
// use String.raw to escape `\`
const tex = String.raw`\frac{(n^2+n)(2n+1)}{6}`;// or include MathJax options
```
> :warning: MathSVG is not small for bundle size.
MathJax is not supports TypeScript for options yet
check texOptions from https://docs.mathjax.org/en/latest/options/input/tex.html#tex-input-processor-options
check svgOptions from https://docs.mathjax.org/en/latest/options/output/svg.html#svg-options