Opened 8 years ago
Closed 7 months ago
#14509 closed defect (fixed)
Fix LaTeX of free algebras (and repr_lincomb)
Reported by:  kcrisman  Owned by:  was 

Priority:  minor  Milestone:  sage9.3 
Component:  user interface  Keywords:  latex 
Cc:  tscrim, chapoton, hoanguyen  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 8 years ago by
comment:2 Changed 8 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.
Edit: Ok. Visually, this breaks subscripts and superscripts although the latex is fine.
comment:3 Changed 8 years ago by
 Milestone changed from sage5.11 to sage5.12
comment:4 Changed 7 years ago by
 Milestone changed from sage6.1 to sage6.2
comment:5 Changed 7 years ago by
 Milestone changed from sage6.2 to sage6.3
comment:6 Changed 7 years ago by
 Milestone changed from sage6.3 to sage6.4
comment:7 Changed 12 months ago by
 Milestone changed from sage6.4 to sage9.2
Still broken in 9.2.beta1.
For repr_lincomb
see also #29892.
comment:8 Changed 12 months ago by
 Cc tscrim chapoton added
comment:9 Changed 12 months ago by
Related ticket: #26606 (same problem for power series in one variable).
comment:10 Changed 12 months ago by
 Dependencies set to #29869
comment:11 Changed 12 months ago by
 Dependencies changed from #29869 to #29892
comment:12 Changed 12 months ago by
 Description modified (diff)
comment:13 Changed 8 months ago by
 Cc hoanguyen added
comment:14 Changed 8 months ago by
 Milestone changed from sage9.2 to sage9.3
comment:15 Changed 8 months ago by
 Branch set to u/hoanguyen/fix_latex_of_free_algebras__and_repr_lincomb_
comment:16 Changed 8 months ago by
 Commit set to 395deabbf8ea5722248c063ca2bba4733bf7a51f
 Status changed from new to needs_review
comment:17 Changed 8 months 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 8 months ago by
 Commit changed from 395deabbf8ea5722248c063ca2bba4733bf7a51f to 20395b595a9a4f4f31bd81b1dc5b53c012ff2383
Branch pushed to git repo; I updated commit sha1. New commits:
20395b5  Fix doctest

comment:19 Changed 8 months ago by
 Commit changed from 20395b595a9a4f4f31bd81b1dc5b53c012ff2383 to 87d3fc75e5464499c1811e2cc70ff526c8aa0010
Branch pushed to git repo; I updated commit sha1. New commits:
87d3fc7  Fix doctest

comment:20 Changed 8 months ago by
 Commit changed from 87d3fc75e5464499c1811e2cc70ff526c8aa0010 to ef6c22d56c7e0aeaf226c05f0f6db80b0939aa98
Branch pushed to git repo; I updated commit sha1. New commits:
ef6c22d  Fix doctest

comment:21 Changed 8 months ago by
 Commit changed from ef6c22d56c7e0aeaf226c05f0f6db80b0939aa98 to 8d8dd831849e4537a5cdd587ce640ccefef53b5d
Branch pushed to git repo; I updated commit sha1. New commits:
8d8dd83  Update doctest

comment:22 Changed 7 months ago by
 Reviewers set to Frédéric Chapoton, Travis Scrimshaw
 Status changed from needs_review to positive_review
LGTM.
comment:23 Changed 7 months ago by
 Branch changed from u/hoanguyen/fix_latex_of_free_algebras__and_repr_lincomb_ to 8d8dd831849e4537a5cdd587ce640ccefef53b5d
 Resolution set to fixed
 Status changed from positive_review to closed
sage/misc/latex.py
This fixes the latex, but the raw latex doesn't look good any more.