Expr be an expression that can be practically any combination of variables. Now I can check whether this expression contains any subscripts or superscripts with help of
However, in a next step I would like to read out a list of all appearing sub- and superscripts explicitly without introducing more constraints on how the expression should look like specifically. Is there any function that does this? Or maybe one can implement it? Thanks for any suggestion!
Expr = (h*Superscript[u, g]*Superscript[Subscript[a, b, c], z])^Pi; GetSubAndSuperscripts[Expr]
The point is, that it should not matter how exactly the expression is organized. The function should simply return all appearing Superscripts and Subscripts.