def _print_Function(self, expr, exp=None): ''' For ite() only ''' func = expr.func.__name__ args = [ str(self._print(arg)) for arg in expr.args ] if func == 'ite': return """\\begin{cases} %(then_code)s \qquad \\text{if} \quad %(if_code)s \\\\ %(else_code)s \qquad \\text{otherwise.} \end{cases}""" % {'if_code': args[0], 'then_code': args[1], 'else_code': args[2]} elif func in ['positive', 'pos']: return "\left(" + str(self._print(args[0])) + "\\right)^+" elif func in ['negative', 'neg']: return "(" + str(self._print(args[0])) + ")^-" return LatexPrinter._print_Function(self, expr, exp)
def _print_Function(self, expr, *args, **kwargs): if isinstance(expr, _AppliedUndef): return self._print_Symbol(sp.Symbol(expr.func.__name__)) return expr.func.__name__ return _LatexPrinter._print_Function(self, expr, *args, **kwargs)