On Thu, 25 Jun 2009 13:22:46 +0200
Stan Schymanski <schym...@gmail.com> wrote:

> 
> Dear all,
> 
> I have been asked to forward the below to the sage-devel list. Ticket 
> #6290 introduced a way to custom-define the latex style of functions, 
> but it would be great if something similar was made possible for any 
> variable. Is there a way for this already? I used to do it in the 
> following way, but now I get an error message:
> 
> sage: var('hi kunsati delyui')
> sage: hi._latex_ = lambda: 'h_i'                  # Matric suction
> head in layer i (=pcapvec)
> sage: kunsati._latex_ = lambda: 'K_{unsat,i}'     # Unsaturated
> hydraulic conductivity in layer i
> sage: delyui._latex_ = lambda: '\delta_{yu,i}'    # Soil layer
> thickness in layer i
> Traceback (most recent call last):
> ...
> AttributeError: 'sage.symbolic.expression.Expression' object attribute
> '_latex_' is read-only

Since Expression is a cython class, you cannot overwrite the _latex_()
method. 

Pynac supports setting latex names for variables at creation, but this
functionality is not exposed in the wrapper. Another solution by
hacking latex_variable_name() might be possible, but I would like to
avoid that if possible.

Feel free to open a new issue in trac about it.


Cheers,
Burcin


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to