Well, I liked the idea expressed in the question alternative syntax of subscripts using tex. But I want it to work in a sightly different way.
I just want to expand the usual _ and ^. How? So that the code escapes from the sup/subscript if there is a space (see exceptions at the bottom):
a_11 + b_123ijk + c_k\ellshould be the same asa_{11} + b_{123ijk} + c_{k\ell}.- And the same for superscripts:
m^qwpoeriuequal tom^{qwpoeriu}.
At this moment, I have this code in my preamble (it helps if you want to write F_\mathrm{max} you can do it like F_|max|), so the solution should't break it
\makeatletter
\begingroup\catcode`\_=\active\protected\gdef_{\@ifnextchar|\subtextup\sb}\endgroup
\def\subtextup|#1|{\sb{\mathrm{#1}}}
\AtBeginDocument{\catcode`\_=12 \mathcode`\_=32768}
\makeatother
Why?
I usually space my code \biggl( a_b \cdot \cos(x - c) = 1 \times \vec v rather than \biggl(a_b\cdot\cos(x-c)=1\times\vec v, because I find it much more easier to read. So this would easily work well for me since in so many times I wouldn't need to write {}. Of course, there are moments where I still need to do it, i.e., \alpha_k\ell + \alpha_{\ell k} = 1.
EDIT: More things. I'm not particularly interested in a_b_c_d + e to be like a_{b_{c_d}} + e (and the same with ^), but I think it would be great if that also worked (which means that the space should escape all the sub/superscripts).
More things, NOT only the space should escape the sub/superscript, also this:
- the alternative sup/subscript, i.e.:
a_b^c + 1 = 0should work asa_{b}^{c} + 1 = 0, anda^blk_ijkasa^{blk}_{ijk}, - the ending of math
$a_bcde$should be like$a_{bcde}$, - and also a closing brace:
\frac{1}{a_ijk}equal to\frac{1}{a_{ijk}}.


}without a space make the code increasingly fragile – David Carlisle Jan 30 '13 at 21:00}will make it very fragile. – Manuel Jan 30 '13 at 21:07