Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

# CombinatorialFreeModule contains bug in latex method and is missing a latex_prefix

Reported by: Owned by: stumpc5 sage-combinat major sage-duplicate/invalid/wontfix combinatorics latex, CombinatorialFreeModule Christian Stump N/A

### Description (last modified by stumpc5)

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

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}


### comment:1 Changed 10 years ago by stumpc5

• Status changed from new to needs_review

### comment:2 Changed 10 years ago by stumpc5

• Description modified (diff)

### comment:3 Changed 10 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 10 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 10 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.