else if (atom.nucleus()->nargs() > 0)
atom.nucleus()->cell(0).append(selection);
+ MathWordList const & words = mathedWordList();
+ MathWordList::const_iterator it = words.find(name);
+ bool keep_mathmode = it != words.end() && (it->second.inset == "font"
+ || it->second.inset == "oldfont"
+ || it->second.inset == "mbox");
bool ert_macro = atomAsMacro && !atomAsMacro->macro();
if (in && in->currentMode() == Inset::TEXT_MODE
posForward();
} else if (in && in->currentMode() == Inset::MATH_MODE
&& atom.nucleus()->currentMode() == Inset::TEXT_MODE
- && name != from_ascii("text")) {
+ && !keep_mathmode) {
MathAtom at = createInsetMath("text", buffer());
at.nucleus()->cell(0).push_back(atom);
niceInsert(at);