In this article, we present a system for the recognition of on-line handwritten mathematical formulas which is used in the electronic chalkboard (E-chalk), a multimedia system for distance-teaching. We discuss the classification of symbols and the construction of the tree of spatial relationships among them. The classification is based on support vector machines and the construction of formulas is based on baseline structure analysis.