Create LaTeX code for prettyprinting a mathematical expression (for example via MathJax) More...
Public Member Functions | |
__construct () | |
Constructor. More... | |
visitExpressionNode (ExpressionNode $node) | |
Generate ASCII output code for an ExpressionNode. More... | |
visitNumberNode (NumberNode $node) | |
Interface function for visiting NumberNodes. More... | |
visitIntegerNode (IntegerNode $node) | |
Interface function for visiting IntegerNodes. More... | |
visitRationalNode (RationalNode $node) | |
Interface function for visiting RationalNodes. More... | |
visitVariableNode (VariableNode $node) | |
Interface function for visiting VariableNodes. More... | |
visitFunctionNode (FunctionNode $node) | |
Interface function for visiting FunctionNode. More... | |
visitConstantNode (ConstantNode $node) | |
Interface function for visiting ConstantNode. More... | |
parenthesize (Node $node, ExpressionNode $cutoff, $prepend='') | |
Private Attributes | |
$lexer | |
StdMathLexer $lexer. | |
Create LaTeX code for prettyprinting a mathematical expression (for example via MathJax)
Implementation of a Visitor, transforming an AST into a string giving LaTeX code for the expression.
The class in general does not generate the best possible LaTeX code, and needs more work to be used in a production setting.
Note that surrounding $
, $$
or \begin{equation}..\end{equation}
has to be added manually.
MathParser\Interpreting\ASCIIPrinter::__construct | ( | ) |
Constructor.
Create an ASCIIPrinter.
MathParser\Interpreting\ASCIIPrinter::visitConstantNode | ( | ConstantNode | $node | ) |
Interface function for visiting ConstantNode.
ConstantNode | $node | Node to visit. |
Implements MathParser\Interpreting\Visitors\Visitor.
MathParser\Interpreting\ASCIIPrinter::visitExpressionNode | ( | ExpressionNode | $node | ) |
Generate ASCII output code for an ExpressionNode.
Create a string giving ASCII output representing an ExpressionNode (x op y)
where op
is one of +
, -
, *
, /
or ^
ExpressionNode | $node | AST to be typeset |
string |
Implements MathParser\Interpreting\Visitors\Visitor.
MathParser\Interpreting\ASCIIPrinter::visitFunctionNode | ( | FunctionNode | $node | ) |
Interface function for visiting FunctionNode.
FunctionNode | $node | Node to visit. |
Implements MathParser\Interpreting\Visitors\Visitor.
MathParser\Interpreting\ASCIIPrinter::visitIntegerNode | ( | IntegerNode | $node | ) |
Interface function for visiting IntegerNodes.
IntegerNode | $node | Node to visit. |
Implements MathParser\Interpreting\Visitors\Visitor.
MathParser\Interpreting\ASCIIPrinter::visitNumberNode | ( | NumberNode | $node | ) |
Interface function for visiting NumberNodes.
NumberNode | $node | Node to visit. |
Implements MathParser\Interpreting\Visitors\Visitor.
MathParser\Interpreting\ASCIIPrinter::visitRationalNode | ( | RationalNode | $node | ) |
Interface function for visiting RationalNodes.
RationalNode | $node | Node to visit. |
Implements MathParser\Interpreting\Visitors\Visitor.
MathParser\Interpreting\ASCIIPrinter::visitVariableNode | ( | VariableNode | $node | ) |
Interface function for visiting VariableNodes.
VariableNode | $node | Node to visit. |
Implements MathParser\Interpreting\Visitors\Visitor.