Kroki [1] supports TikZ and by extension: PGF [2] and LaTeX. It supports SVG, PDF, JPEG, and PNG outputs. Rendering is done on the server. URLs can be quite long since the source is embedded in the URL but you can use a URL shortener [3].
1. Add tooltips to the top icons
2. Support SVG output
Wdorf 5 hours ago [-]
Thank you, those are both very good suggestions I will look into!
mindv0rtex 3 hours ago [-]
I was recently trying to solve a similar problem but on desktop platforms. I don't want to depend on LaTeX, but I'd like to be able to generate equation images inside a C++ desktop application. I tried to make MathJax run via QuickJS and extract the SVG for rasterization. But I couldn't make MathJax run with QuickJS.
Cieric 7 hours ago [-]
Shorts link didn't work for me, here is the normal player link
I'm not to familiar with LaTeX so I much prefer a WYSIWYG editor. I mainly use things like wolframalpha's editor to really get a good representation of what I need.
I know something like that might be out of scope for something like this, but you could potentially do preprogrammed buttons like having a sqrt button insert "\sqrt{}" to the cursor position.
Wdorf 7 hours ago [-]
Thank you very much for your feedback, I will look into adding more keyboard buttons like "\sqrt{}"
mgt19937 6 hours ago [-]
Cool project! I like the idea of easily sharing LaTeX formulas. It's impressive how smooth it works right in the browser.
I've always thought compiling LaTeX in WebAssembly would be a tough nut to crack, so I was curious if that's what you'd done here. Turns out you're using KaTeX.
Have you considered any WebAssembly approaches?
Wdorf 6 hours ago [-]
Thank you for your positive feedback.
KaTeX does not support all LaTeX features but initializes very quickly.
LaTeX via WebAssembly supports more features but might need longer to initialize.
I played with web2js a couple of years ago. TeX ends up being a 500kb WASM file (88kb gzipped).
The LaTeX format file or the memory image after LaTeX is loaded are a bit bigger though (2.3 MB and 6.3MB gzipped, respectively).
jszymborski 6 hours ago [-]
Not OP, but do you mind me asking what advantages you hope to achieve by using WebAssembly rather than KaTeX?
trurl42 6 hours ago [-]
Well, for one, KaTeX doesn't do "LaTeX" but a limited subset of the TeX equation syntax.
As such, it can't handle more complicated macros or typesetting anything apart from equations.
ComputerGuru 5 hours ago [-]
I’d be very interested in the opposite! Lots of scanned or legacy images that would be nice to convert to LaTeX, or to create a robust PDF ingestion pipeline.
Facebook's Nougat [1] should work with this, but not sure how much preprocessing is needed to yield good results with scanned copies of physical documents. Note that it outputs .mmd files (MultiMarkDown), but the equations and tables should (iirc) output plain LaTeX.
Have you considered translating formulae to MathML for rendering?
Wdorf 5 hours ago [-]
KaTeX has a build in MathML feature, but I haven't yet looked into it for rendering.
The "Share text" functionality of the website uses KaTeX's MathML feature as an intermediate step.
einpoklum 5 hours ago [-]
It looks like OP is already doing that. Or rather, OP calls katex (https://katex.org/) to get MathML and HTML; then renders the HTML to a raster image. But he's throwing the MathML away.
KeplerBoy 6 hours ago [-]
How does it work? Are you shipping a wasm latex distribution?
Okay, so it's not LaTeX, just math typesetting that looks like LaTeX and takes LaTeX input.
I'm more interested in solutions that work with the broader LaTeX ecosystem (like SiUnitX or amsmath).
abdullahkhalids 1 hours ago [-]
Mathjax does support a whole bunch of common latex math related packages [1]. SiUnitX is notably missing from the inbuilt extensions, but a port to version 2 is available [2]. Should be updated to version 3.
Ahh. I was confused for a moment why \def wasn't working.
einpoklum 5 hours ago [-]
> Please let me know any feedback on how to improve the website.
1. You can give credit where it is due - on the website, to katex and the HTML-to-image renderer library/engine.
2. You could offer any of the three possible outputs: Raster image, HTML, MathML - for exporting/sharing/downloading.
Wdorf 5 hours ago [-]
Thank you for your feedback.
I've just added the links to both projects in the info modal.
I will look into adding HTML and MathML exports in the next version.
Rendered at 21:37:42 GMT+0000 (Coordinated Universal Time) with Vercel.
[1]: https://kroki.io/ [2]: https://tikz.dev/ [3]: https://tinyurl.com/kroki-svg-example
https://www.youtube.com/watch?v=fGuTns5Nt9Q
I'm not to familiar with LaTeX so I much prefer a WYSIWYG editor. I mainly use things like wolframalpha's editor to really get a good representation of what I need.
I know something like that might be out of scope for something like this, but you could potentially do preprogrammed buttons like having a sqrt button insert "\sqrt{}" to the cursor position.
I've always thought compiling LaTeX in WebAssembly would be a tough nut to crack, so I was curious if that's what you'd done here. Turns out you're using KaTeX.
Have you considered any WebAssembly approaches?
KaTeX does not support all LaTeX features but initializes very quickly.
LaTeX via WebAssembly supports more features but might need longer to initialize.
There's an existing WebAssembly project: https://www.swiftlatex.com
[1] https://tikzjax.com/
The LaTeX format file or the memory image after LaTeX is loaded are a bit bigger though (2.3 MB and 6.3MB gzipped, respectively).
1: https://github.com/facebookresearch/nougat
https://mathpix.com/
https://aops.com/texer
The "Share text" functionality of the website uses KaTeX's MathML feature as an intermediate step.
Image generation: https://github.com/bubkoo/html-to-image
I'm more interested in solutions that work with the broader LaTeX ecosystem (like SiUnitX or amsmath).
[1] https://docs.mathjax.org/en/latest/input/tex/extensions/inde...
[2] https://github.com/mathjax/MathJax-third-party-extensions
1. You can give credit where it is due - on the website, to katex and the HTML-to-image renderer library/engine. 2. You could offer any of the three possible outputs: Raster image, HTML, MathML - for exporting/sharing/downloading.
I've just added the links to both projects in the info modal.
I will look into adding HTML and MathML exports in the next version.