# how to write simultaneous subscript and superscript for a symbol with matplotlib

I'd like to get something like that: $E^{\alpha}_{\beta}$, where there are simutaneous subscript \beta and superscript \alpha for the symbol E. I type in 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 message:

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


When I added extra braces to separate the superscript and subscript like

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


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

-

Move your E into the TeX so that the processor knows what alpha and beta are hanging off of:

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


produces

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9876470565795898, "perplexity": 2336.7220655614187}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-10/segments/1393999665917/warc/CC-MAIN-20140305060745-00073-ip-10-183-142-35.ec2.internal.warc.gz"}