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