uechi.io/source/_posts/2018/math-api.md

45 lines
1.3 KiB
Markdown
Raw Normal View History

2019-08-29 03:21:25 +09:00
---
2022-12-24 03:20:02 +09:00
title: "Math API: LaTeX Math as SVG image"
2019-08-29 03:24:59 +09:00
date: 2018-10-23 03:19:00 +09:00
2019-08-29 03:21:25 +09:00
---
I've always wanted to put LaTeX Math equations on a web page where MathJax is not allowed to run inside it.
Spending some time, I made [Math API](https://math.now.sh), that renders LaTeX Math markup into an SVG image.
So you can place your equation on almost everywhere on which you could put `<img>` or Markdown (`![]()`), such as GitHub, Jupyter Notebook or dev.to (here!).
```markdown
2019-08-29 03:28:50 +09:00
![](https://math.now.sh?from=\LaTeX)
2019-08-29 03:21:25 +09:00
```
2019-08-29 03:28:50 +09:00
![Equation](https://math.now.sh?from=%5CLaTeX)
2019-08-29 03:21:25 +09:00
```markdown
2019-08-29 03:28:50 +09:00
![](https://math.now.sh?from=\log\prod^N_{i}x_{i}=\sum^N_i\log{x_i})
2019-08-29 03:21:25 +09:00
```
2019-08-29 03:28:50 +09:00
![Equation](https://math.now.sh?from=%5Clog%5Cprod%5EN_%7Bi%7Dx_%7Bi%7D%3D%5Csum%5EN_i%5Clog%7Bx_i%7D)
2019-08-29 03:21:25 +09:00
# Inline image
2022-12-24 03:20:02 +09:00
![](/uploads/fqea9nq2wv9in15lqlf3.png.jpeg)
![](/uploads/43slt0h6dfhox1xwmuti.png.jpeg)
2019-08-29 03:21:25 +09:00
It is possible to generate an inline equation by changing the query from `from` to `inline`.
```markdown
<img src="https://math.now.sh?inline=\\LaTeX" />
```
# Online Editor
Also, there is the online editor available at https://math.now.sh.
2022-12-24 03:20:02 +09:00
![](/uploads/gg2wil3exu9lyj7ppuoy.png)
2019-08-29 03:21:25 +09:00
# Conclusion
The source code is available on [GitHub](https://github.com/uetchy/math-api).
2022-12-24 03:20:02 +09:00
Give it a try and leave a comment/idea for a new feature.