+ // Check whether a display math inset follows
+ if (d->text_[i] == META_INSET
+ && i >= start_pos && (end_pos == -1 || i < end_pos)) {
+ InsetMath const * im = getInset(i)->asInsetMath();
+ if (im && im->asHullInset()
+ && im->asHullInset()->outerDisplay()) {
+ runparams.inDisplayMath = true;
+ // runparams.inDeletedInset will be set by
+ // latexInset later, but we need this info
+ // before it is called. On the other hand, we
+ // cannot set it here because it is a counter.
+ deleted_display_math = isDeleted(i);
+ }
+ if (bparams.output_changes && deleted_display_math
+ && runningChange == change
+ && change.type == Change::DELETED
+ && !os.afterParbreak()) {
+ // A display math in the same paragraph follows.
+ // We have to close and then reopen \lyxdeleted,
+ // otherwise the math will be shifted up.
+ OutputParams rp = runparams;
+ if (open_font) {
+ bool needPar = false;
+ column += running_font.latexWriteEndChanges(
+ os, bparams, rp, basefont,
+ basefont, needPar);
+ open_font = false;
+ }
+ basefont = getLayoutFont(bparams, outerfont);
+ running_font = basefont;
+ column += Changes::latexMarkChange(os, bparams,
+ Change(Change::INSERTED), change, rp);
+ }
+ }
+