Feat: change frac to dfrac for fractions
This commit is contained in:
parent
ec823c85eb
commit
5f398b4c8d
@ -74,10 +74,10 @@ class Expression(object):
|
|||||||
2 + 3 \\times 4
|
2 + 3 \\times 4
|
||||||
>>> e = Expression.from_str("2+3/4")
|
>>> e = Expression.from_str("2+3/4")
|
||||||
>>> print(e)
|
>>> print(e)
|
||||||
2 + \\frac{3}{4}
|
2 + \\dfrac{3}{4}
|
||||||
>>> es = e.simplify()
|
>>> es = e.simplify()
|
||||||
>>> print(es)
|
>>> print(es)
|
||||||
\\frac{11}{4}
|
\\dfrac{11}{4}
|
||||||
>>> Expression.set_render('txt')
|
>>> Expression.set_render('txt')
|
||||||
"""
|
"""
|
||||||
from .tokens.token import Token
|
from .tokens.token import Token
|
||||||
|
@ -35,7 +35,7 @@ class MOFraction(Molecule):
|
|||||||
>>> print(f.__txt__)
|
>>> print(f.__txt__)
|
||||||
2 / 3
|
2 / 3
|
||||||
>>> print(f.__tex__)
|
>>> print(f.__tex__)
|
||||||
\\frac{2}{3}
|
\\dfrac{2}{3}
|
||||||
>>> print(f)
|
>>> print(f)
|
||||||
2 / 3
|
2 / 3
|
||||||
>>> f = MOFraction(2, 3, negative = True)
|
>>> f = MOFraction(2, 3, negative = True)
|
||||||
|
@ -117,17 +117,17 @@ def div2tex(left, right):
|
|||||||
|
|
||||||
>>> from ..MO import MO
|
>>> from ..MO import MO
|
||||||
>>> div2tex(MO.factory(2), MO.factory(3))
|
>>> div2tex(MO.factory(2), MO.factory(3))
|
||||||
'\\frac{2}{3}'
|
'\\dfrac{2}{3}'
|
||||||
>>> from ..tree import Tree
|
>>> from ..tree import Tree
|
||||||
>>> t = Tree.from_str("1/2")
|
>>> t = Tree.from_str("1/2")
|
||||||
>>> div2tex(t, MO.factory(3))
|
>>> div2tex(t, MO.factory(3))
|
||||||
'\\frac{\\frac{1}{2}}{3}'
|
'\\dfrac{\\dfrac{1}{2}}{3}'
|
||||||
>>> t = Tree.from_str("1+2")
|
>>> t = Tree.from_str("1+2")
|
||||||
>>> div2tex(t, MO.factory(3))
|
>>> div2tex(t, MO.factory(3))
|
||||||
'\\frac{1 + 2}{3}'
|
'\\dfrac{1 + 2}{3}'
|
||||||
>>> t = Tree.from_str("1*2")
|
>>> t = Tree.from_str("1*2")
|
||||||
>>> div2tex(MO.factory(3), t)
|
>>> div2tex(MO.factory(3), t)
|
||||||
'\\frac{3}{1 \\times 2}'
|
'\\dfrac{3}{1 \\times 2}'
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
left_ = tree2tex(left)
|
left_ = tree2tex(left)
|
||||||
@ -138,7 +138,7 @@ def div2tex(left, right):
|
|||||||
except (AttributeError, ValueError):
|
except (AttributeError, ValueError):
|
||||||
right_ = right.__tex__
|
right_ = right.__tex__
|
||||||
|
|
||||||
return "\\frac{" + left_ + "}{" + right_ + "}"
|
return "\\dfrac{" + left_ + "}{" + right_ + "}"
|
||||||
|
|
||||||
|
|
||||||
def pow2tex(left, right):
|
def pow2tex(left, right):
|
||||||
|
Loading…
Reference in New Issue
Block a user