- MathArray::iterator st = it + 1;
- if (st != ar.end())
- if (MathScriptInset * sub = (*st)->asScriptInset())
- if (sub->hasDown()) {
- // try to figure out the summation index from the subscript
- MathArray & ar = sub->down().data();
- MathArray::iterator it =
- find_if(ar.begin(), ar.end(), &testEqualSign);
- if (it != ar.end()) {
- // we found a '=', use everything in front of that as index,
- // and everything behind as lower index
- p->cell(1) = MathArray(ar.begin(), it);
- p->cell(2) = MathArray(it + 1, ar.end());
- } else {
- // use everything as summation index, don't use scripts.
- p->cell(1) = ar;
- }
- ++st;
- }
+ MathScriptInset const * sub = (*it)->asScriptInset();
+ if (sub && sub->hasDown()) {
+ // try to figure out the summation index from the subscript
+ MathArray const & ar = sub->down();
+ MathArray::const_iterator xt =
+ find_if(ar.begin(), ar.end(), &testEqualSign);
+ if (xt != ar.end()) {
+ // we found a '=', use everything in front of that as index,
+ // and everything behind as lower index
+ p->cell(1) = MathArray(ar.begin(), xt);
+ p->cell(2) = MathArray(xt + 1, ar.end());
+ } else {
+ // use everything as summation index, don't use scripts.
+ p->cell(1) = ar;
+ }
+ }