Base class for all display classes.
A key difficulty with printing is to figure out when to print additional brackets for objects which would otherwise not render correctly. For example, a sum inside a product need brackets, but it does not need brackets when it is given as an argument to a function, because then the brackets are already there from the function call.
| virtual bool cadabra::DisplayBase::needs_brackets |
( |
Ex::iterator |
it | ) |
|
|
protectedpure virtual |
Determine if a node needs extra brackets around it.
Uses context from the parent node if necessary. Has to be implemented in a derived class, because the answer depends on the printing method (e.g. (a+b)/c needs brackets when printed like this, but does not need brackets when printed as {a+b}{c}).
Implemented in cadabra::DisplaySympy, cadabra::DisplayTerminal, and cadabra::DisplayTeX.