Ask Your Question
1

latex form of product of non-commuting variables

asked 2013-04-30 14:48:39 -0500

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)

edit retag flag offensive close merge delete

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 ( 2013-04-30 15:18:43 -0500 )edit

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 ( 2016-04-07 08:00:06 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-04-06 18:32:14 -0500

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
...
edit flag offensive delete link more

Comments

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

slelievre gravatar imageslelievre ( 2016-04-07 04:19:11 -0500 )edit

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

John Palmieri gravatar imageJohn Palmieri ( 2016-04-07 13:47:11 -0500 )edit

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

slelievre gravatar imageslelievre ( 2016-04-09 09:20:46 -0500 )edit

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: 2013-04-30 14:48:39 -0500

Seen: 259 times

Last updated: Apr 07 '16