(self, expr, exp=None)
Render functions to LaTeX, handling functions that LaTeX knows about
        e.g., sin, cos, ... by using the proper LaTeX command (\sin, \cos, ...).
        For single-letter function names, render them as regular LaTeX math
        symbols. For multi-letter function names that LaTeX does not know
        about, (e.g., Li, sech) use \operatorname{} so that the function name
        is rendered in Roman font and LaTeX handles spacing properly.

        expr is the expression involving the function
        exp is an exponent
Render functions to LaTeX, handling functions that LaTeX knows about
        e.g., sin, cos, ... by using the proper LaTeX command (\sin, \cos, ...).
        For single-letter function names, render them as regular LaTeX math
        symbols. For multi-letter function names that LaTeX does not know
        about, (e.g., Li, sech) use \operatorname{} so that the function name
        is rendered in Roman font and LaTeX handles spacing properly.
Render functions to LaTeX handling functions that LaTeX knows about e . g . sin cos ... by using the proper LaTeX command ( \ sin \ cos ... ) . For single - letter function names render them as regular LaTeX math symbols . For multi - letter function names that LaTeX does not know about ( e . g . Li sech ) use \ operatorname {} so that the function name is rendered in Roman font and LaTeX handles spacing properly .
def _print_Function(self, expr, exp=None):
        '''
        Render functions to LaTeX, handling functions that LaTeX knows about
        e.g., sin, cos, ... by using the proper LaTeX command (\sin, \cos, ...).
        For single-letter function names, render them as regular LaTeX math
        symbols. For multi-letter function names that LaTeX does not know
        about, (e.g., Li, sech) use \operatorname{} so that the function name
        is rendered in Roman font and LaTeX handles spacing properly.

        expr is the expression involving the function
        exp is an exponent
        '''
        func = expr.func.__name__

        if hasattr(self, '_print_' + func):
            return getattr(self, '_print_' + func)(expr, exp)
        else:
            args = [ str(self._print(arg)) for arg in expr.args ]
            # How inverse trig functions should be displayed, formats are:
            # abbreviated: asin, full: arcsin, power: sin^-1
            inv_trig_style = self._settings['inv_trig_style']
            # If we are dealing with a power-style inverse trig function
            inv_trig_power_case = False
            # If it is applicable to fold the argument brackets
            can_fold_brackets = self._settings['fold_func_brackets'] and \
                len(args) == 1 and \
                not self._needs_function_brackets(expr.args[0])

            inv_trig_table = ["asin", "acos", "atan", "acot"]

            # If the function is an inverse trig function, handle the style
            if func in inv_trig_table:
                if inv_trig_style == "abbreviated":
                    func = func
                elif inv_trig_style == "full":
                    func = "arc" + func[1:]
                elif inv_trig_style == "power":
                    func = func[1:]
                    inv_trig_power_case = True

                    # Can never fold brackets if we're raised to a power
                    if exp is not None:
                        can_fold_brackets = False

            if inv_trig_power_case:
                if func in accepted_latex_functions:
                    name = r"\%s^{-1}" % func
                else:
                    name = r"\operatorname{%s}^{-1}" % func
            elif exp is not None:
                name = r'%s^{%s}' % (self._hprint_Function(func), exp)
            else:
                name = self._hprint_Function(func)

            if can_fold_brackets:
                if func in accepted_latex_functions:
                    # Wrap argument safely to avoid parse-time conflicts
                    # with the function name itself
                    name += r" {%s}"
                else:
                    name += r"%s"
            else:
                name += r"{\left (%s \right )}"

            if inv_trig_power_case and exp is not None:
                name += r"^{%s}" % exp

            return name % ",".join(args)
def _print_Function ( self , expr , exp = None ) : func = expr . func . __name__ if hasattr ( self , '_print_' + func ) : return getattr ( self , '_print_' + func ) ( expr , exp ) else : args = [ str ( self . _print ( arg ) ) for arg in expr . args ] # How inverse trig functions should be displayed, formats are: # abbreviated: asin, full: arcsin, power: sin^-1 inv_trig_style = self . _settings [ 'inv_trig_style' ] # If we are dealing with a power-style inverse trig function inv_trig_power_case = False # If it is applicable to fold the argument brackets can_fold_brackets = self . _settings [ 'fold_func_brackets' ] and len ( args ) == 1 and not self . _needs_function_brackets ( expr . args [ 0 ] ) inv_trig_table = [ "asin" , "acos" , "atan" , "acot" ] # If the function is an inverse trig function, handle the style if func in inv_trig_table : if inv_trig_style == "abbreviated" : func = func elif inv_trig_style == "full" : func = "arc" + func [ 1 : ] elif inv_trig_style == "power" : func = func [ 1 : ] inv_trig_power_case = True # Can never fold brackets if we're raised to a power if exp is not None : can_fold_brackets = False if inv_trig_power_case : if func in accepted_latex_functions : name = r"\%s^{-1}" % func else : name = r"\operatorname{%s}^{-1}" % func elif exp is not None : name = r'%s^{%s}' % ( self . _hprint_Function ( func ) , exp ) else : name = self . _hprint_Function ( func ) if can_fold_brackets : if func in accepted_latex_functions : # Wrap argument safely to avoid parse-time conflicts # with the function name itself name += r" {%s}" else : name += r"%s" else : name += r"{\left (%s \right )}" if inv_trig_power_case and exp is not None : name += r"^{%s}" % exp return name % "," . join ( args )