Opened 10 years ago
Closed 2 years ago
#14509 closed defect (fixed)
Fix LaTeX of free algebras (and repr_lincomb)
Reported by:  KarlDieter Crisman  Owned by:  William Stein 

Priority:  minor  Milestone:  sage9.3 
Component:  user interface  Keywords:  latex 
Cc:  Travis Scrimshaw, Frédéric Chapoton, Hoa Nguyen  Merged in:  
Authors:  Hoa Nguyen  Reviewers:  Frédéric Chapoton, Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  8d8dd83 (Commits, GitHub, GitLab)  Commit:  8d8dd831849e4537a5cdd587ce640ccefef53b5d 
Dependencies:  #29892  Stopgaps: 
Description (last modified by )
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.
See the first report at ask.sagemath.
See also: #26606 (same problem for power series in one variable).
Change History (23)
comment:1 Changed 9 years ago by
comment:2 Changed 9 years ago by
In fact, what will break if we simply add a space after every such comman variable name?

sage/misc/latex.py
a b 2503 2503 '\\alpha' 2504 2504 """ 2505 2505 if a in common_varnames: 2506 return "\\" + a 2506 return "\\" + a + " " 2507 2507 elif len(a) == 1: 2508 2508 return a 2509 2509 elif is_fname is True:
Visually, and in latex, this is probably the simplest fix.
comment:3 Changed 9 years ago by
Milestone:  sage5.11 → sage5.12 

comment:4 Changed 9 years ago by
Milestone:  sage6.1 → sage6.2 

comment:5 Changed 9 years ago by
Milestone:  sage6.2 → sage6.3 

comment:6 Changed 8 years ago by
Milestone:  sage6.3 → sage6.4 

comment:7 Changed 2 years ago by
Milestone:  sage6.4 → sage9.2 

Still broken in 9.2.beta1.
For repr_lincomb
see also #29892.
comment:8 Changed 2 years ago by
Cc:  Travis Scrimshaw Frédéric Chapoton added 

comment:9 Changed 2 years ago by
Related ticket: #26606 (same problem for power series in one variable).
comment:10 Changed 2 years ago by
Dependencies:  → #29869 

comment:11 Changed 2 years ago by
Dependencies:  #29869 → #29892 

comment:12 Changed 2 years ago by
Description:  modified (diff) 

comment:13 Changed 2 years ago by
Cc:  Hoa Nguyen added 

comment:14 Changed 2 years ago by
Milestone:  sage9.2 → sage9.3 

comment:15 Changed 2 years ago by
Branch:  → u/hoanguyen/fix_latex_of_free_algebras__and_repr_lincomb_ 

comment:16 Changed 2 years ago by
Authors:  → Hoa Nguyen 

Commit:  → 395deabbf8ea5722248c063ca2bba4733bf7a51f 
Status:  new → needs_review 
comment:17 Changed 2 years ago by
missing empty line after
+ Check that :trac:`14509` is fixed::
and doctests should be indented, or rather this line should be unindented
comment:18 Changed 2 years ago by
Commit:  395deabbf8ea5722248c063ca2bba4733bf7a51f → 20395b595a9a4f4f31bd81b1dc5b53c012ff2383 

Branch pushed to git repo; I updated commit sha1. New commits:
20395b5  Fix doctest

comment:19 Changed 2 years ago by
Commit:  20395b595a9a4f4f31bd81b1dc5b53c012ff2383 → 87d3fc75e5464499c1811e2cc70ff526c8aa0010 

Branch pushed to git repo; I updated commit sha1. New commits:
87d3fc7  Fix doctest

comment:20 Changed 2 years ago by
Commit:  87d3fc75e5464499c1811e2cc70ff526c8aa0010 → ef6c22d56c7e0aeaf226c05f0f6db80b0939aa98 

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

comment:21 Changed 2 years ago by
Commit:  ef6c22d56c7e0aeaf226c05f0f6db80b0939aa98 → 8d8dd831849e4537a5cdd587ce640ccefef53b5d 

Branch pushed to git repo; I updated commit sha1. New commits:
8d8dd83  Update doctest

comment:22 Changed 2 years ago by
Reviewers:  → Frédéric Chapoton, Travis Scrimshaw 

Status:  needs_review → positive_review 
LGTM.
comment:23 Changed 2 years ago by
Branch:  u/hoanguyen/fix_latex_of_free_algebras__and_repr_lincomb_ → 8d8dd831849e4537a5cdd587ce640ccefef53b5d 

Resolution:  → fixed 
Status:  positive_review → closed 
sage/misc/latex.py
This fixes the latex, but the raw latex doesn't look good any more.