Is there a way to override LaTeX's errors about double subscripts and superscripts?

Dmitry Vaintrob picture Dmitry Vaintrob · May 27, 2010 · Viewed 15.2k times · Source

Minor point about LaTeX that bothers me. When one writes

a^b^c, a_b_c  

or

a'^b  

in math mode, LaTeX gives an error message complaining about multiple super/subscripts. This is particularly annoying after replacing a string containing a super/subscript or when using the apostrophe, '.

Is there a way to override the error and have LaTeX simply output

a^{bc} a_{bc} {a'}^b  

and so on?

Answer

Alexey Malistov picture Alexey Malistov · May 27, 2010

The following is what you wish

\catcode`\^ = 13 \def^#1{\sp{#1}{}}
\catcode`\_ = 13 \def_#1{\sb{#1}{}}