First time here? Check out the FAQ!

Ask Your Question
1

Variant Greek letters in "latex_name"

asked 10 years ago

Anton Babkin gravatar image

updated 10 years ago

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

This:

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.

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
1

answered 10 years ago

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...

Preview: (hide)
link

Comments

Thanks, good to know another way of doing it.

Anton Babkin gravatar imageAnton Babkin ( 10 years ago )
0

answered 10 years ago

dazedANDconfused gravatar image

updated 10 years ago

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

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

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.

Preview: (hide)
link

Comments

Thanks, this solves my problem!

Anton Babkin gravatar imageAnton Babkin ( 10 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

1 follower

Stats

Asked: 10 years ago

Seen: 3,670 times

Last updated: Sep 14 '14