Example #1
0
 def latex(self, **kwargs):
     if self.getStyle('division')=='fraction':
         # only fence if forceFence=True (a fraction within an exponentiation is an example of when fencing should be forced)
         kwargs['fence'] = kwargs['forceFence'] if 'forceFence' in kwargs else False        
         return maybeFencedLatex(r'\frac{'+self.numerator.latex()+'}{'+self.denominator.latex()+'}', **kwargs)
     else:
         return Operation.latex(**kwargs) # normal division
Example #2
0
 def latex(self, **kwargs):
     # Turn sub-fence on since the operator is just a space that
     # doesn't serve as a good delimiter of the operands.
     if self.operands.is_single():
         # Single operand: wrap it in square braces to show
         # we are treating it as an operator (a function).
         return r'\left[' + self.operand.latex() + r'\right]'
     kwargs['sub_fence'] = True
     return Operation.latex(self, **kwargs)