Latex on python: \alpha and \beta don't work?

后端 未结 2 333
夕颜
夕颜 2021-02-02 12:30

I\'m using matplotlib to produce some graphics, and I\'m using latex for the legends.

More specifically, I\'m trying to use something like this:

loglog(x         


        
相关标签:
2条回答
  • 2021-02-02 12:52

    The issue is that \a and \b have special meaning inside a Python string literal.

    I recommend that you use raw strings whenever there is a backslash embedded inside a string:

    r'$ \alpha $'
    
    0 讨论(0)
  • 2021-02-02 12:58

    In addition to using raw strings (as mentioned in the post above) you can also escape the backslash. So typing \\alpha and \\beta will also work.

    0 讨论(0)
提交回复
热议问题