This document describes the list of parameters to control the behavior of latexify
.
Key-value pair of identifiers to replace.
identifiers = {
"my_function": "f",
"my_inner_function": "g",
"my_argument": "x",
}
@latexify.function(identifiers=identifiers)
def my_function(my_argument):
return my_inner_function(my_argument)
my_function
Whether to compose all variables defined before the return
statement.
The current version of latexify
recognizes only the assignment statements.
Analyzing functions with other control flows may raise errors.
@latexify.function(reduce_assignments=True)
def f(a, b, c):
discriminant = b**2 - 4 * a * c
numerator = -b + math.sqrt(discriminant)
denominator = 2 * a
return numerator / denominator
f
Whether to automatically convert variables with symbol names into LaTeX symbols or not.
@latexify.function(use_math_symbols=True)
def greek(alpha, beta, gamma, Omega):
return alpha * beta + math.gamma(gamma) + Omega
greek
Whether to use binary operators for set operations or not.
@latexify.function(use_set_symbols=True)
def f(x, y):
return x & y, x | y, x - y, x ^ y, x < y, x <= y, x > y, x >= y
f
Whether to output the function signature or not.
The default value of this flag depends on the frontend function.
True
is used in latexify.function
, while False
is used in latexify.expression
.
@latexify.function(use_signature=False)
def f(a, b, c):
return (-b + math.sqrt(b**2 - 4 * a * c)) / (2 * a)
f