Writing mathematical equations

Presentation

DocBook doesn't define elements for writing mathematical equations. Only few elements exist that tell how equation should be displayed (inlined, block):

  • inlineequation tells that the equation is inlined,

  • informalequation tells that the equation is displayed as a block, without a title.

  • equation tells that the equation is displayed as a block, with or without a title.

These tags include a graphic (graphic or mediaobject) or an alternative text equation, as shown by the example.

Example 8.4. Equation taken from TDG

<equation><title>Last Theorem of Fermat</title> 
  <alt>x^n + y^n &ne; z^n &forall; n &ne; 2</alt>
  <graphic fileref="figures/fermat"/>
</equation>   

Implementation choice

The principle is to use only the alt element. If initially alt contains actually the text to print, it is chosen to use this element to embed ConTeXt mathematical equations. This choice has the following advantages:

  • The translation done by dbcontext is really easy, since the equation is already written in tex format.

  • TeX is one of the best word processor to render mathematical formulas.

  • One doesn't need to write the equations in MathML.

  • This method isn't specific to this tool (see the following section).

The implementation is as light as possible. The writer can put any mathematical delimiter ($, \(, \), \[, \]), it will be stripped by the XSL stylesheets.

Compatibility

This implementation is not contradictory nor specific. In particular, the DBTeXMath proposal to extend the DSSSL stylesheets used by jade follows the same approach, and is integrated in the Norman Walsh XSL stylesheets.