Bo Peng wrote: > < sorry for the PM to Leeming. >
Not a problem. >> Loading an existing document containing such an inset results in no >> previews being generated at all, as now. > > Locating a wrong formula among others is extremely difficult (may > have to compile all formulas one by one.) so there is no good > solution yet. The information is present in the latex log file. I'm not saying that it is easy to manipulate, but it is certainly possible. Eg ERROR_LINES=`sed -n '/^! Undefined control sequence.$/{ $!{ N s/.*\n// s/l\.\([^ ]*\) .*$/\1/ p } } ' ${logfile}` Should extract '40' from: ! Undefined control sequence. l.40 x=\alp b\] Thereafter, I'll leave it to you to exchange the previewed snippet with your warning message. Line 40 here is 'x=\alp b\]'. \begin{preview} \[ x=\alp b\] \end{preview} Presumably, you'll start with for line in $ERROR_LINES do ... done >> In conclusion, the existiing solution and your proposal convey >> appear equivalent information, but yours introduces different >> (note, not 'better) behaviour for a 'just-edited' inset. > > If 'not-turning-to-image' is a definite and alarming sign of wrong > formula, you are right. However, this is not the case. > > 1. Correct formula might not be previewed. One simplest example I > can > think of is: enter a \alpha, wait for preview, copy and paste > this alpha. The new one will NOT be previewed unless you enter > and leave it. Then this seems to me to be a real bug. > 2. The current indication of wrong formula is 'nothing happens to > the > formula afterwards'. This is psychologically hard to notice > especially when lyx math box is a *normal* status of a formula. > 3. previews need a while to appear, people will not wait and see the > result. (Even when they wait, most likely: nothing happened > yet... lyx is still compiling? instant-preview does not work? > Just another not-shown?) > >> Forgive me, but I do not see why this is any improvement at all. > > I consider this patch as a minor improvement with minimal cost but > of course you guys are the judges. :-) Not at all. I'm quite happy to include such a a patch so long as it doesn't increase the maintenance burden too much. However, I think it should be more than just a gimmic, don't you? Ie, it's almost certainly a good idea that it should do something useful when loading a file too. -- Angus