drawMarkers2(pi, expx, expy);
} else {
bool drawBox = lyxrc.macro_edit_style == LyXRC::MACRO_EDIT_INLINE_BOX;
+ bool upshape = currentMode() == TEXT_MODE;
+ Changer dummy = pi.base.font.changeShape(upshape ? UP_SHAPE
+ : pi.base.font.shape());
// warm up cells
for (size_t i = 0; i < nargs(); ++i)
}
+InsetMath::mode_type MathMacro::currentMode() const
+{
+ // User defined macros are always assumed to be mathmode macros.
+ // Only the global macros defined in lib/symbols may be textmode.
+
+ MacroData const * data = MacroTable::globalMacros().get(name());
+ bool textmode = data && data->symbol() && data->symbol()->extra == "textmode";
+ return textmode ? TEXT_MODE : MATH_MODE;
+}
+
+
void MathMacro::validate(LaTeXFeatures & features) const
{
// Immediately after a document is loaded, in some cases the MacroData
void MathMacro::write(WriteStream & os) const
{
- MathEnsurer ensurer(os, d->macro_ != 0, true);
+ MacroData const * data = MacroTable::globalMacros().get(name());
+ bool textmode_macro = data && data->symbol()
+ && data->symbol()->extra == "textmode";
+ bool needs_mathmode = data && (!data->symbol()
+ || data->symbol()->extra != "textmode");
+
+ MathEnsurer ensurer(os, needs_mathmode, true, textmode_macro);
// non-normal mode
if (d->displayMode_ != DISPLAY_NORMAL) {