0

I'm using SBML which is an XML format for capturing numerical simulations. This uses MathML to capture equations that relate the amounts of the different things in the simulation. When I write the equations down by hand, I add some brackets that are not strictly needed, but which make the equations easier to read. For example, I may have an equation that by hand I'd write as:

z = (ax + by) + (cx + dy)

When this goes into MathML, these brackets are stripped out, and once I pretty-print the MathML, it comes out as:

z = ax + by + cx + dy

This makes me sad. Is there a way to capture these (redundant) brackets in the MathML expression?

Patrick Mevzek
  • 10,995
  • 16
  • 38
  • 54
drdozer
  • 329
  • 1
  • 3
  • 10

1 Answers1

1

Yes, you don't say if you are using presentation or content mathml. I would guess content as it would be rare for you to lose the brackets in presentation rendering.

Content MathML you could mark it up as

<apply><sum/>
  <apply><csymbol>bracket</csymbol>
    <apply><sum/>
      <apply><product/><mi>a</mi><mi>x</mi></apply>
      <apply><product/><mi>b</mi><mi>y</mi></apply>
    </apply>
   </apply>
  <apply><csymbol>bracket</csymbol>
    <apply><sum/>
      <apply><product/><mi>c</mi><mi>x</mi></apply>
      <apply><product/><mi>d</mi><mi>y</mi></apply>
    </apply>
   </apply>
</apply>

where you give the csymbol bracket a presentation rule of putting a bracket round its argument.

David Carlisle
  • 5,582
  • 1
  • 19
  • 23