On-line recognition of mathematical formulae