# What is the status of generating LaTeX from handwriting (i.e., OCR)?

I type fast enough that for most things it's not a pain, but I have a few big stacks of old course notes I'd like in LaTeX which I'm dreading having to go through. So, I'm just wondering what the best solution for handwriting -> LaTeX is so far, if any.

-
OCR from handwriting is a hard problem by itself with mostly unsatisfactory solutions (AFAIK); I don't think adding equations into the mix will have any better solutions. Still, maybe someone knows better… –  ShreevatsaR Aug 10 '10 at 0:52
Would be nice- but given that OCR even has trouble generating digital copies from scanned typeset text, this may be asking a lot. –  Sharpie Aug 10 '10 at 1:07
I think the best you can hope for from OCR is that you are able to run a full-text search on your scanned notes and have a good chance of finding the right one. This in itself is enough for me (I am not good about organizing notes into a way I can find them again) and the reason I plan to buy a tablet PC for my next laptop. –  Lev Bishop Aug 10 '10 at 1:37
This isn't really a question about LaTeX; the answers would not really be any different if Open Office's format was the target. –  vanden Aug 10 '10 at 6:30
Related discussion in Math SE here. –  hhh Feb 27 '12 at 2:53
show 1 more comment

So, I'm just wondering what the best solution for handwriting -> LaTeX is so far, if any.

There is none, and if there’ll ever be one it’s probably years, if not decades off. I know people who are currently working on recognizing just the layout of a document, i.e. recognizing that a paper represents a letter, etc.

That works fairly well, but it’s still research level, and going from recognizing the layout to replicating the layout using LaTeX is a big, non-obvious step. And we’re not even talking about text recognition itself.

Just text recognition (i.e. ignoring any layout issue) works fairly well today but only for plain text, not with any formatting.

That said, there’s JMathNotes which recognizes basic formulas and produces LaTeX output. It’s a nice and quite powerful proof of concept.

But it’s important to realize that even though many of the individual building blocks exist, piecing together a working solution is hard.

-
JMathNotes looks like a very nice tool at first glance. I'll have to give it a try sometime. –  Giel Aug 10 '10 at 13:22
are there tools to convert formula in a pdf document to latex? besides JMathNotes –  kirill_igum Jan 5 '12 at 6:25
The link gives a 404. –  moose Sep 8 '13 at 12:42

Very impressed by VisualObjects Web Equation

Screenshot (of doncherry's clueless scribbling):

Screenshot (of Aymon's expert scribing):

-
This tool is amazing!! –  Bruno Le Floch Feb 2 '12 at 6:53
Seriously, this is incredible. –  Ryan Reich Feb 2 '12 at 7:58
I shall now buy a graphics tablet. Impressive. –  Harold Cavendish Feb 2 '12 at 8:28
@LordStryker its probably TOO perfect. Humans don't write like that. (If it is based on some sort of training). Just a thought ;) –  Aymon Fournier Feb 2 '12 at 22:48
@AymonFournier You're right! This program actually promotes sloppy handwriting. All joking aside it is pretty swank. However it does need an 'erase' brush. If the interpreter messes up because of a slight mistake in input you have to start over from scratch (unless you're able to finesse it which did not work most of the time for me). –  LordStryker Feb 2 '12 at 23:29
show 7 more comments

I'm the developer of VisionObjects, but I'm not in the research team.

TeX characters are not all supported. Gregory posted on HN a list of chars we support.

Suggestions are welcomed. Do not hesitate to send us missing symbols or UI improvement ideas.

-
I'm not entirely clear what it is VisionObjects is providing - is it only the web apps?. I would dearly love a neat and accessible way to handwrite on my tablet and have the LaTeX inserted directly into (say) TeXnicCenter. –  episanty May 1 '12 at 0:44

It's not a LaTeX solution, but very useful to me: Get a new version of a speech recognition programm and read aloud to your computer.

This is a lot faster than typing, even if you were a professionell typewriter. I bought a "premium" version. There you can define your own speech commands. So the command "techenumeration" makes the software type

\begin{enumerate}
\item
\end{enumerate}


Give it a try, the software works way better than some years ago.

-
what is the name of the program? –  qed Feb 9 at 22:29
@qed Dragon Naturally Speaking –  Keks Dose Feb 10 at 7:58

An iteresting research on Mathematical Information Processing is explained here at the InftyReader project page. It's a Japanese research group.

-

I have summarized the most of the current answers here or below.

I will cover now some papers, work in progress. I understand it so that the Tapio -paper, before preprocessing, uses LP -methods for his formulated QP -puzzle. The Knerr -paper uses discretization of words so one word can have many routes, now getting easily an exponential network-optimization problem. The ON-REC -method is almost the same as the REC-REC -method but some modifications. Knerr has publized a new paper "Combining diverse systems for handwritten text line recognition" (2011). The Japananese paper contains pretty much no details, mostly programming-biased rhetory or worse marketing of their InftyReader.

I. Ernesto Tapia from Freie Uni Berlin, something here but many pages broken, has publications here and his mostly-cited paper below.

• "Recognition of on-line handwritten mathematical formulas in the e-chalk system" here

Key terms: empirical risk, structural risk, pattern recognition, QP -problem, Lagrange multipliers, theory developed by Vapnik and Chervonenkis (VC),

Perhaps important terms: radial basis functions (RBFs), polynomial kernels, hyperbolic kernels, sequential minimal optimization (SMO), --

II. Stefan Knerr (CEO of Vision Objects here, over 70 employees) has publications here, they approach the problem differently -- firstly quantifying different segments into markov chains. Then they get some sort of network -optimization problem that I cannot yet fully understand but trying.

• "Recognition-directed recovering of temporal information from handwriting images" -paper converts words into finite state-machines like the picture here.

Key terms: frame-extraction/vector-quantization/discreate-HMMs here, discrete Hidden Markov Models (HMMs), Tabou method (1984), Baum–Welch training algorithm, ON-REC system, REC–REC system,

"(i) a left–right scan of the word—referred as SCAN–REC further, (ii) a time order of the strokes recovered previously from the static image—referred latter as REC–REC, (iii) a time order of the strokes corresponding to the true online ordering—referred as ON–REC." (the Knerr -paper)

Perhaps important things: IRONOFF database,

III. Japanese researchers such as Masakazu Suzuki, Toshihiro Kanahori, Nobuyuki Ohtake and Katsuhito Yamaguchi -- apparently something to do with Ideal Group -companies such as InftyReader here. Anyway, their most-cited paper below shows a more programming-biased -prototype.

• "An Integrated OCR Software for Mathematical Documents and Its Output with Accessibility" (2004)

Perhaps Key terms: Uniﬁed Braille Code (UBC) by BANA (Braille Authority of North American), working requires "scanned binary images in either 600 DPI or 400 DPI"

Puzzles

1. Is this quadratic programming problem (QP) image here? Source is the Tapia. I understand this so that the author linearize the quadratic programming problem here with Lagrange -multiplier method.

2. "baseline structure analysis method developed by Zanibbi et al [14]. The idea is that mathematical notation can be described as a hierarchical structure of nested baselines." (the Tapia -paper I added the bolding)

3. The Knerr -paper mentions "the second optimization process uses directed graph models" and "The number of possible paths of the ‘‘REC– REC’’ approach for a word with N segments is 2N!" (I added bolding)

Future development

Products

• Microtask breaks the OCR-detection into games where players identify parts that are too hard for computers to detect. In exchange, the gamers can receive digital currencies.
-
Freehand Formula Entry System (FFES) might also be interesting –  moose Sep 8 '13 at 12:45

Inlage (http://www.inlage.com) is a Latex editor which offers recognition of handwritten formulas on Windows 7. It makes use of the Windows 7 math input panel and converts the generated MathML to Latex. See a video of how it works at Inlage II feature: Math Input Panel to LaTeX.

Note: I'm in no way affiliated with this program. TexTablet might be a free alternative.

-
The Math Input Panel works really great! It is part of default Windows 7, in order to start it, just open the start menu and type mip.exe. Also note the related question: tex.stackexchange.com/questions/3755/… –  matth May 22 '12 at 13:35

Given that it hasn't been mention, detexify basically takes handwritten text and produces TeX/LaTeX code (granted on a single symbol scale).

-
I don't think this is a valid answer to this question. While it would be entirely unpractical if it worked, it doesn't even work: I attempted drawing an e and an E, and Detexify didn't recognize them, obviously, because it's only designed for recognizing symbols that need to be input via a special command, not by a single character. –  doncherry Feb 2 '12 at 13:48
@doncherry I agree that detexify has its limitations, but I think it represents "the status of generating LaTeX from handwriting." It is the best solution that I know of. I like it better than the web equation since it gives you its best guesses. –  StrongBad Feb 2 '12 at 14:06
This is indeed the state of the art for single characters, while Aymon's answer gives the state of the art for formulas. –  Bruno Le Floch Feb 2 '12 at 14:15
Detexify is not made for handwriting as input, but for a mouse-scribbled symbol that should look as similar to the printed symbol as possible. This is decisively different from handwriting recognition. Furthermore, Detexify isn't made for recognizing more than one symbol at once and most likely never will be, unless its purpose is changed. Saying it is "the status of generating LaTeX from handwriting" is like saying "cars are the status of flying submarines" -- they really suck at that and they'll never be good at it, unless their purpose undergoes a serious change. –  doncherry Feb 2 '12 at 14:22
@BrunoLeFloch: This is where I like to differentiate between characters and symbols: Roughly saying, the things on your keyboard are characters (unless you're using Neo) -- these usually can be input directly in LaTeX and they won't be recognized by Detexify; it doesn't recognize any normal Latin letters. Other glyphs that actually represent something are symbols. \$ means dollar, means infinity -- but w doesn't mean anything. –  doncherry Feb 2 '12 at 14:26