On Wed, Mar 14, 2007 at 04:02:25PM +0100, Andre Poenitz wrote: > On Wed, Mar 14, 2007 at 10:25:56AM +0100, Enrico Forestieri wrote: > > Maybe LyX displaces too much super and subscripts, such that \left > > and \right delimiters are higher than necessary. > > I really don't care, but does the attached patch give a less uglier > > aspect in those cases? BTW, I think that with this patch the aspect > > on screen is closer to the dvi output. > > > > -- > > Enrico > > > Index: src/mathed/InsetMathScript.C > > =================================================================== > > --- src/mathed/InsetMathScript.C (revision 17442) > > +++ src/mathed/InsetMathScript.C (working copy) > > @@ -203,13 +203,13 @@ int InsetMathScript::nwid() const > > > > int InsetMathScript::nasc() const > > { > > - return nuc().size() ? nuc().ascent() : 5; > > + return nuc().size() ? (3 * nuc().ascent()) / 4 : 5; > > } > > > > > > int InsetMathScript::ndes() const > > { > > - return nuc().size() ? nuc().descent() : 0; > > + return nuc().size() ? (3 * nuc().descent()) / 4 : 0; > > } > > > > > I think the exact rules are in the TeX book, or at least some kind > of approximation... If that's not too difficult, we should try to > use this (at least the rules for displayed math, inline is too dense for > editing).
I found the rules in appendix G and I think that they could be applied. However I stumbled over a problem. The ascent() method in mathed doesn't correctly report ascent values less than the ascent of a capital 'I'. Indeed, all these values are reported as the ascent of a capital 'I'. This seems to be by design and not the result of a bug. I tried replacing dim_ = theFontMetrics(mi.base.font).dimension('I'); with dim_ = theFontMetrics(mi.base.font).dimension('x'); in MathData.C in an attempt to have the ascent value of an 'x' as the minimum reported value, but then all the place holders in mathed shrinked to the height of an 'x'... To make a long story short, LyX misplaces super/subscripts and it is difficult to correct this because of the missing info about ascent values less than the ascent of a capital 'I'. Andre', can this be corrected? The 3/4 rule above seems producing better results in most cases, but gives bad results for very large ascent/descent values. Alternatively, knowing the difference between the ascent of an 'I' and the ascent of an 'x' can help to better position superscripts. -- Enrico