convertMathExpressionToTeXNode function
TeXNode
convertMathExpressionToTeXNode(
- Expression mathExpression
Converts the input mathExpression
to a TeXNode
.
Implementation
TeXNode convertMathExpressionToTeXNode(Expression mathExpression) {
// The AST is not properly built (as in it is not well designed) because
// nodes do not have a common super type. If they had, it would be easy to
// convert the expression tree to a TeX tree. Like this we need two different
// functions for handling "nodes" and bare "TeX".
// todo: refactor AST.
final node = TeXNode(null);
node.children.addAll(_convertToTeX(mathExpression, node));
return node;
}