Ask Your Question

Variant Greek letters in "latex_name"

asked 2014-09-12 16:19:30 -0500

Anton Babkin gravatar image

updated 2014-09-12 16:20:45 -0500

Is it possible to get variant Greek letters (\varepsilon, \varkappa etc) when I declare variables?


e = var('e', latex_name='\epsilon')

works as expected. But when I am trying:

e = var('e', latex_name='\varepsilon')

I am seeing unexpeted "arepsilon" when I do show(e).

I am using Sagemath Cloud.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-09-13 19:01:42 -0500

William Stein gravatar image

If you make a raw string you never need two backslashes. If you don't, then you may, depending on what is after a backslash. To make a raw string, prefix it with an r, so in this case do

e = var('e', latex_name=r'\varepsilon')

You'll see this r frequently in the Sage source code for the docstrings of functions...

edit flag offensive delete link more


Thanks, good to know another way of doing it.

Anton Babkin gravatar imageAnton Babkin ( 2014-09-14 15:42:39 -0500 )edit

answered 2014-09-12 18:01:45 -0500

dazedANDconfused gravatar image

updated 2014-09-12 18:04:18 -0500

Sometimes in Sage you need two \ marks. Try this:

e = var('e', latex_name='\\varepsilon')

I thought the need for two \ had to do with whether you had a raw text string or not. That doesn't seem to be the case here. Hopefully someone can fill in the details as to why we need two \ marks here and how we know that 2 are needed.

edit flag offensive delete link more


Thanks, this solves my problem!

Anton Babkin gravatar imageAnton Babkin ( 2014-09-14 15:41:36 -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


Asked: 2014-09-12 16:19:30 -0500

Seen: 757 times

Last updated: Sep 13 '14