How to write concurrent index and superscript for character with matplotlib

I would like to get something like this: $ E ^ {\ alpha} _ {\ beta} $, where there is a syntax index \ beta and superscript \ alpha for the character E. I type matplotlib (1.2.x with python 2.7.1 ) the following code:

ax.text(0.,0.,r'E$^{\alpha}_{\beta}$') 

and I get an error:

 Subscript/superscript sequence is too long. Use braces { } to remove ambiguity. 

When I added extra curly braces to separate superscript and index like

 ax.text(0.,0.,r'E${^{\alpha}}_{\beta}$') 

matplotlib can handle it this time, but the result is not a SIMULTANEOUS superscript and index, it seems to be the symbol E $ ^ {\ alpha} $ with index \ beta, where \ alpha and \ beta are not vertically aligned.

+4
source share
1 answer

Move E to TeX so that the processor knows that alpha and beta are hanging:

 text(0.25, 0.5, r'$E^{\alpha}_{\beta}$', size=200) 

produces

enter image description here

+9
source

All Articles