This is a simple Menu Bar app for macOS and a simple GUI app for Windows and Linux that allows you to execute LatexOCR
, a command-line tool for OCR of math equations.
This would not have been possible if not for the great work by Lukas Blecher's LaTeX OCR Project
Install LatexOCR
by running the following command in your preferred conda env
:
pip install 'pix2tex[gui]'
Clone this repository to your local machine by running the following command:
git clone https://github.com/shanto268/snip2tex.git
Install the required library by running the following command:
pip install rumps
Open the snip2tex.py
file and set the command
variable to the path of the latexocr
command on your system.
Path of latexocr
can be found by which latexocr
(macOS and Linux) or by searching for the location of the (get-command latexocr.exe).Path
file (Windows)
Run the app by running the following command:
python snip2tex.py
After running the app, it should create a Menu Bar Tool - and all you need to do is press Snip2TeX
and then a new window (left figure below) would pop up.
Click on the Snip
button or press Option+S
and then it would act like a screenshot feature (blue region below) similar to what happens when you press Cmd+Shift+4
(middle figure below)
but now whatever feature you cover should be an equation and once you are done snapping it will generate the corresponding LaTeX
code that you can simply copy (right figure below)
After running the app, a simple GUI window will appear with a "Snip2TeX" button and an output area. Press the "Snip2TeX" button to execute the LatexOCR command, and the output will be displayed in the output area. To close the application, press the "Quit" button.
This project is licensed under the MIT License - see the LICENSE file for details.