Ticket #12156: 12156_add_LatexExpr.patch

File 12156_add_LatexExpr.patch, 844 bytes (added by jdemeyer, 10 years ago)

Add to LatexExpr? (added space in between the two)

  • sage/misc/latex.py

    # HG changeset patch
    # User P Purkayastha <ppurka@gmail.com>
    # Date 1324087690 -28800
    # Node ID 12dbe7027b7b3dff43192ff7e069ba8363de2660
    # Parent  7cd1c80fabc9107eeb84bb8f39ba2283f872e5cc
    Add two LatexExpr instances
    
    diff --git a/sage/misc/latex.py b/sage/misc/latex.py
    a b  
    411411        sage: type(L)
    412412        <class 'sage.misc.latex.LatexExpr'>
    413413    """
     414    def __add__(self, other):
     415        r"""
     416        Add two instances of LatexExpr.
     417
     418        EXAMPLES::
     419
     420            sage: o = LatexExpr(r"\Delta\neq") + LatexExpr(r"\frac{x}2"); o
     421            \Delta\neq \frac{x}2
     422            sage: type(o)
     423            <class 'sage.misc.latex.LatexExpr'>
     424        """
     425        return LatexExpr(str(self) + ' ' + str(other))
     426
    414427    def __repr__(self):
    415428        """
    416429        EXAMPLES::