mailing-list for TeXmacs Users

Text archives Help


Re: [TeXmacs] Look left and right around plugin-input-converters rules?


Chronological Thread 
  • From: "Duncan Smith" <address@hidden>
  • To: address@hidden
  • Subject: Re: [TeXmacs] Look left and right around plugin-input-converters rules?
  • Date: Wed, 1 Oct 2008 08:44:09 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=Jh4BbJjYM84hVG328XNaRW29IbiKKZIo6KYeoMkWQlqdlfMBN5x2UPNE0dIGKvCQjp PMoU9GR3Y6QABgn6XmsRxadVJ/2zsSf4cxUiJIObTVETv/yP1YwJfW+RalT2d4U+/0gR e/Z65YeEmHkqR/l6DKanrs0i4LQC6jsPMcdKs=

Thanks Joris,

To try and understand I've been looking at the docs and src code a
little more it seems that for tags like sqrt or frac then you can
manipulate the tree in a plug-in converter, but for a simple symbol
like "<neq>" there is no tree so you can only substitute the symbol
itself for other text.

Assuming there's no way to manipulate the input or math tree from
within the neq converter, then I guess the best you can do is to
subst.
'<neq>' for 'is(not(equal('

Then call it at the input prompt like:

(%i1) <neq>1,2))

which seems a shame compared to the more natural

(%i1) 1 <neq> 2

if only because both operands must be placed after the neq symbol and
there's an asymmetric number of parenthesis left on the input line.

I'm sorry I didn't understand your suggestion about replacing neq for
a maxima lambda function since the goal was to use the graphical
symbol in the middle of the two operands for input.

Many thanks,

Duncan

On 30/09/2008, Joris van der Hoeven <address@hidden> wrote:
> On Mon, Sep 29, 2008 at 03:00:02PM +0100, Duncan Smith wrote:
>> Hi,
>> I'm writing a plug-in to map some of the symbols found in math-menu.scm
>> across to Maxima in a natural way, rather than simply substitute a math
>> symbol for another token, I'd like to use the context of the surrounding
>> items, for e.g.
>>
>> (this example relates to the Maxima plug-in, but in general is applicable
>> to
>> any plug-in)
>>
>> (plugin-configure maxima-relations
>> (:require #t))
>> (plugin-input-converters maxima
>> ("<neq>" "is(not equal(lval,rval))"))
>>
>> (%i1) 1 = / 2; /* = / are the keystrokes to generate the <neq> symbol */
>> Incorrect syntax: is is not an infix operator
>> 1 is(
>> (%i1)
>>
>> What I'd really like is for the <neq> symbol to get converted to:
>>
>> is(not equal(1, 2));
>>
>> Is it possible to refer to the operands in the conversion rule, or maybe
>> you
>> can use a RegEx to identify which tokens to the left and right of the
>> operator will be consumed and re-arranged in the output?
>
> No, I rather try to keep things simple.
> But you might try replacing <neq> by a Maxima lambda-expressions
> which does the things that you want.
>
> Best wishes, Joris
>



Archive powered by MHonArc 2.6.19.

Top of page