W3C home > Mailing lists > Public > www-math@w3.org > February 2010

Re: How to translate \cases{...}. Online repository of examples

From: Neil Soiffer <neil.soiffer@gmail.com>
Date: Mon, 22 Feb 2010 09:41:42 -0800
Message-ID: <d98bce171002220941q1c6cf620tf64468cd28522f33@mail.gmail.com>
To: "J.Fine" <j.fine@open.ac.uk>
Cc: "www-math@w3.org" <www-math@w3.org>
The general answer is to use a two column table for your cases statement.
Here's the specific MathML:

<math xmlns='http://www.w3.org/1998/Math/MathML'>
   <mrow>
      <mo>{</mo>
      <mtable columnalign='right left'>
         <mtr>
            <mtd>
               <mn>0</mn>
            </mtd>
            <mtd>
               <mrow>
                  <mtext>if&nbsp;</mtext>
                  <mi>x</mi>
                  <mo>&lt;</mo>
                  <mn>0</mn>
               </mrow>
            </mtd>
         </mtr>
         <mtr>
            <mtd>
               <mi>x</mi>
            </mtd>
            <mtd>
               <mtext>otherwise</mtext>
            </mtd>
         </mtr>
      </mtable>
   </mrow>
</math>


Here's the presentation MathML for the content example David mentioned:
<math xmlns='http://www.w3.org/1998/Math/MathML'>
   <mrow>
      <mo>{</mo>
      <mtable columnalign='left'>
         <mtr>
            <mtd>
               <mn>0</mn>
            </mtd>
            <mtd>
               <mrow>
                  <mtext>if&nbsp;</mtext>
                  <mi>x</mi>
                  <mo>&lt;</mo>
                  <mn>0</mn>
               </mrow>
            </mtd>
         </mtr>
         <mtr>
            <mtd>
               <mi>x</mi>
            </mtd>
            <mtd>
               <mtext>otherwise</mtext>
            </mtd>
         </mtr>
      </mtable>
   </mrow>
</math>


Neil Soiffer
Senior Scientist
Design Science, Inc.
www.dessci.com
~ Makers of MathType, MathFlow, MathPlayer, MathDaisy, WebEQ, Equation
Editor ~



On Mon, Feb 22, 2010 at 9:00 AM, David Carlisle <davidc@nag.co.uk> wrote:

> On 22/02/2010 16:23, J.Fine wrote:
>
>> I'd like to know how to translate the following, which comes from The
>> TeXBook (page 175), to MathML
>> ===
>> $$|x| = \cases{x,&if $x$\ge 0$;\cr
>>     -x,&otherwise.\cr}$$
>> ===
>>
>> Or better yet, an online repository of examples.
>>
>>
>
> http://www.w3.org/Math/testsuite/build/main/Content/BasicContentElements/piecewise/rec-piecewise1-full.xhtml
>
> Is a content mathml translation of that (and the rest of the test suite is
> a good source of examples)
>
> Its translation as OpenMath, Content MathMl and Presentation MathML is here
>
> http://www.openmath.org/cd/piece1.xhtml#otherwise
>
> and again, the OpenMath CDs are a good source of examples.
>
>
> David
>
>
> ________________________________________________________________________
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>
> This e-mail has been scanned for all viruses by Star. The service is
> powered by MessageLabs.
> ________________________________________________________________________
>
>
Received on Monday, 22 February 2010 17:42:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 22 February 2010 17:42:18 GMT