>> Is there a way to make LyX display \over the same way \frac is displayed?
>
>No way unless you want to use 1.2.0cvs. It's working there.

I may give it a try.

>There is another point: parsing  \over is _much_ harder than parsing \frac.

I think I see what you mean, since \frac always has its arguments enclosed in
braces after the \frac, so you can do trivial counting of {'s and }' to find
where \frac's arguments begin and end. And \frac is prefix, while \over is
infix.

>How do you recognize the begin of the numerator and the end of the
>denominator?

Well, you can write recursive descent parsers, LR(1) parsers (yacc, bison,
etc.). It's not _that_ hard to parse.

It's true that simple regexp matching like Perl's s/abc/xyz/ would not be
sufficient.

But I did not have anything that complicated. \over was used for numerical
fractions like 1/2 or 3/4, so they were trivial to parse. I did not have
\over with complicated expressions in them -- that was always \frac.

perl -e 'while(<>){s/(\d+)\s*\\over\s+(\d+)/\\frac{$1}{$2}/g;print;}'

Lee

Reply via email to