Scanning mathematical text