Opened 10 years ago

Closed 2 years ago

# Fix LaTeX of free algebras (and repr_lincomb)

Reported by: Owned by: Karl-Dieter Crisman William Stein minor sage-9.3 user interface latex Travis Scrimshaw, Frédéric Chapoton, Hoa Nguyen Hoa Nguyen Frédéric Chapoton, Travis Scrimshaw N/A 8d8dd83 8d8dd831849e4537a5cdd587ce640ccefef53b5d #29892

sage: K.< alpha,b > = FreeAlgebra(SR)
sage: latex(alpha*b)
\alphab


Someone we are not using repr_lincomb correctly, and in fact that function itself looks pretty hackishly defined. I couldn't even find a very good workaround.

• ## sage/misc/latex.py

diff --git a/sage/misc/latex.py b/sage/misc/latex.py
 a '\\alpha' """ if a in common_varnames: return "\\" + a return "\\" + a + "{}" elif len(a) == 1: return a elif is_fname is True:

This fixes the latex, but the raw latex doesn't look good any more.

sage: K.< alpha,b > = FreeAlgebra(SR)
sage: latex(alpha*b)
\alpha{}b


### comment:2 Changed 9 years ago by Punarbasu Purkayastha

In fact, what will break if we simply add a space after every such comman variable name?

• ## sage/misc/latex.py

 a '\\alpha' """ if a in common_varnames: return "\\" + a return "\\" + a + " " elif len(a) == 1: return a elif is_fname is True:

Visually, and in latex, this is probably the simplest fix.

Version 0, edited 9 years ago by Punarbasu Purkayastha (next)

### comment:3 Changed 9 years ago by Jeroen Demeyer

Milestone: sage-5.11 → sage-5.12

### comment:4 Changed 9 years ago by For batch modifications

Milestone: sage-6.1 → sage-6.2

### comment:5 Changed 9 years ago by For batch modifications

Milestone: sage-6.2 → sage-6.3

### comment:6 Changed 8 years ago by For batch modifications

Milestone: sage-6.3 → sage-6.4

### comment:7 Changed 2 years ago by Matthias Köppe

Milestone: sage-6.4 → sage-9.2

Still broken in 9.2.beta1.

For repr_lincomb see also #29892.

### comment:8 Changed 2 years ago by Matthias Köppe

Cc: Travis Scrimshaw Frédéric Chapoton added

### comment:9 Changed 2 years ago by Dave Morris

Related ticket: #26606 (same problem for power series in one variable).

### comment:10 Changed 2 years ago by Matthias Köppe

Dependencies: → #29869

### comment:11 Changed 2 years ago by Matthias Köppe

Dependencies: #29869 → #29892

### comment:12 Changed 2 years ago by Matthias Köppe

Description: modified (diff)

### comment:14 Changed 2 years ago by Matthias Köppe

Milestone: sage-9.2 → sage-9.3

### comment:15 Changed 2 years ago by Hoa Nguyen

Branch: → u/hoanguyen/fix_latex_of_free_algebras__and_repr_lincomb_

### comment:16 Changed 2 years ago by Hoa Nguyen

Authors: → Hoa Nguyen → 395deabbf8ea5722248c063ca2bba4733bf7a51f new → needs_review

### comment:17 Changed 2 years ago by Frédéric Chapoton

missing empty line after

+            Check that :trac:14509 is fixed::


and doctests should be indented, or rather this line should be un-indented

Last edited 2 years ago by Frédéric Chapoton (previous) (diff)

### comment:18 Changed 2 years ago by git

Commit: 395deabbf8ea5722248c063ca2bba4733bf7a51f → 20395b595a9a4f4f31bd81b1dc5b53c012ff2383

Branch pushed to git repo; I updated commit sha1. New commits:

 ​20395b5 Fix doctest

### comment:19 Changed 2 years ago by git

Commit: 20395b595a9a4f4f31bd81b1dc5b53c012ff2383 → 87d3fc75e5464499c1811e2cc70ff526c8aa0010

Branch pushed to git repo; I updated commit sha1. New commits:

 ​87d3fc7 Fix doctest

### comment:20 Changed 2 years ago by git

Commit: 87d3fc75e5464499c1811e2cc70ff526c8aa0010 → ef6c22d56c7e0aeaf226c05f0f6db80b0939aa98

Branch pushed to git repo; I updated commit sha1. New commits:

 ​ef6c22d Fix doctest

### comment:21 Changed 2 years ago by git

Commit: ef6c22d56c7e0aeaf226c05f0f6db80b0939aa98 → 8d8dd831849e4537a5cdd587ce640ccefef53b5d

Branch pushed to git repo; I updated commit sha1. New commits:

 ​8d8dd83 Update doctest

### comment:22 Changed 2 years ago by Travis Scrimshaw

Reviewers: → Frédéric Chapoton, Travis Scrimshaw needs_review → positive_review

LGTM.

### comment:23 Changed 2 years ago by Volker Braun

Branch: u/hoanguyen/fix_latex_of_free_algebras__and_repr_lincomb_ → 8d8dd831849e4537a5cdd587ce640ccefef53b5d → fixed positive_review → closed
Note: See TracTickets for help on using tickets.