Install LaTeX-OCR recognition tool on M1
Feb 25, 2023
LaTeX-OCR is a well-known, open-source, and free OCR recognition tool that is widely used as an alternative to Mathpix.
However, due to compatibility issues with cross-platform modules such as pytorch and qt, installing this tool on an
arm64host requires certain operations.
- Install compiled qt library through brew
- Install pytorch through conda
pip install "pix2tex[gui]"the module
brew install pyqt@5the GUI dependency
sudo cp -r /opt/homebrew/Cellar/pyqt@5/5.15.7_2/lib/python3.9/site-packages/* /Users/rey/miniconda3/lib/python3.9/site-packages/* since you cannot find a compatible version on the official forge of pip or conda
pip install pynput screeninforequired by the package
conda install pytorch torchvisionconda will try to install a better version of pytorch on arm 64
python -m pix2tex latexocr
- Screenshot the LaTeX image to be recognized to the clipboard
- Wait for the terminal to display the recognized text, and the LaTeX text has been automatically copied to the clipboard.
For the chained probability formula in the Stanford CS324 Large Language Model lecture notes:
Recognized as LaTeX code:
Rendered equivalent to:
You can see that there are some small errors, but it can save a lot of time.
 Related issue: https://github.com/lukas-blecher/LaTeX-OCR/issues/234
 Official installation tutorial: https://github.com/lukas-blecher/LaTeX-OCR