On Tue, 14 Mar 2000, Andre Poenitz wrote:
> Subject: Re: wild development ideas
>
> > Sounds truly wild. If these programms have a scripting or macro
> > language,
>
> Most of the interesting programs are scriptable. Maple e.g:
>
> echo "lprint(expand((x+1)^3));" | maple -q
>
> --> x^3+3*x^2+3*x+1
>
> The problem is parsing. First you have to convert from
> LyX formula (sort of LaTeX) to Maple syntax which is *not* trivial
> since LaTeX does not preserve the logical structure of the formula
> - just think about indices etc. Calling Maple is the easy part.
> Converting back to LaTeX is not difficult either:
>
> echo "latex(expand((x+1)^3));" | maple -q
>
> --> {x}^{3}+3\,{x}^{2}+3\,x+1
>
> So if you come up with a decent LaTeX parser in C++ I am willing to
> implement the easy parts ;-)
While I agree with you, that a LaTeX parser would be very hard to
implement, why not try a different solution. I will try to describe
a solution which would give some of the benefits the initial poster
requested, while being simple enough to be implemented quite fast.
The basic principle is that while LaTeX does not preserve the logical
structure of the formula, there exists an input method for maple
that preserves it. Why not create an input mode for LyX, that allows
to enter commands for maple, which are stored as plain text.
This is then passed over to maple (with an added latex(...) )
to evaluate, and the result can easily be displayed with the
capabilities of LyX.
This would have the advantage that you won�t have to leave LyX
to perform computations, and that the commands which led to
a result are stored with the result.
The only disadvantage I can see with using this method
would be that there are two different syntax standards for
mathematical input in LyX. While this could be confusing for
new users of LyX, it should present no problem because anyone
who will use this feature will probably know maple and latex
syntax.
I used maple as an example, because it has a fairly simple and
not too proprietary syntax.Using Mathematica would require
some additional work, because Mathematica�s latex output uses
special macros for many things. (At least the Version I am using)
I would be glad if some LyX-Developer could tell me if this
additions to LyX are possible.
Greetings
Uwe