Samuel,

I am the personification of preoccupations upon preoccupations. No problem.

My meager attempt lead me to pynac as well, though not into the library
itself. I do know C++, so maybe I can make some progress there.

I cloned pynac. There are some dependencies to work out to get it to
build. I'll fiddle with it some more.

Thanks for your help.

Andy



On 09/21/2018 05:47 PM, Samuel Lelievre wrote:
> Andy,
>
> three weeks ago, after the partial exploration discussed on this list,
> I switched to other preoccupations and forgot to get back to this.
>
> To recap and go a little further, here is how I would describe
> the issue and some steps to explore it:
>
> Current:
>
>     sage: h = e^-x
>     sage: latex(h)
>     e^{\left(-x\right)}
>
> Wish:
>
>     sage: h = e^-x
>     sage: latex(h)
>     e^{-x}
>
> The function `latex` (see `latex??`) calls `self._latex_`
> which itself (see `h._latex_??`) calls
>
>   self._parent._latex_element_(self)
>
> In this case, self._parent is Sage's symbolic ring,
> so the issue can be reformulated as:
>
> Current:
>
>     sage: h = e^-x
>     sage: SR._latex_element_(h)
>     'e^{\\left(-x\\right)}'
>
> Wish:
>
>     sage: h = e^-x
>     sage: SR._latex_element_(h)
>     'e^{-x}'
>
> This method `SR._latex_element_` (see `SR._latex_element_??`)
> is defined in sage/symbolic/ring.pyx, see:
>
>  
> https://github.com/sagemath/sage/blob/master/src/sage/symbolic/ring.pyx#L888
>
> Exploring further, it calls:
>
>   char_to_str(GEx_to_str_latex(&x._gobj))
>
> The only other place I find `GEx_to_str_latex` is in
>
>   sage/src/sage/libs/pynac/pynac.pxd
>
> see also (searching the sagemath/sage repo on GitHub):
>
>  
> https://github.com/sagemath/sage/blob/master/src/sage/libs/pynac/pynac.pxd#L261
>
> Pynac's wiki has a note about the latexing of symbolic expressions:
>
>   https://github.com/pynac/pynac/wiki/%7C-printing
>
> Not sure where to go from there. This seems to be leaving the Python
> world and to be calling some C or C++ library, where I'm less fluent.
>
> I created a ticket for this issue. I hope this can get solved!
>
> - Sage Trac ticket 26337
>   Extraneous parentheses in latex(e^-x)
>   https://trac.sagemath.org/ticket/26337
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sage-devel+unsubscr...@googlegroups.com
> <mailto:sage-devel+unsubscr...@googlegroups.com>.
> To post to this group, send email to sage-devel@googlegroups.com
> <mailto:sage-devel@googlegroups.com>.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to