pix2tex (LaTeX-OCR) is a learning-based system that takes an image of a math formula and returns the corresponding LaTeX code. It uses a ViT-based model and is aimed at anyone who needs to convert equation images into LaTeX, from researchers to students. It can be used via a command line tool, a GUI with screenshot capture, an API with a Streamlit demo, or directly from Python.
Install & use
Install
pip install "pix2tex[gui]"
Usage
latexocr
lukas-blecher/LaTeX-OCR is a third-party open-source project, listed here from public GitHub data. ImuTechz did not write it and has not reviewed or security-audited its code. Read the source and its permissions before you install or run it.
Features
Converts images of math formulas into LaTeX code
Command line tool that parses images from disk or clipboard
GUI (latexocr) for screenshots with MathJax rendering and clipboard copy
API mode with Streamlit demo and Docker image
Python usage via LatexOCR class
Automatic preprocessing that resizes input images to optimal resolution
Best for
Digitizing equations from papers or screenshots
Quick LaTeX capture from screen via GUI
Batch conversion of equation images from disk
Integrating equation OCR into Python workflows
Pros
Model checkpoints are downloaded automatically
Offers CLI, GUI, API, and Python interfaces
Preprocessing step resizes images to improve performance on real-world images
Training code and dataset generation are included
Cons
Requires Python 3.7+ and PyTorch installed separately
Works best with smaller-resolution images and may not handle huge images optimally
Results should be double-checked as predictions can be wrong