Ask Your Question
1

latex form of product of non-commuting variables

asked 12 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

the result of

K.< alpha,b > = FreeAlgebra(SR)
latex(alpha*b)

is

\alphab

without a space between \alpha and b.

Is it a bug?

('Sage Version 5.8, Release Date: 2013-03-15' on osx 10.6.8)

Preview: (hide)

Comments

Yuck, this needs work. I couldn't even find a good workaround. You can try using `repr_lincomb` some to see what you get, but I wasn't able to get this to work as we would desire. See http://trac.sagemath.org/sage_trac/ticket/14509

kcrisman gravatar imagekcrisman ( 12 years ago )

The ticket @kcrisman points to is at http://trac.sagemath.org/sage_trac/ti... . @kcrisman: please leave the link above as is, I am referencing it at https://github.com/ASKBOT/askbot-deve... .

slelievre gravatar imageslelievre ( 9 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 9 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

in my opinion, this problem can be solved in a clean way by replacing the line 2510 in sage/misc/latex.py

    ...
    2509  elif len(a) == 1:
    2510     return a
    2511  elif is_fname is True:
    ...

with

    ...
    2509  elif len(a) == 1:
    2510     return '{%s}'%a
    2511  elif is_fname is True:
    ...

actually I get a far better result with

...
2505  if a in common_varnames:
2506     return '{\\,\\%s}'%a
2507  elif len(a) == 0:
2508      return ''
2509  elif len(a) == 1:
2510      return '{\\,%s}'%a
2511  elif is_fname is True:
2512      return '{\\,\\rm %s}'%a
2513  else:
2514      return '\\,\\mathit{%s}'%a
...
Preview: (hide)
link

Comments

Would you consider using raw strings, eg r'{\,\%s}' instead of '{\\,\\%s}'. Makes things clearer.

slelievre gravatar imageslelievre ( 9 years ago )

Shouldn't this discussion happen at http://trac.sagemath.org/ticket/14509?

John Palmieri gravatar imageJohn Palmieri ( 9 years ago )

@io: would you contribute your solution to Sage trac ticket #14509?

slelievre gravatar imageslelievre ( 9 years ago )

For the record: fixed in Sage trac ticket #14509, merged in Sage 9.3.beta2.

slelievre gravatar imageslelievre ( 4 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 12 years ago

Seen: 795 times

Last updated: Apr 07 '16