From fadd93b9a6708edd1cb22b4267a3d7e619d87a25 Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Mon, 4 Nov 2019 09:43:52 +0100 Subject: [PATCH] Feat: change frac to dfrac for fractions --- mapytex/calculus/API/expression.py | 4 ++-- mapytex/calculus/core/MO/fraction.py | 2 +- mapytex/calculus/core/renders/tree2tex.py | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mapytex/calculus/API/expression.py b/mapytex/calculus/API/expression.py index fe55096..a7f7eb3 100644 --- a/mapytex/calculus/API/expression.py +++ b/mapytex/calculus/API/expression.py @@ -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 diff --git a/mapytex/calculus/core/MO/fraction.py b/mapytex/calculus/core/MO/fraction.py index 16ee737..c73dacc 100644 --- a/mapytex/calculus/core/MO/fraction.py +++ b/mapytex/calculus/core/MO/fraction.py @@ -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) diff --git a/mapytex/calculus/core/renders/tree2tex.py b/mapytex/calculus/core/renders/tree2tex.py index d64abdd..c6dc8b5 100644 --- a/mapytex/calculus/core/renders/tree2tex.py +++ b/mapytex/calculus/core/renders/tree2tex.py @@ -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):