Amaya tackles this problem by using namespaces. Formally, they are XML documents and can take advantage of the XML mechanisms for mixing various XML vocabularies in a single structure. As well as mathematical expressions, the whole document is represented by a tree in Amaya. This allows formulas and text to be integrated seamlessly. Text elements and formulas are part of the same structure and are manipulated by the same functions.
Tight integration brings more benefits.
At no additional cost, other web technologies available in Amaya can be used for mathematics. That is the case for links, style, and metadata. Amaya implements simple links from XLink. The source and the target of such links may be any element in a document tree, a textual element, or any part of a mathematical expression as well. Hypertext no longer applies to text and images only, but also to math.