Equivalences Between XML/XHTML, TeX, and LaTeX (Mathematics)
On the whole, TeX/LaTeX mathematical formulas are more readable and intuitive to type. Still, MathML lends itself to transformations to other formal languages and within itself from Content to Presentation MathML.
Overall, Presentation MathML specifies the role of each token using elements <mi> for identifiers, <mo> for operators, <mn> for numbers, <mtext> for text, and so on. These are combined using layout elements, that generally contain only elements. They include: <mrow> (a horizontal row of items), <msub>, <msup> and <munderover> (subscripts, superscripts, limits over and under operators like sums, etc.), <mfrac> (fractions), <msqrt> and <mroot> (1- and 2-parameter roots), <mfenced> (surrounding content with fences, such as parentheses)...
| XHTML | TeX | LaTeX |
|
... |
...
|
Same as in Plain TeX? % same example?
|
|
Write your MathML code between <math> and </math>. Use attibute display with values <math
xmlns="http://www.w3.org/1998/Math/MathML"
display="block"
>
x
</math>
|
Write your inline formulas between single dollar signs. Write your block formulas between double dollar signs: $$x$$
|
Same as in Plain TeX. Write your inline formulas between single dollar signs. Write your block formulas between double dollar signs: $$x$$
|
|
Simple formulas require elements <mi>y</mi> <mo>=</mo> <mn>3</mn> <mi>x</mi>
Yet the right hand term of the equation looks better if gathered inside a <mi>y</mi> <mo>=</mo> <mrow> <mn>3</mn><mi>x</mi></mrow>
|
Simple formulas look like plain English in TeX/LaTeX: $y = 3x$
|
Simple formulas look like plain English in TeX/LaTeX: $y = 3x$
|
|
Use elements <msubsup> <mi>a</mi> <mn>0</mn> <mn>3</mn> </msubsup>
|
Use '^' for superscripts and '_' for subscripts: $$a_0^3$$
|
Use '^' for superscripts and '_' for subscripts: $$3a_0^3$$
|
|
Numbered equations are produced ...? |
Numbered equations are produced using the control sequence \eqno, or with numbers on the left hand side by using \leqno: $f(x)g(x) = x^2 - 1.\eqno(15)$
|
...
|
|
... |
In mathematics mode the character ' has a special meaning: $f' = g''$
|
Same as in Plain TeX? % same example?
|
|
Special or reserved characters (built-in entities) ', ", <, and > must be typed: ' " < >
|
Special or reserved characters #, $, %, &, _, {, and } must be escaped. \ is represented by \backslash. \# \$ \% \& \_ \{ \} \backslash
|
Same as in Plain TeX? % same example?
|
|
Greek letters (and other symbols) are entities that must be defined before being used, or be specified through their unicode number. Thus alpha (α), pi (π), and chi (χ) are obtained by typing: α π χ
|
Greek letters (and other symbols) are produced in mathematics mode by preceding the name of the letter by a backslash (\). Thus the Greek letters alpha (α), pi (π), and chi (χ) are obtained by typing: \alpha \pi \chi
|
Same as in Plain TeX? % same example?
|
|
Fonts are styled in CSS files math { font-size: 12pt;}
|
Fonts are selected with \cal, \bf, \it... Math italic (mit) is assumed, though.
|
Same as in Plain TeX? % same example?
|
|
... <mi>a</mi> <mo>=</mo> <mn>0</mn> <mtext>only if...</mtext>
|
The recommended way to obtain ordinary text in displayed mathematical formulae is to use \hbox. $a = 0 \hbox{ only if...}$
|
Same as in Plain TeX? % same example?
|
|
Fractions are typeset through binary <mfrac><mi>a</mi> <mfrac><mn>2</mn><mn>3</mn></mfrac>
|
Fractions in Plain TeX are typeset using the construction {numerator $a {2 \over 3}$
|
Same as in Plain TeX? % same example?
|
|
Some expressions are fenced between delimiters with a mfenced element. <mfenced open='{' close='}'><mi>a</mi><mi>b</mi><mi>c</mi></mfenced>
|
TeX recognizes (, [, { and | as left delimiters, and ), ], }, and again | as right delimiters. Double | is typed by \|. ${a, b, c}$
Larger delimiters are sometimes required which have the appropriate height to match the size of the subformula which they enclose. Type \left(1 + {x^2 \over 3} \right)
By typing \left. and \right. one obtains null delimiters which are completely invisible $\left. {du \over dx} \right|_{x=0}.$
|
Same as in Plain TeX? % same example?
|
|
... |
Multiline Formulae in Plain TeX are aligned by means of $$\eqalign{a^2 &= c^2 - b^2\cr
&= 4\cr}$$
Some other times you use $$|x| = \cases{ x &if $x \geq 0$;\cr
-x &if $x < 0$.\cr}$$
|
Same as in Plain TeX? % same example?
|
|
... |
Matrices and other arrays are produced in Plain TeX using the control sequence $$\left(
\matrix{ a & b & c \cr
d&e&f\cr
g & h & i \cr} \right)$$
Since matrices delimited by round brackets are so common, Plain TeX provides the control sequence $$\pmatrix{
a & b & c \cr
d&e&f\cr
g & h & i \cr} \right)$$
|
Same as in Plain TeX? % same example?
|
|
... |
Whether an expression is placed over or under an operator (as opposed to being its superscript or subscript) depends on the class of the operator ( $$\lim_{x \to 0} {1 \over x}$$
|
Same as in Plain TeX? % same example?
|
|
Space is created by grouping space separated units into <mrow><mn>2</mn><mi>a</mi></mrow> <mo>=</mo> <mrow><mn>3</mn><mi>b</mi></mrow>
|
In TeX space is explicitly created through \, (which is removed by \!) and others such as quad and qquad. $$x^2\,dx$$
|
Same as in Plain TeX? % same example?
|
|
... |
...
|
Same as in Plain TeX? % same example?
|
|
... |
...
|
Same as in Plain TeX? % same example?
|