1. A system with a processor for handwritten mathematical expression recognition, the system comprising a subscript/superscript analysis and character determination component configured to identify subscript/superscript structures and to determine a character which comes from a character candidates list for each symbol corresponding to handwritten mathematical expression input strokes by, for a sub-expression of the handwritten mathematical expression, generating by the processor a vertex for each symbol of the sub-expression; creating by the processor edges between pairs of vertices, each edge having a relationship selected from the group consisting of subscript, horizontal, and superscript and having a score derived from a space score representing the spatial relationship between the symbols of the vertices, a context probability score representing a short grammar for mathematical expressions, and confidence of the symbols of the vertices generated by a symbol grouping and recognition component; finding by the processor optimized spanning trees from a graph represented by the vertices and edges; identifying by the processor found spanning trees that satisfy the grammar for mathematical expressions; and adding by the processor an identified spanning tree to a parse tree representing the mathematical expression.