Ticket #6403 (closed enhancement: fixed)

Opened 14 months ago

Last modified 7 months ago

Custom definitions for latex style

Reported by: schymans Owned by:
Priority: major Milestone: sage-4.3.3
Component: symbolics Keywords: latex
Cc: mvngu Author(s):
Report Upstream: N/A Reviewer(s):
Merged in: Work issues:

Description (last modified by gmhossain) (diff)

#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. 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'
sage: kunsati._latex_ = lambda: 'K_{unsat,i}'
sage: delyui._latex_ = lambda: '\delta_{yu,i}'
Traceback (most recent call last):

...
AttributeError?: 'sage.symbolic.expression.Expression' object attribute '_latex_' is read-only

Comment by Burcin Erocal on sage-devel (25/06/2006):

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

How could the Pynac funtionality of setting latex names for variables at creation be exposed?

Patches:

Patches that will resolve this ticket is posted at #6559

Change History

Changed 12 months ago by gmhossain

  • description modified (diff)
  • summary changed from Custom definitions for latex style to [with patch, needs review] Custom definitions for latex style

Changed 10 months ago by jason

  • summary changed from [with patch, needs review] Custom definitions for latex style to [needs review] Custom definitions for latex style

There is no patch above, though the title said there was a patch.

Changed 10 months ago by schymans

Supposedly, the patch for #6559 fixes this (see comment added to description). Could you review #6559 instead? Thanks!

Stan

Changed 7 months ago by burcin

  • status changed from needs_review to closed
  • cc mvngu added
  • milestone set to sage-4.3.3
  • summary changed from [needs review] Custom definitions for latex style to Custom definitions for latex style
  • upstream set to N/A
  • resolution set to fixed

I'm closing this, since #6559 just got merged. It adds a latex_name keyword argument to var(), which is the functionality requested here.

Note: See TracTickets for help on using tickets.