W3C home > Mailing lists > Public > www-math@w3.org > May 2006

Re: How do I encode negative numbers in content MathML?

From: Richard Kaye <R.W.Kaye@bham.ac.uk>
Date: Fri, 19 May 2006 11:46:37 +0100
To: www-math@w3.org
Message-Id: <200605191146.37413.R.W.Kaye@bham.ac.uk>

This issue is perhaps peripheral to the original question,
but it is interesting enough.  I came across an identical
problem this morning, when I was writing a quick and dirty
stylesheet to convert XHTML+p-MathML into 
plain old HTML that could just about be readable by people 
without the right browser.  (Basically, the only thing
helpful in HTML is <sub> and <sup>.)  I had to 
translate mfrac's as ((numerator)/(denominator))
and have ended up with many places where there
are too many brackets.

By the way, it just happens that I am currently writing 
a text on logic. In this, the duality between /\ and \/ is 
so important a pedagogical point that I would never 
break the duality by saying one binds more strongly 
than the other.  (In fact that's my position at all times 
when and and or are notated this way - not just in this 
particular text.  When they are notated && and || it's a 
different matter.)  So I would always have brackets in this 
example.  I guess you must be writing some software that 
has a default behaviour to omit brackets here. I trust that 
if I were using it there would be a way I could over-rule this 
default.  You could go even further and reconsider whether 
you have the right default.  But I honestly have no idea 
how many other people have a strong view on this point.

Best wishes

Richard




On Thursday 18 May 2006 18:44, Michael Kohlhase wrote:
> Interesting that you should ask just now, I have been stumbling over the
> same thing a couple of days ago. The difference becomes interesting when
> you try to do presentation with bracket elision.
>
> The general idea is that when we have
>
> <apply>
>   <or>
>    <apply><and><ci>a</ci><ci>b</ci></apply>
>    <apply><and><ci>c</ci><ci>d</ci></apply>
> </apply>
>
> which should give a /\ b \/ c /\ d since /\ binds more strongly than \/.
>
> In such situations you want to have -(a+b), i.e. the unary minus
> operator needs brackets but -1, i.e. the unary minus operator does not
> here.
>
> Michael
>
> -------------------------------------------------------------------------
>    Prof. Dr. Michael Kohlhase,         Office: Research 1, Room 62
>    Professor for Computer Science      Campus Ring 12,
>    School of Engineering & Science     D-28758 Bremen, Germany
>    International University Bremen     tel/fax: +49 421 200-3140/-493140
>    http://www.faculty.iu-bremen.de/mkohlhase <m.kohlhase@iu-bremen.de>
> --------------------------------------------------------------------------
>
> juanrgonzaleza@canonicalscience.com wrote:
> > The chapter 4 of MathML 2.0 specification is far from precise at this
> > point.
> >
> > Moreover, the tutorial
> >
> > [http://cnx.org/content/m9008/latest/]
> >
> > recommends next code
> >
> > 	  <m:math>
> > 	    <m:apply>
> > 	      <m:minus/>
> > 	      <m:ci>x</m:ci>
> > 	    </m:apply>
> > 	  </m:math>
> >
> > to representing the negative of a variable, and recommends
> >
> > <m:math><m:cn>-1</m:cn></m:math>
> >
> > for the negative of a number.
> >
> > Whereas the next MathML tutorial
> >
> > [http://www.pragma-ade.com/general/manuals/mmlprime.pdf]
> >
> > says
> >
> > <blockquote>
> > Although <cn>-37</cn> is valid, using minus is sometimes more clear.
> >
> > <math>
> > <apply> <minus/>
> > <cn> 37 </cn>
> > </apply>
> > </math>
> > </blockquote>
> >
> > What is the difference if any between both encodings?
> >
> > What may be preferred? (I personally prefer unary usage of <minus/>)
> >
> >
> > Juan R.
> >
> > Center for CANONICAL |SCIENCE)
Received on Friday, 19 May 2006 10:45:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 20 February 2010 06:12:58 GMT