39

Is there a tool for exporting equation images to TeX? Probably something related to OCR. I have a lot of image-equations in a word document that I'd like to convert to TeX.

Note that the equations are actually images, so no word2tex-like apps would help.

3

7 Answers 7

35

Mathpix Snip: Scanner App for Math and Science

https://www.mathpix.com/

Mathpix Snip digitizes handwritten or printed text, and copies outputs to the clipboard that can be pasted into LaTeX editors like Overleaf, Markdown editors like Typora, Microsoft Word, and more.

Available for MacOS, Windows, Linux (Snap), iOS, and Android.

Originally starting out as a purely mobile app to scan handwritten math over time Mathpix was ported to desktop operating systems, became more powerful and acquired LaTeX scanning functionality. This was also followed by a series of price hikes and nowadays (11/2022) the free plan contains a mere 10 snips per month. Also the privacy policy is pretty lousy and they collect way too much data, like scanned images, email addresses and IP addresses.

Screencast

N.B.: Using this to copy equations from Wikipedia is 100% pointless, because you can also just select the equation with your mouse and press CtrlC, which will put the LaTeX source of that equation in your clipboard.

3
  • 1
    It's now available in Linux as a Snap, too
    – user226564
    Mar 7, 2021 at 17:19
  • 2
    I would suggest to add to the answer the fact that it is a paid app (there is a free tier that lets you convert only 50 formulas/month). May 19, 2021 at 6:14
  • 1
    @FedericoPoloni 5USD/month... a bargain for 5000 snips...
    – JeT
    Nov 4, 2022 at 21:36
10

pix2tex - LaTeX OCR

Free, Open Source

https://github.com/lukas-blecher/LaTeX-OCR

Mathpix is freemium (can only convert a certain amount of formulas per month for free) and scribblemyscience is offline.

This is an open source alternative with a GUI. It is not the most accurate in converting the formulas and you can't convert hand written formulas but it is free and gives good results most of the time.

4
  • Abysmal documentation. Literally impossible to know how to run this.
    – Cybernetic
    Mar 25, 2023 at 1:26
  • @Cybernetic yes it isn't so good for newbies (myself included). But I managed to get it going. During the installation, you get a prompt saying something like "you should add this directory to your path". To do that you need to open the file .bashrc and add export PATH=$PATH:/path/to/directory and then restart the terminal. Then you can execute either pix2tex for the cli program or latexocr for the gui.
    – Ur Ya'ar
    Sep 11, 2023 at 8:43
  • I'll add that for me the gui didn't work at first because I was missing some libraries. The answer here stackoverflow.com/a/60662135 helped me resolve the issue.
    – Ur Ya'ar
    Sep 11, 2023 at 8:44
  • 1
    The main disadvantage of this alternative is that it doesn't know how to distinguish regular text from a LaTeX equation, and will render any text as if its inside $..$ with some font specification (e.g. $\mathrm{text}$). (In my testing, MathPix is capable of this distinction).
    – Ur Ya'ar
    Oct 3, 2023 at 13:05
6

For an open source solution, based on the algorithm introduced in {1}:


References:

  • {1} Deng, Yuntian, Anssi Kanervisto, Jeffrey Ling, and Alexander M. Rush. "Image-to-markup generation with coarse-to-fine attention." In International Conference on Machine Learning, pp. 980-989. PMLR, 2017. http://proceedings.mlr.press/v70/deng17a/deng17a.pdf
1
  • Those are amazing but they're written with python 2.7
    – Rainb
    May 23, 2021 at 7:26
5

In addition to Infty, there's also FFES --- the Freehand Formula Entry System. Paper on it here: http://academia.edu/156023/Handwriting_Speech_for_Computer_Entry_of_Mathematics and it's available here: http://www.cs.rit.edu/~rlaz/ffes/

4

Scribble My Science: convert images or PDF to LaTex

https://scribblemyscience.com

You can upload directly in your web browser images or PDF files. OCR technologies are used to recognize the formulas or text and to generate the LaTeX code.

1
  • 4
    sadly this page has been offline lately Feb 15, 2022 at 13:44
1

Lol, guys... Don't use the hard-path way just if you use generic formula aka you could find it on google. You just search the formula on Wikipedia then inspect the image of formula do you want and select the code it after that show the code TeX on the inspect element (and just copy & paste it) :D enter image description here

2
  • 2
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Nov 22, 2021 at 6:14
  • 2
    what if it is in pdf and not online?
    – Mour_Ka
    Aug 22, 2023 at 8:10
0

I know a lot of time has passed since the question was asked, but you can try this site: https://web.baimiaoapp.com/image-to-latex/en.

P.S. It can sometimes work poorly, but it works properly most of the time.

P.P.S. Or you can also try to use ai chat bots with photo input to convert photo with equation to tex/latex: chatgpt 4 (V) (vision) (paid), google gemini (bard) (free), microsoft copilot (bing ai) (free), llava (free), minigpt4 (free).

New contributor
Михаил Байраков is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .