Show HN: Math2Tex – Convert handwritten math and complex notes to LaTeX text
Hi HN,
I’m the creator of Math2Tex. I was a PhD student, I spend a huge amount of my time working with LaTeX, especially when dealing with lecture notes, academic papers, and homework. I built *Math2Tex*, a lightweight tool that converts handwritten or printed academic content — especially math formulas — into LaTeX or text
The Problem:
I've always found it incredibly tedious to manually type out mathematical formulas, especially complex, multi-line equations from my handwritten notes or from a textbook. It's slow, boring, and I always make syntax errors. I tried some existing tools, but they often struggled with my handwriting or couldn't handle mixed content (text and formulas together).
The Solution:
So, I built Math2Tex to solve my own problem. It’s a straightforward, single-page web app: you upload an image (a photo of your notebook, a screenshot of a PDF, etc.), and it converts the academic content into clean LaTeX code or plain text. You get a real-time preview and can copy the result with one click. My goal was to make the workflow as fast as possible: Snap. Convert. Done.
You can try it here: [https://math2tex.com](https://math2tex.com/)
How is it different from general AI tools like GPT, Claude, etc?
This is a fair question. While large models can handle this, they are often slow for such a specific task. I wanted something faster and more specialized. Math2Tex uses a lightweight model fine-tuned specifically for academic content recognition.
In short, think of it as a specialized scalpel versus a Swiss Army knife. For this particular job, it's generally 3-5x faster and, in my experience, more reliable for complex notations.
Tech Stack:
The core OCR engine is a custom-trained model based on a transformer architecture, fine-tuned on a large dataset of both printed and handwritten academic material. It's all deployed on Vercel.
*It's free to use.* This is still an early version, and I'm sure there are plenty of bugs and areas for improvement. The recognition might not be perfect, especially with very messy handwriting or some obscure symbols.
I would be incredibly grateful for your feedback. Whether you’re a student, researcher, or someone who’s fought with LaTeX input. Feedback on both the tool and the approach would be really helpful.
Thanks!
Thank you! The other popular tools I'm aware of in this space is MathPix [1] (paid) and Latex-OCR [2] (oss)
[1] https://mathpix.com/image-to-latex [2] https://github.com/lukas-blecher/LaTeX-OCR
Where did you get a large dataset of handwritten maths? I have been looking for such a thing, and I have a lot of my own, but that's just one person's handwriting.
I have had a lot of success recently using the open-weight Qwen2.5-VL-7B through Ollama to convert hundreds of handwritten slides to Latex. Plenty of manual work still needed though.
Is it possible to ad a whiteboard to draw simple formulas?
It requires a Google account. Is it possible to show a precalculated result for the examples? (I like the examples! But I want to see how is the generated LaTeX code.)
Thank you for your suggestion. The whiteboard drawing has been recorded in the to-do list. Additionally, you can click on the examples to try. These require logging.
I was proposing some samples where the result is calculated by you beforehand, so it's possible to see the result without login in. (Pinky promise that you are not cheating and showing a fake result.)
There were already a couple of tools in this space for folks to contrast/compare:
inftyeditor: https://www.inftyproject.org/en/software.html
ffes: https://www.cs.rit.edu/~rlaz/ffes/
TeXview.app had an option to enter a single character using a graphics tablet or mouse which worked quite well (and allowed me to type up notes for a college professor).
detexify (https://detexify.kirelabs.org/classify.html) also does drawn character identification and is a webpage.
I uploaded a picture of handwritten note. Why doesn't it return latex code? Below is the output(source code part) of your website:
二. 毕萨伐尔定律: B=∫dB = ∫(μ₀I dl × eᵣ)/(4πr²)
1. 载流长直导线. [图示:三角形,角度θ₁、θ₂,电流方向向里(叉号)] B = (μ₀I)/(4πr₀) (cosθ₁ - cosθ₂) = (μ₀I)/(4πr₀) [cosθ₁ + cos(π - θ₂)] 无限长直导线: B = μ₀I/(2πr) 半无限长直导线: B = μ₀I/(4πr₀)
推导: dB = (μ₀)/(4π) · (Idz sinθ)/r² B = ∫(μ₀I dz sinθ)/(4πr²) 由于各电流元产生的磁场方向相同 z = r₀ ctg(π - θ) = -r₀ ctgθ dz = r₀ dθ/sin²θ r = r₀/sin(π - θ) = r₀/sinθ B = ∫(μ₀I r₀ dθ sinθ)/(4π r₀²/sin²θ · sin²θ) = ∫(μ₀I sinθ dθ)/(4πr₀) = (μ₀I)/(4πr₀) ∫_{θ₁}^{θ₂} sinθ dθ = (μ₀I)/(4πr₀) (cosθ₁ - cosθ₂) = (μ₀I)/(4πr₀) [cosθ₁ + cos(π - θ₂)]
载流圆线圈在轴线上: 注 若有N匝则 需要乘以N [图示:圆线圈,轴线上点P,半径R,距离x,电流元Idl,磁场方向沿x轴] Bₓ = (μ₀p²I)/[2(p² + x²)^(3/2)] ① x=0, 即电流环中心的磁感应强度: B = μ₀I/(2R) ② x≫a, (p² + x²)^(3/2) ≈ x³, B = (μ₀Ip²)/(2x³) 引入磁矩, \(\vec{m} = I\vec{S} = IS\vec{e}_n\) 对任意形状的平面载流线圈都适 轴线上的磁感应强度, \(\vec{B} = \frac{\mu_0 I p^2 \vec{e}_n}{2x^3} = \frac{\mu_0}{2\pi} \frac{\vec{m}}{x^3}\)
推导: 由图和右手定则可以判断出磁场只有沿x的分量 dB = (μ₀I)/(4πr²) dl cosα = p/r = p/√(p² + x²) Bₓ = (μ₀I cosα)/(4πr²) ∮dl = (μ₀I p)/(4πr² r) · 2πp = (μ₀I p²)/(2r⁴) = (μ₀I p²)/[2(p² + x²)^(3/2)]
I'm always happy to see more innovation in this area. It'd be great if you could make your model, weights, and training corpus public (preferably under a permissive license) on GitHub. It'd also be great if you could run some benchmarks against the other similar tools in this area (I'm thinking particularly of Mathpix, Equatio, and Microsoft's math OCR in OneNote, Word, and Azure APIs. If you make your test corpus and code available I could set up the benchmarks for you.
I agree that it would be nice if the model was open weights and could run locally.
I have digitized almost all of my college handwritten notes, I would love to transcribe them, check them for errors, and contribute that as training data, but only for open weights models.
I feel like an open weights and even open training data model is just about inevitable here, because a lot of people will feel the same way you do.
Any reason for using a transformer architecture? You look at https://olmocr.allenai.org/ which does the best handwritten-to-latex in my opinion also does use VLM.
Also maybe xD not use LLMs to generate your HN description.
I won't log in to a site i don't know or trust
This is great! The LaTeX community will grow much more thanks to user friendly tools.
is the source open?