def latex(self, rate = False):
"""Return the latex code for the reaction.
By default the kinetic parameter of the reaction is included.
To use the rate instead, use rate = True.
:Example:
>>> from crnpy.reaction import Reaction
>>> from crnpy.crncomplex import Complex
>>> r = Reaction("r1", Complex(A = 1, B = 2), Complex(C = 1), "k1*A*B**2")
>>> print(r.latex())
r_{1}: A + 2 B \\xrightarrow{k_{1}} C
>>> print(r.latex(True))
r_{1}: A + 2 B \\xrightarrow{A B^{2} k_{1}} C
:rtype: string.
"""
return "{}: {} {} {}".format(sp.latex(self.reactionid),
sp.latex(self.reactant.symp()),
str("\\xrightarrow{" + sp.latex(self.rate if rate else self.kinetic_param) + "}") if self.rate else str("\\rightarrow"),
sp.latex(self.product.symp()))
评论列表
文章目录