860 likes | 1.06k Views
Bringing Mathematical Formatting to the Web. Bebo White Stanford Linear Accelerator Center bebo@slac.stanford.edu. Why?. The Web was invented to communicate scientific data Why has the display of mathematical formulae been a problem? Mathematical formatting is not easy
E N D
Bringing Mathematical Formatting to the Web Bebo White Stanford Linear Accelerator Center bebo@slac.stanford.edu
Why? • The Web was invented to communicate scientific data • Why has the display of mathematical formulae been a problem? • Mathematical formatting is not easy • The Web has had limited tools supporting math • Mathematicians/scientists are exacting about mathematical layout – they expect something like TEX or LATEX
What’s My Interest? • SLAC publishes and distributes scientific papers • Web-based conference proceedings • SLAC has a long standing commitment to the Web
I have “adopted” this formula for my examples in this talk • “The Pearson product moment coefficient • of correlation”
The Challenges • Rendering • bringing the granularity of LATEX to the level of HTML • graphical and textual representations • display issues - baselines, etc. • Generation • formatting tools • application output
The Challenges (cont) • Interoperability • use of semantic information in other applications
Web Math Formats • Images • MathML • TEX or LATEX • SVG • Controls
MathML • The Mathematical Markup Language, or MathML, is an XML application for describing mathematical notation and capturing both its structure and content. The goal of MathML is to enable mathematics to be served, received, and processed on the Web.
MathML – Not Just For the Web MathML Interface Mathematics Across Applications
MathML (cont) • Pro: • The first W3C-endorsed XML vocabulary • A low-level format for coding the presentation and semantics of a mathematical object • Fast and high quality printing and rendering • Facilitates the use and re-use of math content on the Web and other applications
MathML (cont) • Con: • Complex to author – depends on tools • Limited browser support
MathML • MathML 2.0 - W3C Recommendation - February 2001 • W3C Math Working Group composed of major players • MathML is an instance of XML
AMS / Mathematical Reviews Boeing Design Science Inc. IBM Research Division MacKichan Software, Inc. MATH.EDU Inc Microsoft Numerical Algorithms Group PentaScope Stilo Technologies SAFIR Research Group (INRIA) Radical Flow Inc. Universita di Bologna University of Western Ontario W3C Waterloo Maple Inc. Wolfram Research Inc. W3C Math Working Group http://www.w3.org/Math/
MathML Goals • 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.” • “MathML is not designed for people to enter by hand but specialized tools provide the means for typing in and editing mathematical expressions.”
MathML Goals (cont) • To provide a low-level format for describing mathematics as a basis for machine to machine communication • To facilitate the use and re-use of mathematical and scientific content on the Web
Arithmetic Algebra Logic Relations Set theory Calculus Sequences Series Functions Statistics Linear algebra Vector calculus Scope of MathML
Taxonomy of MathML Elements • Presentation elements - describe mathematical notation's visually oriented two-dimensional structure; e.g., <mrow> • Content elements - describe mathematical objects directly and what they mean; e.g., <vector> • Interface elements - describe how MathML can be used with other markup languages and applications; e.g., <math> passes parameters to a MathML processor
Presentation Elements • MathML presentation markup consists of about 30 elements which accept over 50 attributes • Most of the elements correspond to layout schemata, which contain other presentation elements • Each layout schema corresponds to a two-dimensional notational device, such as a superscript or subscript, fraction or table
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>∑</mo>rendering: S
Basic Presentation Elements (cont) • <mi> – identifier, such as a variable, function name, constant, etc. • <mo> – operator, such as a summation, fence (parentheses, brace, etc.), accent, etc. • <mn> – number
Basic Presentation Elements (cont) • <mi> – identifier, such as a variable, function name, constant, etc. • <mo> – operator, such as a summation, fence (parentheses, brace, etc.), accent, etc. • <mn> – number • What is this expression?<mi>x</mi><mo>–</mo><mo>(</mo> <mn>3</mn><mo>+</mo><mi>y</mi><mo>)</mo>
Basic Presentation Elements (cont) • <mi> – identifier, such as a variable, function name, constant, etc. • <mo> – operator, such as a summation, fence (parentheses, brace, etc.), accent, etc. • <mn> – number • What is this expression?<mi>x</mi><mo>–</mo><mo>(</mo> <mn>3</mn><mo>+</mo><mi>y</mi><mo>)</mo> x – (3 + y)
Other Presentation Elements • Presentation elements are grouped: • Token Elements • <mi> identifier • <mn> number • <mo> operator, fence, or separator • <mtext> text
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
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
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
Other Presentation Elements • Presentation elements are grouped: • Token Elements • General Layout • Scripts and Limits • Tables • Actions • <maction> binds actions to a subexpression
Token Elements • Some MathML elements, (e.g., <mfrac>) have other MathML elements in their content • Other presentation elements do not (e.g.,<mi>, <mo>, and <mn>) • These are token elements • Token elements are the only elements which directly contain character data
Scripts – Sub & Super • Elements which, by definition, 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> <msubsup><mi>x</mi> <mn>1</mn> <mn>2</mn></msubsup>
Content Elements • Content markup consists of about 100 elements accepting roughly a dozen attributes • The majority of these elements are empty elements corresponding to a wide variety of operators, relations and named functions • There are also elements used to apply operations to expressions and to make new mathematical objects from others
Content Elements • Most fundamental to content markup is the <apply> element, which enables the explicit application of a function to its argument.
Content Elements • <apply>application of a function to argument. • Token Elements • <cn> content number (e.g., <cn type="real"> 12345.7 </cn> ) • <ci> content identifier (e.g., <ci type="vector"> V </ci> )
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
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
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
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
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.
Presentation and Content <math> <reln> <eq/> <ci>E</ci> <apply> <times/> <ci>m</ci> <apply> <power/> <ci>c</ci> <cn>2</cn> </apply> </apply> </reln> </math> <math> <mrow> <mi>E</mi> <mo>=</mo> <mrow> <mi>m</mi> <mo>⁢</mo> <msup> <mi>c</mi> <mn>2</mn> </msup> </mrow> </mrow> </math>
Enlivening Markup <math> <maction actiontype="audio"> <mrow> <mi>E</mi> <mo>=</mo> <mrow> <mi>m</mi> <mo>⁢</mo> <msup> <mi>c</mi> <mn>2</mn> </msup> </mrow> </mrow> <mtext>emc.wav</mtext> </maction> </math> Enlivening markup allows coding of various kinds of actions on notation, such as occur in an expression which toggles between two pieces of notation.
Interface Elements • Interface elements describe how MathML can be used with other markup languages and applications • <math> passes parameters to a MathML processor • <semantics> contains references and attributes for external program processing • <annotation> contains arbitrary data. This data may be in the form of text, computer algebra encodings, C programs, or whatever a processing application expects
Examples of Element Attributes <mfrac linethickness='0'> …</mfrac> <mspace width='12'/> <mtable columnalign="center"> …</mtable>
Generating MathML • Not intended to be authored “by hand” • Programs such as Mathematica, Maple, MathType support/export MathML • MathML editing/authoring environments • Most tools can generate either • Embedded MathML (in HTML, XHTML, or XML files) • MathML (.mml) files
MathML Tools: Computing • Maple: an interactive math computational system from Waterloo Maple http://www.maplesoft.com/standards/MathML/ info.html • Mathematica: a technical programming environment from Wolfram Research http://www.wolfram.com/products/mathematica/ • REDUCE: algabraic calculator reads and writes MathML (1999). http://www.uni-koeln.de/REDUCE/
MathML Equation Editors • Amaya (editor and browser) - http://www.w3.org/Amaya/ • MathType (editor and MSWord plug-in) -http://www.mathtype.com/ • WebEQ (developers suite) - http://www.mathtype.com/en/products/webeq/