1 / 79

Introduction to Using MathML

Introduction to Using MathML. Presented by: Robert Miner Director of New Product Development Bob Mathews Director of Training. What we’ll cover. Part I – Understanding MathML Overview of MathML Presentation and content markup MathML elements

hina
Download Presentation

Introduction to Using MathML

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Using MathML Presented by: Robert Miner Director of New Product Development Bob Mathews Director of Training

  2. What we’ll cover • Part I – Understanding MathML • Overview of MathML • Presentation and content markup • MathML elements • Building a MathML expression and inserting into HTML and XML pages.

  3. What we’ll cover • Part I – Understanding MathML • Part II – Magic Incantations • DOCTYPEs & MIME types • Namespaces • Object Tags and Processing Instructions • Universal MathML Stylesheet

  4. What we’ll cover • Part I – Understanding MathML • Part II – Magic Incantations • Part III – Tools • Design Science WebEQ • Design Science MathType with MathPage technology • TeX4ht • Amaya • Now on to Part I – Understanding MathML

  5. Overview of MathML • The Mathematical Markup Language (MathML) was first published as a recommendation in April 1998. • From the “Math Activity Statement” of the W3C Math Working Group: • “Designed as an XML application, MathML provides two sets of tags, one for the visual presentation of mathematics and the other associated with the meaning behind equations.”

  6. Overview of MathML • The Mathematical Markup Language (MathML) was first published as a recommendation in April 1998. • From the “Math Activity Statement” of the W3C Math Working Group: • “Designed as an XML application, MathML provides two sets of tags, one for the visual presentation of mathematics and the other associated with the meaning behind equations.”

  7. Overview of MathML • The Mathematical Markup Language (MathML) was first published as a recommendation in April 1998. • From the “Math Activity Statement” of the W3C Math Working Group: • “…two sets of tags…” • “MathML is not designed for people to enter by hand but specialized tools provide the means for typing in and editing mathematical expressions.”

  8. Overview of MathML • The Mathematical Markup Language (MathML) was first published as a recommendation in April 1998. • From the “Math Activity Statement” of the W3C Math Working Group: • “…two sets of tags…” • “MathML is not designed for people to enter by hand but specialized tools provide the means for typing in and editing mathematical expressions.”

  9. Attributes generally specify additional optionalinformation about the element. Each attributehas a name and a value. For example, the mfracelement has an attribute called linethickness. Most elements represent templates or patternsfor laying out subexpressions. For example, there is an mfrac element for fractions, and anmsqrt element for square roots. Most content elements represent either operatorsor mathematical data types. For example, there is a divide/ element for division, and an emptysetelement to denote the empty set. Anatomy of a MathML expression • About 30 MathML presentationelements which accept about 50 attributes • Using presentation markup, it’s possible to precisely control how an expression will look when displayed. • About 120 content elements, accepting about a dozen attributes. • Content markup facilitates applications other than display, like computer algebra and speech synthesis.

  10. Two types of elements • Most presentation elements have start and end tags, similar to the way some HTML has start and end tags. <element_name>…</element_name> • These elements can have other data in-between the start and end tags, such as text, extended characters, or other elements.

  11. Two types of elements • Most presentation elements have start and end tags, similar to the way some HTML has start and end tags. <element_name>…</element_name> • The other type of MathML element is an empty element of the form <element_name/> • These elements have just one tag. • There are only 4 empty presentation elements, but over 100 empty content elements, used in prefix notation.

  12. Two types of elements • Most presentation elements have start and end tags, similar to the way some HTML has start and end tags. <element_name>…</element_name> • The other type of MathML element is an empty element of the form <element_name/> • Elements can also accept attributes. • If an element has both start & end tags, the attribute immediately precedes the > in the start tag.

  13. Two types of elements • Most presentation elements have start and end tags, similar to the way some HTML has start and end tags. <element_name>…</element_name> • The other type of MathML element is an empty element of the form <element_name/> • Elements can also accept attributes. • In empty elements, attributes immediately precede the />.

  14. Examples of attributes <mfrac linethickness='0'>…</mfrac> <mspace width='12'/> <mtable columnalign="center">…</mtable> Inserts a 12-pt space. For 12 pixels, use “12px”.

  15. Basic presentation elements • <mi> – identifier, such as a variable, function name, constant, etc. • example: <mi>x</mi>rendering: x • example: <mi>sin</mi>rendering: sin

  16. This is an example of an entity reference. Entity referencesare just keywords in a special format, which representextended characters. Other examples are &alpha; (lower-case Greek alpha), and &infin; (infinity). Basic presentation elements • <mi> – identifier, such as a variable, function name, constant, etc. • <mo> – operator, such as a summation, fence (parentheses, brace, etc.), accent, etc. • example: <mo>(</mo>rendering: ( • example: <mo>&sum;</mo>rendering: S

  17. Basic presentation elements • <mi> – identifier, such as a variable, function name, constant, etc. • <mo> – operator, such as a summation, fence (parentheses, brace, etc.), accent, etc. • <mn> – number • Can you identify this expression?<mi>x</mi><mo>–</mo><mo>(</mo> <mn>3</mn><mo>+</mo><mi>y</mi><mo>)</mo> x – (3 + y)

  18. Token elements • Most MathML elements, like the mfrac element mentioned earlier, expect to only find other MathML elements in their content… • …but some presentation elements – <mi>, <mo>, and <mn>, for example – are different. • They are examples of token elements. • Token elements are the only elements which directly contain character data.

  19. Scripts • Superscripts and subscripts are ubiquitous in mathematical notation, and although you won’t be doing much MathML writing manually, it helps to familiarize yourself with the schemata. • MathML contains seven presentation elements for different kinds of scripts, but we’ll take a look at the most common.

  20. Scripts – sub & super • These are the first elements we’ve seen in detail that normally have more than one argument. • Subscript: <msub> basescript </msub> • Superscript: <msup> basescript </msup> • Usage:x1<msub><mi>x</mi><mn>1</mn></msub> x2 <msup><mi>x</mi><mn>2</mn></msup> x1 <msubsup><mi>x</mi><mn>1</mn><mn>2</mn></msubsup> Why can’t we code it this way: <msub> x1 </msub>? 2

  21. Including MathML in your page • We need some way to identify the math markup to our browser, plug-in, or applet. • MathML markup is inserted between <math> and </math> tags to distinguish MathML from other markup. • Although most tags will differ from presentation markup to content markup, the <math> tag is common to both.

  22. Coding simple expressions • As we stated at the beginning, it is not our goal in this tutorial to make you proficient at writing MathML. • You’ll likely use a software product to produce the MathML markup rather than write it yourself. • Our goal is to familiarize you enough with the MathML syntax and construction that you can read and understand a block of code, and can perhaps make changes to it by hand.

  23. Coding simple expressions • As we stated at the beginning, it is not our goal in this tutorial to make you proficient at writing MathML. • That being the case, you know enough MathML now to try your hand at coding a couple of simple expressions…

  24. Don’t forget to begin with the <math> start tag and end with the </math> end tag Don’t forget to begin with the <math> start tag and end with the </math> end tag Example 1 – try coding this… <math> </math>

  25. Example 1 – try coding this… <math> <msup> <mi>b</mi> <mn>2</mn> </msup> <mo>–</mo><mn>4</mn> </math>

  26. Horizontal row of expressions aligned on the baseline. Wrapping an mrow around an element or elements is always permissible, and often necessary in order to group terms together, for example, for use in a script, etc. This entity doesn’t appear inprint, but here we have addedit to facilitate voice synthesisand heuristic evaluation bycomputer algebra systems. Example 1a <math><mrow> <msup> <mi>b</mi> <mn>2</mn> </msup> <mo>–</mo> <mn>4</mn> <mo>&InvisibleTimes;<mo> <mi>a</mi> <mo>&InvisibleTimes;<mo> <mi>c</mi></mrow></math> <math> <msup> <mi>b</mi> <mn>2</mn> </msup> <mo>–</mo><mn>4</mn><mi>a</mi><mi>c</mi> </math> <math> <msup> <mi>b</mi> <mn>2</mn> </msup> <mo>–</mo> <mn>4</mn> <mo>&InvisibleTimes;<mo> <mi>a</mi> <mo>&InvisibleTimes;<mo> <mi>c</mi></math> or…

  27. Example 2 – one more… <math display='block'> <mrow> <msup> <mi>x</mi><mn>2</mn> </msup> <mo>+</mo> <msup> <mi>y</mi><mn>2</mn> </msup> <mo>=</mo> <msup> <mi>r</mi><mn>2</mn> </msup> </mrow></math>

  28. Other presentation elements • Presentation elements are grouped: • Token Elements • <mi> identifier • <mn> number • <mo> operator, fence, or separator • <mtext> text

  29. Other presentation elements • Presentation elements are grouped: • Token Elements • General Layout • <mrow> to group subexpressions • <mfrac> form fraction from 2 subexpressions • <mroot> radical with a specified index • <mfenced> surround content with a pair of fences

  30. Other presentation elements • Presentation elements are grouped: • Token Elements • General Layout • Scripts and Limits • <msub>, <msup>, <msubsup> • <munder> attach a script under a base • <mover> attach a script over a base • <munderover> attach a script both under and over a base

  31. Other presentation elements • Presentation elements are grouped: • Token Elements • General Layout • Scripts and Limits • Tables • <mtable> table or matrix • <mtr> row in a table or matrix • <mtd> one entry in a table or matrix

  32. Other presentation elements • Presentation elements are grouped: • Token Elements • General Layout • Scripts and Limits • Tables • Actions • <maction> binds actions to a subexpression

  33. Content elements • Most fundamental to content markup is the <apply> element, which enables the explicit application of a function to its argument.

  34. Content elements • <apply>application of a function to argument. • Token Elements • <cn> content number • <ci> content identifier

  35. Content elements • <apply>application of a function to argument. • Token Elements • Basic Content Elements • <inverse/> generic inverse • <compose/> compose 2 or more functions • <piecewise> piecewise defined function

  36. Content elements • <apply>application of a function to argument. • Token Elements • Basic Content Elements • Arithmetic, Algebra, and Logic • <divide/> division • <power/> to the power of • <root/> nth root • <conjugate/> complex conjugate

  37. Content elements • <apply>application of a function to argument. • Token Elements • Basic Content Elements • Arithmetic, Algebra, and Logic • Relations • <eq/> equal • <geq/> greater than or equal • <factorof/> the “divides” operator

  38. Content elements • <apply>application of a function to argument. • Token Elements • Basic Content Elements • Arithmetic, Algebra, and Logic • Relations • Calculus and Set Theory • <partialdiff/> partial derivative • <lowlimit> lower limit (of integral, etc.) • <union/> union or meet

  39. Content elements • <apply>application of a function to argument. • Token Elements • Basic Content Elements • Arithmetic, Algebra, and Logic • Relations • Calculus and Set Theory • Further element groups include sequences & series, elementary classical functions, statistics, linear algebra, semantic mapping elements, and constants.

  40. Example 3 – content markup • We want to code this expression in content markup: • We know we need to surround the code with the <math>…</math> element… • …but we haven’t seen yet how to combine content elements to create an entire expression, so here goes…

  41. Example 3 – content markup <math> <apply> <eq/> <apply> <cos/> <ci>&pi;</ci> </apply> <apply> <minus/> <cn>1</cn> </apply> </apply></math>

  42. Example 3 – content markup <math> <apply> <eq/><apply> <cos/> <ci>&pi;</ci> </apply> <apply> <minus/> <cn>1</cn> </apply> </apply></math>

  43. Example 3 – content markup <math> <apply> <eq/> <apply> <cos/> <ci>&pi;</ci> </apply> <apply> <minus/> <cn>1</cn> </apply> </apply></math>

  44. Example 3 – content markup <math> <apply> <eq/><apply> <cos/> <ci>&pi;</ci> </apply> <apply> <minus/> <cn>1</cn> </apply> </apply></math> to the left of the = to the right of the =

  45. Example 3 – content markup <math> <apply> <eq/> <apply> <cos/> <ci>&pi;</ci> </apply> <apply> <minus/> <cn>1</cn> </apply> </apply></math>

  46. Example 3 – compare <math> <apply> <eq/> <apply> <cos/> <ci>&pi;</ci> </apply> <apply> <minus/> <cn>1</cn> </apply> </apply></math> <math><mi>cos</mi><mi>&pi;</mi><mo>=</mo><mo>–</mo><mn>1</mn></math>

  47. Summary • Presentation markup is for describing math notation, and content markup is for describing mathematical objects and functions. • In presentation markup, expressions are built-up using layout schemata, which tell how to arrange their subexpressions (i.e., mfrac or msup).

  48. Summary • Presentation markup…& content markup • MathML elements either • have start and end tags to enclose their content, or • use a single empty tag.

  49. Summary • Presentation markup…& content markup • MathML elements… • Attributes may be specified in a start or empty tag. • Attribute values must be enclosed in quotes.

  50. Summary • Presentation markup…& content markup • MathML elements… • Attributes … in a start or empty tag. • All character data must be enclosed in token elements.

More Related