In my class I have _latex and _sympystr.  Your latex() function uses my 
_latex but str() does not use _sympystr I have to define __str__() in my 
class to print correctly.  How should I use _sympystr to return the correct 
string. 

    def _sympystr(self,printer):
        if self.order == 0:
            return 'D{}'
        s = 'D'
        for x in self.pdiffs:
            s += '{' + printer._print(x) + '}'
            n = self.pdiffs[x]
            if n > 1:
                s += '^' + printer._print(n)
        return s

     def _latex(self,printer):
        if self.order == 0:
            return ''
        s = r'\frac{\partial'
        if self.order > 1:
            s += '^{' + printer._print(self.order) + '}'
        s += '}{'
        keys = list(self.pdiffs.keys())
        keys.sort(key=lambda x: x.sort_key())
        for key in keys:
            i = self.pdiffs[key]
            s += r'\partial ' + printer._print(key)
            if i > 1:
                s += '^{' + printer._print(i) + '}'
        s += '}'
        return s

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/3681a732-62ca-4169-84ea-291b92dccef4n%40googlegroups.com.

Reply via email to