Am Samstag, 6. Juni 2015 um 19:12:45, schrieb Enrico Forestieri <[email protected]> > On Sat, Jun 06, 2015 at 03:23:48PM +0200, Kornel Benko wrote: > > > Am Samstag, 6. Juni 2015 um 13:13:22, schrieb Enrico Forestieri > > <[email protected]> > > > +void InsetMathHull::usedMacros(MathData const & md, MacroNameSet & > > > macros) const > > > +{ > > > + for (size_t i = 0; i < md.size(); ++i) { > > > + MathMacro * mi = const_cast<MathMacro > > > *>(md[i].nucleus()->asMacro()); > > > + if (mi) { > > > + macros.insert(mi->name()); > > > + usedMacros(mi->definition(), macros); > > > > I would change the order, to get the used macro first. > > No, that is correct. The top level macro has to appear in the last position.
OK, I thought macros.insert() would insert at the end.
> I failed to understand why that was not working but, most probably, it has
> to do with the fact not all data is copied over to a cloned buffer.
> However, I found a different way for collecting only the macros used
> in a given math inset, so I did not investigate it further.
>
> The attached patch for stable works for me and avoids the size explosion
> when a very lot of macros are defined in a document. I count on Guillaume
> to give it a thourough test. If he doesn't find glitches I will feel
> confident about proposing to apply it for 2.1.4.
>
Works for me. That is, it does not crash with
lyx-bug-lassert-preview-startup.lyx.
But I wonder why there are preview entries in the lyxpreview*.tex
...
\begin{document}
\begin{preview}
${\displaystyle {#1}}$
\end{preview}
\begin{preview}
$#1$
\end{preview}
\begin{preview}
${\scriptstyle {#1}}$
\end{preview}
\begin{preview}
${\scriptscriptstyle {#1}}$
\end{preview}
\end{document}
...
Kornel
signature.asc
Description: This is a digitally signed message part.
