Hello,

I've fixed this issue and have included the patch below.  It will be
in the next release which should be come out in the next few days.
Here is the behavior after the patch:

sage: g(x) = 2*abs(x)
sage: latex(g)
x \ {\mapsto}\ {2 \cdot \left| x \right|}


--Mike

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

# HG changeset patch
# User Mike Hansen <[EMAIL PROTECTED]>
# Date 1193248166 18000
# Node ID ff6836693992d0cdf8513083904cccafb5b9bfa5
# Parent  384cf32899ac4ad7e086bbc3ca53c577d68bd3f1
Fixed #982

diff -r 384cf32899ac -r ff6836693992 sage/calculus/calculus.py
--- a/sage/calculus/calculus.py	Tue Oct 23 21:05:54 2007 -0500
+++ b/sage/calculus/calculus.py	Wed Oct 24 12:49:26 2007 -0500
@@ -3818,6 +3818,11 @@ class SymbolicComposition(SymbolicOperat
         if not self.is_simplified():
             return self.simplify()._latex_()
         ops = self._operands
+
+        #Check to see if the function has a _latex_composition method
+        if hasattr(ops[0], '_latex_composition'):
+            return ops[0]._latex_composition(ops[1])
+        
         # certain functions (such as \sqrt) need braces in LaTeX
         if (ops[0]).tex_needs_braces():
             return r"%s{ %s }" % ( (ops[0])._latex_(), (ops[1])._latex_())
@@ -4033,7 +4038,17 @@ class Function_abs(PrimitiveFunction):
         return "abs"
 
     def _latex_(self):
-        return "\\abs"
+        return "\\mathrm{abs}"
+
+    def _latex_composition(self, x):
+        """
+        sage: f = sage.calculus.calculus.Function_abs()
+        sage: latex(f)
+        \mathrm{abs}
+        sage: latex(abs(x))
+        \left| x \right|
+        """
+        return "\\left| " + latex(x) + " \\right|"
 
     def _approx_(self, x):
         return float(x.__abs__())

Reply via email to