41

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.

mreq
  • 1,111

7 Answers7

36

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.

Henri Menke
  • 109,596
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.

JonasV
  • 199
  • Abysmal documentation. Literally impossible to know how to run this. – Cybernetic Mar 25 '23 at 01: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 '23 at 08:43
  • I'll add that for me the gui didn't work at first because I was missing some libraries. The answer here https://stackoverflow.com/a/60662135 helped me resolve the issue. – Ur Ya'ar Sep 11 '23 at 08: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 03 '23 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
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/

WillAdams
  • 7,187
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.

PLB
  • 57
  • 1
  • 1
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
    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 Nov 22 '21 at 06:14
  • 3
    what if it is in pdf and not online? – Mour_Ka Aug 22 '23 at 08: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).