- // the macro must come here, _before_ the metric call, because
- // the macro should see itself to detect recursions. To find out
- // whether the macro definition is a redefinition it will look
- // at the MacroData::redefinition_. So it doesn't get confused
- // by the already existing macro definition of itself in the
- // macro context.
- if (ii->inset->lyxCode() == MATHMACRO_CODE) {
- // get macro data
- MathMacroTemplate const & macroTemplate
- = static_cast<MathMacroTemplate const &>(*ii->inset);
-
- // valid?
- if (macroTemplate.validMacro()) {
- MacroData macro = macroTemplate.asMacroData();
-
- // redefinition?
- macro.setRedefinition(mc.has(macroTemplate.name()));
-
- // register macro (possibly overwrite the previous one of this paragraph)
- mc.insert(macroTemplate.name(), macro);
- }
+ // position already initialized?
+ if (!parPos.empty()) {
+ parPos.pos() = ii->pos;
+
+ // A macro template would normally not be visible
+ // by itself. But the tex macro semantics allow
+ // recursion, so we artifically take the context
+ // after the macro template to simulate this.
+ if (ii->inset->lyxCode() == MATHMACRO_CODE)
+ parPos.pos()++;