Re: Mathematical selection

Richard Kaye wrote:
> On Thursday 30 March 2006 12:35, Paul Libbrecht wrote:
> 
>>W Naylor wrote:
>>
>>>I though to try out the ORCCA tex -> MathML translator on your
>>>example:I input the document:
>>>\documentclass[11pt]{article}
>>>\begin{document} $$3*a+b$$ \end{document}
>>>and get out the MathML:
>>><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"
>>>overflow="scroll">
>>><mn>3</mn><mo>*</mo><mi>a</mi><mo>+</mo><mi>b</mi></math>
>>>now this is machine generated, (though I suspect that many authors would 
>>>be lazy and wouldn't put an mrow around the 3*a, if they were creating 
>>>this by hand)
>>
>>Well, that's an example where solution-1
>>(presentation-tree-based-selection) is doing the same as text
>>selection... it clearly is wrong but if the author is aware of it, he
> 
> 
> Actually, it is only clearly wrong with standard semantics where 
> + = addition and * = multiplication on some standard field such
> as the real numbers, and using standard conventions on precedence
> (and perhaps in a context where you are using standard classical
> logic to discuss real numbers).

I'd argue it's wrong in any case, or at least of dubious meaning;
What does a construct like "a op1 b op2 c" mean?.  It's just that
the "right" form is not apriori clear, without knowing the author's
intended notations.  And if you're opening the can'o'worms
of non-standard notations, why assume that * and + are infix
operators at all? Maybe "3*" is a prefix opererator acting on "a" ?

By default TeX assumes they are operators, but, like MathML,
there's no precedence associated with them.
Unless the author's markup is has explicit structure,
whatever agent is translating to MathML will need to parse.
Ideally that agent would allow for non-standard notations,
but the standard makes a good default.

To get back to Paul's original question;  Have you thought of
taking a hybrid approach?  Ie. expand the selection based
on presentation-tree considerations, and then _if_ there are
parallel markup linkages, adjust the selection as needed.
That would seem to do as much fixup as you can, given whatever
markup you're given.

Depending on what the selection is _for_, however, a pure
single content subtree might not be what's desired, however.
It might be reasonable to select multiple subtrees provided
they are adjacent siblings. Assuming the above example were
properly nested (using standard precedence :> ), "*a"
(two subtrees) might be a useful selection that would fit
the criterion. OTOH, you wouldn't be able to select "*a+",
which is a good thing.


-- 
bruce.miller@nist.gov
http://math.nist.gov/~BMiller/

Received on Thursday, 30 March 2006 14:11:20 UTC