Opened 5 years ago

Last modified 3 years ago

#14509 new defect

Fix LaTeX of free algebras (and repr_lincomb)

Reported by: kcrisman Owned by: was
Priority: minor Milestone: sage-6.4
Component: user interface Keywords: latex
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

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.

Change History (6)

comment:1 Changed 4 years ago by ppurka

  • sage/misc/latex.py

    diff --git a/sage/misc/latex.py b/sage/misc/latex.py
    a b  
    25032503        '\\alpha'
    25042504    """
    25052505    if a in common_varnames:
    2506         return "\\" + a
     2506        return "\\" + a + "{}"
    25072507    elif len(a) == 1:
    25082508        return a
    25092509    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 4 years ago by ppurka

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

  • sage/misc/latex.py

    a b  
    25032503        '\\alpha'
    25042504    """
    25052505    if a in common_varnames:
    2506         return "\\" + a
     2506        return "\\" + a + " "
    25072507    elif len(a) == 1:
    25082508        return a
    25092509    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.

Last edited 4 years ago by ppurka (previous) (diff)

comment:3 Changed 4 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:4 Changed 4 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:5 Changed 4 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:6 Changed 3 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.