Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#10852 closed defect (duplicate)

CombinatorialFreeModule contains bug in latex method and is missing a latex_prefix

Reported by: stumpc5 Owned by: sage-combinat
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: combinatorics Keywords: latex, CombinatorialFreeModule
Cc: Merged in:
Authors: Christian Stump Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by stumpc5)

This patch provides a bugfix for the latex method for CombinatorialFreeModule as discussed here:

http://groups.google.com/group/sage-combinat-devel/browse_thread/thread/c2f3ca216ea88a96

The bug looked like this:

sage: X = CombinatorialFreeModule(QQ,ZZ) 
sage: x = X.an_element() 
sage: x 
3*B[-1] + B[0] + 3*B[1] 
sage: latex(x) 
------------------------------------------------------------ 
...   
mons = [ prefix + '_{' + ",".join(map(str, m)) + '}' for (m, _) in v ] 
TypeError: argument 2 to map() must support iteration 

Now, this is fixed:

sage: X = CombinatorialFreeModule(QQ,ZZ) 
sage: x = X.an_element() 
sage: x 
3*B[-1] + B[0] + 3*B[1] 
sage: latex(x)
3B_{-1} + B_{0} + 3B_{1}

It also provides a new optional argument latex_prefix for CombinatorialFreeModule in order to be able to get a latex symbol as output:

sage: X = CombinatorialFreeModule(QQ,ZZ,prefix='beta',latex_prefix='\\beta') 
sage: x = X.an_element()
sage: x
3*beta[-1] + beta[0] + 3*beta[1]
sage: latex(x)
3\beta_{-1} + \beta_{0} + 3\beta_{1}

Also, this new feature is applied for the root space for root systems:

sage: L = RootSystem(['A',3]).root_lattice()
sage: Lvee = L.coroot_lattice()

sage: L.simple_root(1)
alpha[1]
sage: latex(L.simple_root(1))
\alpha_{1}

sage: Lvee.simple_root(1)
alphacheck[1]
sage: latex(Lvee.simple_root(1))
\alpha^\vee_{1}

Attachments (1)

trac_10852-combinatorial_free_module_latex-cs.patch (4.9 KB) - added by stumpc5 9 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 9 years ago by stumpc5

  • Status changed from new to needs_review

comment:2 Changed 9 years ago by stumpc5

  • Description modified (diff)

comment:3 Changed 9 years ago by jhpalmieri

Please document the latex_prefix argument to CombinatorialFreeModule. See #9370 for one suggestion. (If you could merge this ticket with #9370, that would be great, too.)

comment:4 Changed 9 years ago by stumpc5

  • Resolution set to fixed
  • Status changed from needs_review to closed

The patch is folded into #9370, so this ticket is obsolete.

Christian

comment:5 Changed 9 years ago by mvngu

  • Milestone set to sage-duplicate/invalid/wontfix
  • Resolution changed from fixed to duplicate
Note: See TracTickets for help on using tickets.