Producing MathML with Tralics

French title: Produire du MathML avec Tralics

Author: José Grimm

Location: Sophia Antipolis

Inria Research Theme: THnum

Inria Research Report Number: 6181

Revision: 2

Team: Apics

Date: May 2007

Revised Date: 29 November 2007

Keywords: Tralics, XML, MathML, mathematics, LaTeX, HTML, Pdf.

French keywords: Tralics, XML, MathML, mathématiques, LaTeX, HTML, Pdf.

Note: The software and the documentation is available at

Author's email address: Jose.Grimm[at]


The purpose of this paper is to show that it is possible to translate almost every mathematical formula from LaTeX syntax to XML. The document you are reading contains a great number of formulas extracted from the TeXbook, the LaTeX companion, the MathML recommendation, and translated into XML by Tralics; it is available in Pdf or HTML version.

The HTML version was produced using a very simple style sheet; mathematics are left unchanged, and you need a MathML-aware browser, like Firefox, or adequate plugins, and a set of fonts for the symbols or operators. The Pdf version was obtained by use of xmltex (a package by D. Carlisle that makes TeX an XML interpreter), and a great number of modifications to the file mathml2.xmt (that interprets elements in the MathML namespace). All files needed to produce this document are part of the Tralics bundle (version 2.10 or more).

This document was compiled with the experimantal version 2.10.8, in which examples in section 4.1 should work fine.

French Abstract

Le but de ce papier est de démontrer qu´il est possible de traduire presque toutes les formules de mathématiques de la syntaxe LaTeX vers le langage XML. Le document que vous lisez contient un grand nombre de formules extraites du TeXbook, du LaTeX companion, de la recommandation MathML, et traduites en XML par le logiciel Tralics. Il est disponible en HTML et en Pdf.

La version HTML est obtenue en utilisant une feuille de style assez simple, qui laisse les formules de mathématiques inchangées; pour la lire, il vous faut un navigateur ou un plugin qui sache interpréter le MathML et les fontes associées pour les symboles et les opérateurs. La version Pdf a été obtenue grâce au package xmltex de D. Carlisle (qui fait de TeX un interprète XML), et un grand nombre de modifications dans le fichier mathml2.xmt, qui contient le code d´interprétation des mathématiques. Tous les fichiers nécessaires pour obtenir ce document sont distribués avec le package Tralics à partir de la version 2.10.

Short Table of Contents

1. Introduction
2. Examples from the TEXbook
3. Higher Mathematics, TLC2
4. Other Examples
5. Font tests
6. Examples from the MathML recommendation
Table of Contents

1. Introduction

The technical reports [6] and [7] describe some features of the Tralics software, a LaTeX to XML translator, and associated tools. In particular, we explain how the XML file can be converted to HTML, or to Pdf (using the excellent work of D. Carlisle and S. Rahtz ([10], [3], [2]). One application is RalyX (Inria´s Annual Activity Report), where all math formulas are converted to images before inclusion in the HTML document.

Recently, the cedram (Centre de diffusion de revues académiques de mathématiques, has decided to convert the metadata of some collections (including the Annales de l´institut Fourier) from LaTeX to HTML, [1]. The Tralics software has been adapted for this purpose, the idea being the following: there are nowadays some browsers with a high quality math renderer, where native MathML formulas are more readable than images; thus the web site presents each document in two versions, neither of which containing an image. By default you see something like L 1 (T), and the alternate version contains $L^1(\mathbb{T})$. This looks like the source code, but non-trivial operations are performed, as explained below.

There is a torture file that comes with Tralics; the purpose is to make sure that no error occurs while compiling expressions like \cfrac12, but it is hard to check that the result is correctly translated. For this reason, we decided to create a sample file containing, not only all examples of the LaTeX companion second edition [9], but also those of the TeXbook [8], or the MathML recommendation [4], and to convert it to HTML. Translation is correct if the HTML page prints correctly. This file is available on the Web, we hope that it will convince you to use the Tralics software, and put your math documents on the Web. We have inserted comments explaining why some constructions do not work, if you have a solution or suggestions, please send mail to the author. Additional examples are welcome.

We also wanted to make sure that the RalyX still works: more than one hundred teams use Tralics once a year, asking sometimes silly questions, like: how to add color to the text, or a page break; the answer is generally either `not yet implemented, wait for next year´, or `incompatible with the Raweb semantics´. This document uses colors and page breaks, as explained below; no modification to the translator was needed, but, unless the style sheets are modified, these additions are ignored.

For these reasons we converted the whole document to Pdf. This was not trivial, especially because of a lack of font families (this will be discussed later). Note also the format of the document: in the HTML version all metadata (author, title, abstract, etc.) are placed at the start of the document by the XML to HTML processor. In the case of the Pdf version, this was not so easy: something as trivial as \newpage \null \vskip-2cm is impossible to express in XSL/FO (said otherwise, all my attempts failed), and I had to add a new element <vspace> for this purpose.

The source file testmath.tex is part of the Tralics distribution; translating it requires Tralics version 2.10, and some packages, like amsmath (do not try to include the file amsmath.sty, this is not possible; you must use amsmath.plt instead). In most cases we show the TeX source before the translation. There are some exceptions, for instance we leave as an exercise to find out how we solved the exercises of the TeXbook. Examples of the LaTeX companion [9] are available on the CD that comes with the book.

The XML file was converted into HTML, math formulas are left unchanged. We explain in some cases that what we see is not what we expected. Here FL means Firefox on Linux (unless specified, it is Firefox 2.0, on Fedora Core 3) and FM means Firefox on MacIntosh (unless specified, it is Firefox 2.0 on a PowerBook G4, MacOS 10.4). We also tested Amaya, bot AM (version 9.55 on Mac) and AL (version 9.99 on Linux FC5).

Installing math fonts for use with a web browser is not always easy: they are installed as explained on the Mozilla web page, but this page seems unclear to me: on one Linux machine, Firefox is happy with the fonts, but uses the wrong font when printing, on another one, Firefox says that fonts Math1, Math2 and Math4 are missing, but the printed result is correct.

1.1. Special features

You are not supposed to insert page breaks in your document, but if you put twenty tables in a row, you will get error messages of the form: to many unprocessed floats, and then you are in trouble. In this case, the only remedy is to insert some \clearpage commands; in this document, we used the \xbox command in order to produce an empty <clearpage> element in the XML document, and we adapted the style sheets.

There is a \clearpage before this section; you will not notice it because there is a natural page break there. On the other hand, it is likely that you will see the page breaks in Chapter three, but there is no easy solution: there is no text in the current chapter to fill the gaps. In order to improve the layout, we changed the ordering of the figures, starting with tables 3 and 4, that occupy a full page, and inserting smaller tables after that. Moreover, table 4 was too big to fit on a page (the baseline in this document is much larger than in the LaTeX companion) and we split it into two parts. We are happy since this gives 8 full pages with floats, and a single bad page, the last text page of the chapter.

Concerning colors, you can put any attribute you like to any object (there is no attempt to validate the document against some DTD). In the case of math formulas, identifiers, numbers and operators accept some common attributes including font information and colors, these are currently ignored when converting XSL/FO into Pdf (but this can easily be changed, it suffices to add some lines of code to the raweb-cfg.sty file. However, the color attribute is honored for the <mstyle> element (all symbols appearing in the LaTeX companion for which no Unicode element has been found are replaced by a red X using this method). For the text case, the <inline> element is translated into <span> element in the HTML and a <fo:inline> element in the Pdf, all attributes are copied; in the previous sentence we have used


This example shows that you can use a named color, or one defined in RGB syntax, using six hexadecimal digits; use sharp or backslash sharp as indicated here.

1.2. Compiling the example file

These are the options you can use when compiling the file testmath.tex

-noentnames -trivialmath=7 -leftquote=2018 -rightquote=2019 -nozerowidthspace

The first option says that you prefer &#x21DA; to &Lleftarrow; (this is useless if you use an XSLT processor to convert the XML document). Option `trivialmath=7´ says that simple math expressions are translated as text; option `mathvariant´ says that a command like \mathbb should add a mathvariant attribute; these two options set initial values to some counters, they are not needed, because the associated file testmath.ult resets them to the values needed here. Following options are problematic. If you say `nostraightquotes´, this changes the translation of the apostrophe character to character U+B4, this option produces a nice HTML file, but the Pdf is not so nice. Here we modify left and right quotes to U+2018 and U+2019. If you say `zerowidthspace´, Tralics inserts an invisible character in verbatim mode, that is supposed to inhibit ligatures when converting the XML file into Pdf file, the trouble is that this character is shown as a normal space by my browser in certain cases. In Tralics version 2.10, the translation changed: the old behavior can be obtained by saying -nozerowidthelt. Otherwise an element is created, this element is transformed into a zerowidthspace character when the document is converted to Pdf, is omitted when the document is converted to HTML. This means that the option is useless.

The following files are needed for the compilation:

When converting the document to HTML, we use the `xsltproc´ program. The style sheet is testmathhtml.xsl; this is a short style sheet; but it needs cls.xsl and RR.xsl. Conversion to XSL/FO uses RRfo.xsl as style sheet, it needs clsfo.xsl, that includes raweb3-param.xsl, rrrafo3.xsl, clspages.xsl, RRfosimple.xsl, clsfotable.xsl. Note: this list is likely to change; we have to separate clearly the RA (activity report), the RR (research report) and CLS (standard classes). All these files are in the directory xml or styles of the Tralics distribution, but the XSLT processor wants to see them in the current directory.

Conversion from XSL/FO to pdf is achieved by compiling the file wtestmath.tex containing the following lines

1 \def\xmlfile{}
2 \def\LastDeclaredEncoding{T1}
3 \input{xmltex.tex}
4 \end{document}

It requires xmltex.tex and other files from the xmltex distribution, so that you must install these files first. There are some bugs or incompatibilities in the fotex distribution, so that you must use the two files fotex.xmt, fotex.sty as distributed in the xml directory. Additional required files are fotex-add.sty, raweb-uni.sty, and fotex.cfg. Finally the file wtestmath.cfg should be a symbolic link to raweb-cfg.sty.

1.3. Overview of math mode

The main change between Tralics version 2.9 and 2.10 concerns handling of math formulas. Two steps are required for processing them: first a tree is created, after that, it is converted. This mechanism is similar to the behavior of TeX, but some details are not yet implemented, and some information is lost (for instance, \mathbin is a command that says that the object that follows should be of type `binary´; this information is used by the program, but the resulting XML tree does not contain this information (we cannot simply add an attribute pair class=bin to the object).

When Tralics sees a math formula, it constructs recursively a tree, also called a math list. The action after a token has been read is the following: If the token is expandable (a user defined command for instance), expansion takes place, this can read some tokens, it can add new tokens to the stream (to be read again). If the token is a mode-independent command it will be executed (for instance, you can change the meaning of some commands). Otherwise, the token is added to the tree, but there are some exceptions. The easy case is when a whole subtree is read, for instance when the token is a left brace, a \begin command, etc. In some cases, the execution level is incremented (said otherwise, the behavior is the same as a group defined by braces in non-math mode). In a case of \begin, a token list is read, and the behavior depends on whether this is a user defined environment (normal expansion rules apply), or a built-in one. Most built-in environments are matrix-like, and each cell is evaluated in a group; this has the following consequence: if the math formula contains an unwanted ampersand character, an error will be signaled when that character tries to finish the cell-group (because the current group is of type math), and an error is signaled at the end of the math expression (because the ampersand character has added a second group after the first, a cell-group, where the end-of-math character expected a math-group). A third error will be signaled later: when the tree is converted into a MathML object, Tralics may complain about non-math tokens in the expression. A font change command like \mathbb changes the internal state and adds two tokens to the tree, one that selects the blackboard font (before the argument) and a token that selects the current font (after the argument).

In the case of $L^1(\mathbb{T})$ the tree has eight nodes. One is a subtree, containing the argument of the command. They are six characters, and two commands (select double-struck font, or select normal font). When the tree is converted into a MathML expression, some nodes are converted to basic XML elements (the letters), some are ignored (the font change commands), and others are used to construct an XML tree. We shall see later that parentheses, braces, and tokens like that can induce <mrow> elements; translation of the hat character is non-obvious, because MathML provides <msub> and <mover> as possible translations; a command like \nolimits placed after a token is an indication for the translation of the hat that follows. When the tree is converted the current style is looked at, this quantity depends on the position in the tree (the style of the numerator of a fraction or the style of an exponent after the hat is smaller than the current style, while the style of the numerator of a \cfrac is always text style) or the presence of style change commands. Some commands depend on the style (for instance \mathchoice) and are conditionally interpreted.

The characters in the formula above are of type letter (L, T), or type non-letter (the digit, or the parentheses), or other (the hat). An interesting question is: what happens if the single L (or any other character) is replaced by a double one? A first answer is that this just adds a new token to the tree (there is a special case: ^^1 is a non-obvious way to represents the character q). Spaces are ignored, so that doubling them has no effect. Two hat characters in a row signal an error (assume for instance that a space between them inhibits the double-hat feature mentioned above). Two consecutive new line characters are replaced by \par, this is illegal. Characters that are neither letters nor digits generally translate to a <mo> element. No attempt is made to convert two plus characters into a double plus character (some people use `:=´ as an operator, meaning `is equal by definition´, and expect no white space between the two characters). In a case like \sqrt\frac{1}{2}, where we have two consecutive commands that take arguments, the argument of the root operator is the fraction operator, not the full fraction (this expression is accepted by LaTeX, as an unexpected consequence of the implemented of the fraction operator that provides that braces that delimit the argument of the square root, it is rejected by Tralics).

The superscript and subscript operators (generally associated to hat and underscore characters) are hybrid commands: most commands, for instance \frac, are prefix commands (they come before their arguments), a few commands, like \over, are infix operators (the first argument is before the operator). In the case of hat, there is one argument after the operator, but the operator acts on the kernel that is to its left (in the example the kernel is L, but a kernel can have an index and an exponent, so that the order of tokens can be: kernel, underscore, index, hat, exponent). Translation of character L is a <mi> element; Tralics tries to converts LL or TT into a single element, according to the following rule. Assume that \T is defined to be \mathbb{T} and \TT is defined to be \mathbb{TT}. Then \TT produces a single element with two characters, while \T\T produces two elements with a single character. On the other hand, a strange rule of MathML says that the font used for a <mi> element (that lacks font attributes) depends on the number of characters in it; for this reason, in a formula like xy, the translation is a sequence of two <mi> elements, without attributes, containing a single character (implicit product). In a case like 17, a single <mn> element is constructed, because this represents a number (in a case like x 12 , an implicit comma could be added in the case where the expression refers to row 1 column 2 of the matrix x; however, do not expect such a behavior in a near future). The source code of the expression above is $x_{12}$. Without the braces, the translation is x 1 2 (if you do not see the difference, there is a bug somewhere).

If the internal counter \@nomathml is negative, the tree is converted to a character string in a trivial manner; in a case like \cfrac12, you will see \cfrac{1}{2}, because we have a sub-tree with two nodes (the two arguments of the command). In reality, the command takes an optional argument, and its value is printed only if it is not empty. In a case like L 1 (T), you will see two font changes as explained above. If you want to see the characters \mathbb there are two solutions: the easy one works only since version 2.10: Tralics inserts in the tree all commands that behave like \relax; these commands are ignored when converting the tree into a MathML expression, but the name is used otherwise; thus \let \mathbb \relax does the job. Otherwise, it suffices to redefine \mathbb in order to expand to the desired string (using \string for instance). Note: since version 2.10, a font change command that takes an argument defines a semi-simple group, by inserting \begingroup and \endgroup commands.

2. Examples from the TEXbook

2.1. Typing math formulas, TB 16

The TeX book starts slowly; first Knuth explains that math formulas are enclosed in special math brackets, dollar signs. He also says that spaces are ignored in math mode.

1 `$x$', `$2$', `$ x$', `$ 2 $',
2 `$(x + y)/(x - y)$', `$(x+y) / (x-y)$'

Easy formulas: `x´, `2´, `x´, `2´, `(x+y)/(x-y)´, `(x+y)/(x-y)´.

We show here some Greek letters, and some other symbols:

3 $\Gamma, \nu,\kappa$,
4 $\phi,\emptyset, \epsilon,\in,\approx,\mapsto$
5 $(\phi,\theta,\epsilon,\rho)$,
6 $(\varphi,\vartheta,\varepsilon,\varrho)$,
7 $$\alpha, \beta, \gamma, \delta.$$

Greek letters Γ,ν,κ, and other symbols: φ,,ϵ,,,; standard Greek(note: ) letters, (φ,θ,ϵ,ρ), and variants (ϕ,ϑ,ε,ϱ), a display math formula:

8 \begingroup
9 \catcode`\*=3
10 *x^2*, \( x_2\), \begin{math}\Sigma\end{math}
11 **A** \[ B\] \begin{displaymath} C \end{displaymath}
12 \endgroup

We show here that any character of category code 3 can be used as math delimiter: x 2 , as well as two alternative ways introduced by LaTeX: x 2 , Σ. We show that display math can be entered by doubling the character of category 3 (actual rules are more complicated, see the TeXBook), or using a LaTeX environment (additional environments will be explained in later chapters), or using brackets. Note that brackets are very useful, because they are so easy to type.


Exercise 16.1: γ+νΓ.

Exercise 16.2: \le,\ge,\ne, \leq,\geq, and \neq: ,,, ,,.

Complex formulas with superscripts(up high) and subscripts (down low).

13 $x^2$, $x_2$, $2^x$, $x^2y^2$, $x ^ 2y ^ 2$, $x_2y_2$, $_2F_3$,
14 $x^{2y}$, $2^{2^x}$, $2^{2^{2^x}}$, $y_{x_2}$, $y_{x^2}$.

Translation x 2 , x 2 , 2 x , x 2 y 2 , x 2 y 2 , x 2 y 2 , 2 F 3 , x 2y , 2 2 x , 2 2 2 x , y x 2 , y x 2 .

Consider now the following two formulas:

15 $((x^2)^3)^4$,  ${({(x^2)}^3)}^4$.

Translation of the first formula

16 <formula type='inline'>
17   <math xmlns=''>
18     <mrow>
19       <mo>(</mo>
20       <mo>(</mo>
21       <msup><mi>x</mi> <mn>2</mn> </msup>
22       <msup><mo>)</mo> <mn>3</mn> </msup>
23       <msup><mo>)</mo> <mn>4</mn> </msup>
24     </mrow>
25   </math>
26 </formula>

Translation of the second formula

27 <formula type='inline'>
28   <math xmlns=''>
29     <msup>
30       <mrow><mo>(</mo>
31         <msup>
32           <mrow>
33             <mo>(</mo>
34             <msup><mi>x</mi> <mn>2</mn> </msup>
35             <mo>)</mo>
36           </mrow>
37           <mn>3</mn>
38         </msup>
39         <mo>)</mo>
40       </mrow>
41       <mn>4</mn>
42     </msup>
43   </math>
44 </formula>

The current Tralics uses some hacks, so that the translation is actually different. You will get first ((x 2 ) 3 ) 4 , second ((x 2 ) 3 ) 4 , third ((x 2 ) 3 ) 4 , and fourth ((x 2 ) 3 ) 4 . Here the first two formulas correspond to the XML fragment shown above (they were produced by prefixing each parenthesis with \mathord, and after that we have the actual translation. The MathML recommendation says that some operators are stretchy, so that the width and height can depend on the context. This is not the case in xmltex, so that, in the Pdf version, all parentheses have the same size. The \mathop prefix tells Tralics to not consider parentheses as stretchy, so no hack is applied. We shall not explain the hack here; moreover we modified it in version 2.10.8. We originally wrote All parentheses have the same size in the pdf version, the same is true for the HTML version in the first formula. Now, the <mrow> elements delimit a scope, so that inner parentheses are smaller than outer parentheses (but only for HTML, second formula); note that the placement of the exponent depend on the context, so that, in the second formula, all three superscripts at placed at different positions. In the case of the first formula, placement of the exponent depends only on the the size of the parentheses (hence, in the Pdf version, they should be aligned, in the HTML version, they are not). Firefox on Mac shows the following: all superscript are aligned. Big parentheses are used but for case 2. Amaya shows only small parentheses, scripts are not aligned, but this is hard to see.

The MathML recommendation says that the second alternative is better; but Knuth says: “The first alternative is preferable, because it is much easier to type, and it is just as easy to read.”

45 `${}_2F_3$', `${_2}F_3$', `${_2F_3}$'

Exercise 16.3: Three ways to have an empty kernel: ` 2 F 3 ´, ` 2 F 3 ´, ` 2 F 3 ´. The translation is the same in all cases because of the following two rules: if a math list starts with a subscript or superscript operator, an empty math list is added before, it serves as kernel (thus, braces in the first example are useless); a math list is packaged by putting it in a <mrow> element, unless the list has one element (in the second example, there are two tokens between the braces, converted to a single <msub> element, the math list has a single element, braces are useless). In these two cases, the main math list has two <msub> elements, and a <mrow> is added. In the last case, the main math list has a single element, a <mrow>, thus, no <mrow> is added and braces are useless.

46 `$x+_2F_3$' and `$x+{}_2F_3$'.

Effect of braces after plus sign: `x+ 2 F 3 ´ and `x+ 2 F 3 ´. The MathML recommendation says that the distance between the plus sign and the letter F should be the same in both cases; in the first case, index 2 is attached to the plus sign, in the second case to the letter F (AM shows both formulas with index attached to F).

47 ${x_2}_3$, $\displaystyle {\sum}'$

Note that an <mrow> element is added for a math list with a single element in the case where it is followed by a subscript or a subscript. Reason one: in a case like x 2 3 , you will get an error if braces are omitted; in the same fashion, an error is signaled (when converting to Pdf) if <mrow> is missing. Reason two, in a case like ' , the apostrophe is not placed above the sum if there is a <mrow> (the sum operator has type Op, but not the group, unless there is a \mathop before it).

Exercise 16.4: Double superscript, x y z , x y z .

48 $x^2_3$, $x_3^2$, $x^{31415}_{92}+\pi$, $x_{y^a_b}^{z_c^d}$.
49 $P_2^2$ and $P{}_2^2$.

Simultaneous superscripts and subscripts x 3 2 , x 3 2 , x 92 31415 +π, x y b a z c d .

Vertical alignment: P 2 2 and P 2 2 . In the first case, scripts are attached to the letter P, and alignment can depend on the slant of the letter. (Amaya has extra space in the second formula).

50 `$\prime$', $y_1^\prime$, $y_2^{\prime\prime}$, $y_3^{\prime\prime\prime}$,
51 $f'[g(x)]g'(x)$, $y_1'+y_2''$, $y'_1+y''_2$, $y'''_3+g'^2$

Primes and shorthand: `´, y 1 , y 2 , y 3 , f [g(x)]g (x), y 1 +y 2 , y 1 +y 2 , y 3 +g 2 . In the code shown here, the character used as delimiter for XML attributes is character U+39, the quotes around the math formulas are U+60 and U+B4 (this character can be changed via an option of the program, in verbatim mode it is always U+39, straight quote). The prime character used in the formula is U+2032. This is not the right character. Thus, in Tralics 2.9.5, translation of prime changed, it is now character U+39. The same formula is now: `'´, y 1 ' , y 2 '' , y 3 ''' , f ' [g(x)]g ' (x), y 1 ' +y 2 '' , y 1 ' +y 2 '' , y 3 ''' +g '2 . It is unclear whether this is the good solution. It seems that Firefox uses the same font metrics as TeX, i.e., a very large prime character that has a normal size when used at script size, while Amaya uses a normal size prime, that is small when used as a superscript. In the case of f-prime, the slant of the letter is not taken into account by Amaya, and the prime sign is hard to see.

52 $x\varprime y^\varprime, x\Prime y^\Prime,
53 x\tprime y^\tprime,x\bprime y^\bprime,x\qprime y^\qprime$

The amsmath package provides the symbols shown above; as you can see (at least with FM), these characters are not meant to be used as an exponent: xy ,xy ,xy ,xy ,xy . Note that \qprime is unkown to Amaya, and the prime subscript in the following exercice is hard to see.

Exercise 16.5: F ' (w,z)=F(w,z)/z and F ' (w,z)=F(w,z)/w.

54 \let\none\mmlnone
55 $R_i{}^{jk}{}_l$ versus $\mathbox{mmultiscripts}{Ri\none\none jk \none l\none}$

Exercise 16.6: R i jk l versus Rijkl (MathML example, section, only second index raised).

56 $\sqrt 2$, $\sqrt{x+2}$, $\underline4$, $\overline{x+y}$,
57 $\overline x+ \overline y$, $x^{\underline n}$, $x^{\overline{m+n}}$,
58 $\sqrt{x^3+\sqrt\alpha}$

Translation 2, x+2, 4 ̲, x+y ¯, x ¯+y ¯, x n ̲ , x m+n ¯ , x 3 +α. There are problems with underline and overline on FM. Vertical position is not always good, and the length is sometimes incorrect. On the fifth formula, rules are sometimes invisible in the printed version. There is a text version in Tralics: Mfoo ̲, Tfoo, Mfoo ¯, Tfoo, Mfoo ̲ ¯, Tfoo.

59 $\root 3 \of 2$, $\root n \of {x^n + y^n}$, $\root n+1 \of a$,
60 $\sqrt[3]{2}$, $\sqrt[n]{x^n + y^n}$, $\sqrt[n+1]a$, `$\sqrt[3]{~~}$'.

Translation 2 3, x n +y n n, a n+1, 2 3, x n +y n n, a n+1, ` 3´.

61 $\sqrt{\mathstrut a} + \sqrt{\mathstrut d} + \sqrt{\mathstrut y}$,
62 $\sqrt{a} + \sqrt{d} + \sqrt{y}$,
63 $\overline{a} + \overline{d} + \overline{y}$,
64 $\overline{\mathstrut a} + \overline{\mathstrut d} + \overline{\mathstrut y}$.

Translation (a+(d+(y, a+d+y, a ¯+d ¯+y ¯, (a ¯+(d ¯+(y ¯.

Exercise 16.7: 10 10 , 2 n+1 , (n+1) 2 , 1-x 2 , w+z ¯ ¯, p 1 e 1 , a b c d e , h n '' (αx) 3.

Exercise 16.8: Ifx=y,then x is equal to y. (this exercise says what you should not do).

Exercise 16.9: Deleting an element from an n-tuple leaves an (n-1)-tuple.

Exercise 16.10: Letters with descenders are Qfgjpqy.

65 $x+y-z$, $x+y*z$, $x*y/z$

Basic binary operators: x+y-z, x+y*z, x*y/z.

66 $x\times y\cdot z$, $x\circ y\bullet z$, $x\cup y\cap z$,
67 $x\sqcup y\sqcap z$, $x\vee y\wedge z$, $x\pm y \mp z$.
68 Aliases   $x\land y\lor z$.

Many more binary operators x×y·z, xyz, xyz, xyz, xyz, x±yz. Aliases xyz.

69 $x=+1$, $3.142-$, $(D*)$
70 $x=\mathmo[form][prefix]{+}1$
71 $3.142\mathmo[form][prefix]{-}$
72 $(D\mathmi[mathvariant][normal]{*})$
73 $(D\mathmo[lspace][0][rspace][0]{*})$

Binary as ordinary symbols: x=+1, 3.142-, (D*). The HTML version is slightly different from the TeX version. You can declare the plus sign as prefix operator, this gives x=+1, you can define the minus sign as prefix operator, this gives 3.142-. Removing the space around the star is more complicated, a solution consists of using an identifier in upright variant like this (D*), or by setting the lspace and rspace attributes to zero: (D*).

74 $K_n^+,K_n^-$, $z^*_{ij}$, $g^\circ\mapsto g^\bullet$, $f^*(x)\cap f_*(y)$

Binary operators in superscripts K n + ,K n - , z ij * , g g , f * (x)f * (y).

Exercise 16.11: z *2 and h * ' (z).

75 $x=y>z$, $x:=y$, $x\le y\ne z$, $x\sim y\simeq z$, $x\equiv y\not\equiv z$,
76 $x\subset y\subseteq z$

x=y>z, x:=y, xyz, xyz, xyXz, xyz. In the Pdf version there is no space between the colon and the equals sign, but the HTML version shows some, because the rules are not the same for TeX and MathML. The best solution would be to use a single operator instead of two consecutive ones; the user can define a command \coloneq that behaves like colon-eq in normal TeX, or Tralics could be modified in order to recognise sequences like this. Translation of \not is problematic: in this document we consider it as an undefined operator, and you see a red X. We should add rules like: \not= should give \ne.

77 $f(x,y;z)$, $f:A\to B$, $f\colon A\to B$
78 %\def\colon{\mathmo[lspace][0]{:}}

Punctuation f(x,y;z), f:AB, f:AB. Note that \colon is a colon with lspace = `0pt´, but the attribute is ignored in the Pdf version. It seems that Amaya uses a zero lspace by default.

79 $12,345x$, $12{,}245x$, $\mathcn{12,345}x$, $\mathmn{12,345}x$

12,345x, 12,245x, 12,345x, 12,345x. The translation of the first two expressions is the same, braces are useless here. A silly bug of my F browser: the second digit of the first number disappears; this does not happen if the number is not the first word of a paragraph (this is why the sentence starts with a number). You should use one of the last two variants if you want the sequence of digits plus the comma to be considered as a number.

Exercise 16.12: 3·1416, but \mathmn{3^^b71416} gives 3·1416 (less space in the HTML version).

80 $\hat a$, $\check a$, $\tilde a$, $\acute a$, $\grave a$, $\dot a$,
81 $\ddot a$, $\breve a$, $\bar a$, $\vec a$
82 \def\ihat{{\hat \imath}} \def\jhat{{\hat\jmath}} $\ihat$, $\jhat$

a ^, a ˇ, a ˜, a ´, a `, a ˙, a ¨, a ˘, a ¯, a , ı ^, j ^. Character \jmath is a normal j, because there is no dotless j in most fonts. There is also a problem with the rendering of grave accents on FM.

83 $\hat{I+M}$, $\bar z+ \overline z$, $\widehat x, \widetilde x$,
84 $\widehat{xy}, \widetilde{xy}$
85 $\widehat{xy}, \widetilde{xy}$
86 $\widehat{xyz}, \widetilde{xyz}$
87 % $\ghat\in{(H^{\pi_1^{-1}})}' -> Ex16.13 below

Large accents I+M ^, z ¯+z ¯, x ^,x ˜, xy ^,xy ˜, xy ^,xy ˜, xyz ^,xyz ˜. As you can see, there is no difference between wide and non-wide operators. My browser (AM as well as FM) shows a small hat, and a variable length tilde. For the Pdf version, we have decided to use the variable size variant.

Exercise 16.13: e -x 2 , Dp α M+l, g ^(H π 1 -1 ) ' , (braces added), g ^(H π 1 -1 ) ' (without braces). In Tralics 2.11, there shuld be no difference between the version with and without braces.

2.2. More about Math, TB 17

88 $$ {1\over 2}\qquad {\rm and}\qquad {n+1 \over 3} \qquad {\rm and}\qquad {n+1
89   \choose 3}\qquad {\rm and}\qquad \sum_{n=1}^3Z_n^2. \label{eq17.1}$$
90 \[ \frac{1}{2}\qquad \text{and}\qquad \frac{n+1}{3} \qquad \text{and}\qquad
91 \binom{n+1}{3}\qquad \text{and}\qquad \sum_{n=1}^3Z_n^2.\label{eq17.2}\]

Example of vertical alignment. Translation of the first three expressions is a <mfrac> element, subexpressions are in text style (normal size). In the case of the last expression scripts are in script style (small size) and we have a <munderover> element for the sum (it is an operator with limits in display style) and a <msubsup> element for the Z (that is not an operator).

1 2 and n+1 3 and n+1 3 and n=1 3 Z n 2 .(1)

The same, using LaTeX syntax

1 2andn+1 3andn+1 3and n=1 3 Z n 2 .(2)
92 \[{x+y^2\over k+1},\qquad {x+y^2\over k}+1,\qquad
93 x+{y^2\over k}+1,\qquad x+{y^2\over k+1},\qquad x+y^{2\over k+1}\]
94 \[\frac{x+y^2}{k+1},\qquad \frac{x+y^2}{k}+1,\qquad
95 x+\frac{y^2}{k}+1,\qquad x+\frac{y^2}{k+1},\qquad x+y^{\frac{2}{k+1}}\]

Single over. The only difference in these expressions is the placement of the braces.

x+y 2 k+1,x+y 2 k+1,x+y 2 k+1,x+y 2 k+1,x+y 2 k+1 .(3)

LaTeX style: this uses a command with two arguments, that behaves without surprise.

x+y 2 k+1,x+y 2 k+1,x+y 2 k+1,x+y 2 k+1,x+y 2 k+1 .(4)
96 \[{ {a \over b}\over 2} \qquad \text{and}\qquad { a\over {b\over 2}}
97 \qquad \text{and}\qquad { a/ b\over 2} \qquad \text{and}\qquad { a\over b/2}
98  \]
99 \[ \frac{\frac{a}{b}}{2} \qquad \text{and}\qquad \frac{a}{\frac{b}{2}}
100 \qquad \text{and}\qquad  \frac{a/b}{2} \qquad \text{and}\qquad \frac{a}{b/2} \]

Double over. It is an error if you say A over B over C without adding braces. As you can see, if a fraction is in text style, its numerator and denominator are in script style, so that it is sometimes better to use a slash.

a b 2anda b 2anda/b 2anda b/2.(5)

LaTeX style (nothing special here).

a b 2anda b 2anda/b 2anda b/2.(6)

Exercise 17.1: Compare x+y 2 k+1 with x+y 2/(k+1) . If a fraction is in script style, its numerator and denominator are in script script style, i.e. smaller. In TeX, there are four styles and three sizes (display style and text style have the same size). In MathML, the size is defined by a level, zero, one, or two, but larger levels are possible; thus more than three sizes are possible. There is however a minimal font size.

Exercise 17.2: Compare a+1 b+1x with ((a+1)/(b+1))x.

Exercise 17.3: Wrong use of \over in x=(y 2 k+1).

Exercise 17.4: 71 2¢, using the \textcent command.

Exercise 17.5: Same as in the TeXbook, but not cramped.

101 \[n+\scriptstyle n + \scriptscriptstyle n\]
102 \[n+{\scriptstyle n + {\scriptscriptstyle n}}\]

Note: In the current version of Tralics, it is unclear what happens when you put style commands randomly in a math formula; in any case, Tralics uses the correct math style, but has difficulties in inserting <mstyle> elements: what is the scope? Currently such an element is added to the current math list, if it contains a style change command; in the example above, we have two such commands, thus three different styles, and a single list (first example) or three lists (second example). Translation of the first example is wrong, translation of the second example is correct because the style command is the first token of the list(note: ).

103 \[a_0+{1\over\displaystyle a_1 +
104   {\strut 1\over\displaystyle a_2+
105     {\strut 1\over\displaystyle a_3+
106        {\strut 1\over a_4}}}}\]


a 0 +1 a 1 +(1 a 2 +(1 a 3 +(1 a 4

Without \displaystyle

a 0 +1 a 1 +(1 a 2 +(1 a 3 +(1 a 4

Without \strut. Since a \strut is an invisible object of the size of a parenthesis, more or less the size of the digit one, its effect is hard to see.(note: )

a 0 +1 a 1 +1 a 2 +1 a 3 +1 a 4

Without both

a 0 +1 a 1 +1 a 2 +1 a 3 +1 a 4

Until version 2.9.4, commands of the form \hfill were illegal in math mode. Since then, they are allowed as first or last element in arguments of commands like \overline. They are ignored, unless the result is a fraction; we demonstrate here that \hfill placed at the end of the list produces a left alignment, in the case of \over, \genfrac, or \frac. Note that the \cfrac command can be used for continued fractions: its optional argument says whether the numerator is centered, left aligned or right aligned, under the assumption that the denominator is much larger than the numerator.(note: ).

a 0 +1 a 1 +(1 a 2 +(1 a 3 +(1 a 4 12345 11 12345
107 \[ {x\atop y+2}, {n \choose k}, \text{latex},
108 \genfrac{}{}{0pt}{}{x}{y+2},\binom{n}{k} \]

The \atop construction is like \over, without fraction rule; you should not use it in LaTeX, you should use \genfrac instead. The command \atopwithdelims (see below for an example) is followed by two delimiters, say A and B, it puts A before the fraction and B after it. You can use \genfrac with A and B as arguments (third argument is line thickness, fourth argument is style). The \choose command is nothing else than \atopwithdelims(). You should not use it.

x y+2,n k,latex,x y+2,n k
109 \[{ {n\choose k}\over 2} \text{ or } { n\choose{k\over2} }
110 \text{ or } { n\choose k/2} \text{ or } {n\choose{1\over2}k}\]

As mentioned above, a construction like A over B over C needs braces, where over is a generic name for \over and variants, including \choose. Nothing special is required for \frac or \binom, so that LaTeX variant is omitted.

n k 2orn k 2orn k/2orn 1 2k
111 %%$${1\over2}{n\choose k}$$; $$\displaystyle{n\choose k}\over2}$$ : TeXbook
112 $\displaystyle \frac{1}{2}\binom{n}{k}$,
113 $\displaystyle{n\choose k}\over \displaystyle 2$,
114 $\dfrac{\dbinom{n}{k}}2$.
115 {\def\P{\mathchoice{D}{T}{S}{SS}}
116 $\displaystyle{\P\choose \P}\P\over \displaystyle \P$,
117 $\dfrac{\dbinom{\P}{\P}\P}\P$.}

Exercise 17.6: 1 2n k and n k 2; LaTeX version n k 2; version with \P: T TD D, T TT T. Note that the `d´ in \dfrac or \dbinom means that the expression is in display style, hence numerator and denominator are in text style; as a consequence the \choose is same as the \dbinom; on the other hand, the \over produces a fraction in text style, with numerator and denominator in display style, while the \dfrac produces a fraction in display style, with numerator and denominator in text style. In the dvi file, the distance between D and the fraction rule is the same as the width of the rule, and the distance between the T and the rule is approximatively one third of the height of the T; my HTML FM browser uses larger values, making the difference more obvious.

Exercise 17.7: p 2x 2 y p-2 -1 1-x1 1-x 2 . Fine space added for legibility.

118 \[{\displaystyle{a\over b}\above3pt\displaystyle{c\over d}}
119 \text{~~and~~} \genfrac{}{}{3pt}{}{\dfrac{a}{b}}{\dfrac{c}{d}}\]

There are six operators that behave alike: \over, \atop and \above, and the same with delimiters. The `above´ commands read a dimension, the thickness of the fraction rule. In the current version of Tralics, this has better to be explicit (if you want the value of \parskip, you must use \genfrac).

a b c danda b c d.
120 ${\displaystyle \sum x_n}, {\textstyle \sum x_n},
121 {\scriptstyle \sum x_n}, {\scriptscriptstyle \sum x_n}$

Different sums x n ,x n ,x n ,x n . The position of the index is unaffected by the style.

122 \[ {\displaystyle \int_{-\infty}^{\infty} \sum_{n=1}^m},
123 {\textstyle \int_{-\infty}^{\infty} \sum_{n=1}^m},
124 {\displaystyle\int\limits_0^{\frac{\pi}{2}} \sum\nolimits_{n=1}^m} \]

This example demonstrates that the position of scripts depends on the style if the kernel is a math operator, and the presence of key words like `limits´, `nolimits´ or `displaylimits´. Scripts can be added to a MathML object using m/sub/sup, and for an operator using m/under/over. In this last case, the attribute movablelimits corresponds to the `displaylimits´ keyword. If set, `under´ means `sub´ if the style is not display. Tralics uses `under´ or `sub´, depending on where the indices should be placed, and never sets the attribute. On the other hand, when TeX typesets a `under´ or `sub´, it sometimes uses a wrong strategy. The last expression (display style sum without limits) uses a \msubsup element; in this case, there is an implicit \nolimits, we cannot make it explicit, because such a command has to follow an operator, and there is no easy way to check that the first child of the element is an operator (it is easy to see that it is a <mo> element, a bit more complicated to see that it contains a Unicode character, and quite impossible to say that its translation leaves TeX in state where \nolimits is allowed). Note also that we could convert the argument to an operator, but this is not always a good idea. In this example the HTML version is correct, the Pdf version is wrong(note: ).

- n=1 m , - n=1 m , 0 π 2 n=1 m
125 \[\lim_ax+\lim\nolimits_l x+\lim\limits_ax+\lim\displaylimits_ax\]
126 \[\textstyle \lim_lx+\lim\nolimits_l x+\lim\limits_ax+\lim\displaylimits_lx\]
127 \[\sin_lx+\sin\nolimits_l x+\sin\limits_lx+\sin\displaylimits_ax\]
128 \[\textstyle \sin_lx+\sin\nolimits_l x+\sin\limits_lx+\sin\displaylimits_lx\]

More about limits. Knuth says that \nolimits\limits produces limits; so that \sin\limits produces limits; a special feature of amsmath is that the token that follows the \sin is ignored if it is a \limits token. According to amsmath, an index A should be below the operator, an index L is a normal subscript; the example here shows that Tralics behaves more like TeX.

lim a x+lim l x+lim a x+lim a x
lim l x+lim l x+lim a x+lim l x
sin l x+sin l x+sin l x+sin a x
sin l x+sin l x+sin l x+sin l x
129 \[\operatorname*{sin}_a \operatornamewithlimits{sin}_a \qopname\relax{n}{sin}_a
130 \operatorname{sin}_l  \qopname\relax{o}{sin}_l
131 \mathop{\rm sin}_a\mathop{\rm sin}\limits_a\]
132 \[\textstyle\operatorname*{sin}_l \operatornamewithlimits{sin}_l
133  \qopname\relax{n}{sin}_l\operatorname{sin}_l  \qopname\relax{o}{sin}_l
134 \mathop{\rm sin}_l\mathop{\rm sin}\limits_a\]

These are LaTeX commands that can define operators like sin or lim:

sin a sin a sin a sin l sin l sin a sin a
sin l sin l sin l sin l sin l sin l sin a
135 \[\sum_{\scriptstyle0\le i\le m\atop\scriptstyle0<j<n}P(i,j)\qquad
136 \sum_{\stackrel{0\le i\le m}{0<j<n}}P(i,j)\]

In the first expression given here, and in exercise 17.9 that follows, scripts use an explicit `script style´ command, hence should be typeset in scriptstyle size. This is not the case in the HTML version: we have an atop in an atop, and the style of the inner one is wrong. The second formula uses a LaTeX command, this is not the right command for stacking indices because the first argument uses a smaller style than the second. It seems to me that the top line of first formula, bottom line of the second formula have the right size. Other lines are too big (in Firefox) or much too small (in Amaya).

0im 0<j<n P(i,j), 0<j<n 0im P(i,j)

Exercise 17.8: i=1 p j=1 q k=1 r a ij b jk c ki .

Exercise 17.9: 1in 1jq 1kr a ij b jk c ki or 1in 1jq 1kr a ij b jk c ki .

137 \[\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+x}}}}}}}\]
138 \[ \left(\left[\left\lbrack a\left\{\left\lbrace\left\lfloor b
139 \left\lceil\left\langle\left/ c\left|\left\|\left\uparrow d
140 \left\downarrow\left\updownarrow\frac 12 \right\Updownarrow
141 \right\downarrow t
142 \right\Uparrow\right\Vert\right\vert x\right\backslash\right\rangle
143 \right\rceil y \right\rfloor\right\rbrace\right\} z\right\rbrack\right]\right)\]
abcd1 2txyz

We would expect all delimiters to be of the same size; but not all characters can be indefinitely extensible. On Firefox, we see a large slash, reverse slash and angle brackets; all other characters have maximum size. On Amaya, slash and reverse slash have a normal size, as well as double vertical bars; on AM some delimiters are replaced by a question sign, namely floor, ceiling, angle brackets, reverse slash and arrows (on following formulas, arrows are however visible). AF uses floor instead of ceiling and vice-versa. On FM the rendering of up-down-array is wrong.

There are problems with slash, backslash, double vertical bar on Tralics 2.9.4. Concerning the double vertical bar, the following expression contains two different characters: =. The first character is Unicode U+2016 (entity &Vert; in the file mmlalias.ent), obtained by \Vert in Tralics 2.9.4, accessible as \@Vert in following versions, it is not shwon by Amaya; the second character is Unicode U+2225 (entity &DoubleVerticalBar;, &parallel; and &shortparallel; in the file mmlalias.ent), obtained by \parallel in Tralics 2.9.4, and also by \Vert in following versions. We changed this because the first character has fixed size as the following demonstrates 1 2 (the effect is only visible in HTML with FM).

Translation of backslash changed: it is now Unicode U+2216, you can use the backslash character (Unicode U+5C) by saying \char`\^^5c. Example: old is X\Y, new is XY, note the different spacing.

Example of \bigl and \bigr, followed by the same code without these operations; currently there is no difference in the HTML version; in the Pdf there is more space in the equations on the LHS between closing brace and opening brace (same for bracket).

x - s ( x )y - s ( y )(x-s(x))(y-s(y))
x - s [ x ]y - s [ y ][x-s[x]][y-s[y]]
| x | - | y |||x|-|y||

Example of big

144 \[ \big(\big[\big\lbrack \big\{\big\lbrace\big\lfloor
145 \big\lceil\big\langle\big/ \big|\big\|\big\uparrow
146 \big\downarrow\big\updownarrow\frac 12 \big\Updownarrow
147 \big\downarrow \big\Uparrow\big\Vert\big\vert \big\backslash\big\rangle
148 \big\rceil\big\rfloor\big\rbrace\big\}\big\rbrack\big]\big)\]
/ | 1 2 |

I see the following: every up to the slash, and starting with the backslash is big; remaining items are small in the Pdf version, big in Firefox, sometimes small, sometimes large in Amaya.

149 \[ \big(\bigl[\Big\lbrack \Bigl\{\bigg\lbrace\biggl\lfloor
150 \Bigg\lceil\Biggl\langle /|\|\uparrow \downarrow\updownarrow\frac 12
151 \Updownarrow\downarrow\Uparrow\Vert\vert\backslash
152 \Biggr\rangle\Bigg\rceil\biggr\rfloor\bigg\rbrace\Bigr\}\Big\rbrack\bigr]\big)\]

A formula with all variants

/ | 1 2 |

Up to version 2.9.4, there was a bug in handling these big things. Currently, Tralics inserts \left and \right delimiters wherever possible. In the Pdf version, this formula is identical to the previous one. In firefox, operators between slash and backslash (that have no big) are small before the fraction, large after that. This is strange. In Amaya, everything between the slash and the backslash is small, except the \vert.

Exercise 17.10: 2 x 2 + 2 y 2 ϕ ( x + i y ) 2 =0.

153 Phi is $\phi,^^^^03c6$, ^^^^03c6  and varphi is $\varphi,^^^^03d5$, ^^^^03d5,

There is a problem in the rendering of the letter phi; the straight phi character is Unicode U+03D5. As the example given here shows, the rendering of phi and varphi in math mode, at least on my machine: Phi is φ,φ, φ and varphi is ϕ,ϕ, ϕ, epsilon is ϵ, varepsilon is ε. We changed the translation, so that the Firefox and Pdf versions show, in math mode, the desired result. Note that AM shows the same characeter for phoi ad varphi in math mode, and has trouble with epsilon(shown as a square).

154 $\bigl (x\in A(n)\bigm|x\in B(n)\bigr)$,
155 $\bigcup_n X_n\bigm\|\bigcap_n Y_n$,
156 $\displaystyle{ {a+1\over b}\bigg/{c+1\over d}}$

Other big x A ( n ) | x B ( n ) and n X n n Y n and a+1 b/c+1 d.

Exercise 17.12: x + f ( x )/x - f ( x ).

157 \[1+\left(\frac{1}{1-x^2}\right)^3,\qquad \pi(n)=\sum_{k=2}^n
158 \left\lfloor\frac{\phi(k)}{k-1}\right\rfloor, \qquad
159 \left|\left|x\right|-|\left|y\right|\right|, \qquad
160 \left(\sum_{k=1}^n A_k\right),\qquad  \biggl(\sum_{k=1}^n A_k\biggr)\]

Exercise 17.13: Comparison between \left and \bigl; translation is the same in Tralics.

1+1 1-x 2 3 ,π(n)= k=2 n φ(k) k-1,x-y, k=1 n A k , k=1 n A k .

Exercise 17.14: was wrong in Tralics 2.9.4.

π(n)= m=2 n k=1 m-1 ( m / k ) / m / k -1

TeX sets \nulldelimiterspace, unused by Tralics.

1 2=1 2=1 2=1 2

The \vcenter command is not implemented. Any box can be put into a formula by simply saying \hbox or \vbox or \vtop or \box or \copy; this is not implemented in Tralics, you can insert text in math mode via \text or \hbox.

Exercise 17.15: This shows the use of \mathchoice.

161 \def\puzzle{\mathchoice{D}{T}{S}{SS}}
162 \[\puzzle{\puzzle \over\puzzle^{\puzzle^\puzzle}} \qquad
163 \frac{\puzzle}{\puzzle^{\puzzle^\puzzle}} \]

Exercise 17.16: The \square command is built-in: .

The \mathpalette command is introduced in Tralics 2.9.5, not tested yet.

164 \def\legendre{\overwithdelims()}\def\Legendre{\genfrac(){}{}}
165 \def\euler{\atopwithdelims<>}\def\Euler{\genfrac<>{0pt}{}}
166 \def\grimm{\abovewithdelims][4pt}\def\Grimm{\genfrac][{4pt}{}}
167 \[{a\legendre b}, \Legendre{a}{b}, {n \euler k}, \Euler{n}{k},
168 {\dfrac ab \grimm \dfrac cd}\Grimm{x}{y} \]

Exercise 17.17: Knuth says: the size of the surrounding delimiters depends only on the size, not on the size of the fractions, this is false for Tralics:

a b,a b,n k,n k,a b c dx y

If f is the value of \delimiterfactor and δ the value of \delimitershortfall, and we have a formula that extents y 1 units above the axis, and y 2 units below, if y=2max(y 1 ,y 2 ), then the delimiter size is at least y·f/1000, and at least y-δ. This does not apply to Tralics.

The remainder of the chapter discusses some low-level commands that are not fully implemented in Tralics. The commands \textfont, \scriptfont and \scriptscriptfont take a small number as argument, and provide a reference to a font. The following code

169 \font\tenrm=somefont at 12pt
170 \font\Helvetica=someotherfont scaled 1013
171 \textfont0=\tenrm
172 \scriptscriptfont2=\scriptfont3
173 \the\fontdimen3\scriptscriptfont15
174 $\textfont0=\tenrm 9\hbox{$9\textfont0=\Helvetica$}$%
175 ${\textfont0=\Helvetica 9}$ % exercise 17.18

gives: 0.0pt999. The dimension should be zero, and the math formula contains three identical digits. Exercise 17.18 says that the fonts used by TeX in the last case is not Helvetica.

You cannot use more than 16 different math fonts in a formula. Assume that you need symbol A from font a; you can say that \textfont6 is your font a, and your symbol is character 137 in that font. What if you want symbol B from font b? you can use font number 7, but this is obviously not the solution. We explain here the amsmath strategy by telling what happens if you use \tt in a math formula. First of all, in a formula, this evaluates to \mathtt, and the real command is \@mathtt. This is a self-modifying command; after first use it is equivalent to \fam9 (this means that normal characters in text size use the \textfont9). The first use allocates the number 9, and defines the font, moreover the font information is remembered (the font \textfont9 will be defined for all subsequent math formulas). Note that the value of \textfont9 can be cmtt12, but this is recomputed if the current font size changes. For most other commands, the number is allocated when the font is declared, this means that a slot is allocated even when the font is never used.

Four slots are preallocated, with the names operators, letters, symbols and largesymbols. If you load packages amsmath, amscd, amssymb, and bm, four other slots are used, and there are only 8 slots remaining. In the case of this document, we test all 14 MathML fonts. How is this possible? In fact some characters are typeset outside math mode (sans-serif characters for instance) and in some cases poor-man-bold is used. Moreover, we had to remove some font families (these are commented out in the file raweb-uni.sty).

Exercise 17.19: Math code are not implemented in Tralics, \oplus is character U+2295 and \bullet is character U+2022.

176 \mathcode`<="2203 \mathcode`*="313C
177 \mathcode`a="8000 {\catcode`a=13 \gdef a{A}}
178 $a<b*c$
179 %\mathchardef\@M=10000

In TeX, the previous code is equivalent to A*b<c, in Tralics, it gives: A<b*c. Since version 2.9.10, a capital letter A is produced. The last line is commented out: the assignment is done at bootstrap. You should use \@M as the constant 10000, not as control-P in family 7 (binary operation).

Following code is unlikely to work

180 \def\sum\{\mathchar"1350}
181 \mathchardef\sum"1350
182 \def\n@space{\nulldelimiterspace\z@ \m@th}
183 \newdimen\p@ \p@=1pt
184 \def\bigl#{\mathopen{\hbox{$\left#1\vbox to8.5\p@{}\right.\n@space$}}}
185 \delcode `x="123456
186 \def\langle{\delimiter"426830A }
187 \bigl\delimiter"426830A
188 \def\sqrt{\radical"270370 }
189 \def\idehat{\mathaccent"362 }

2.3. Fine points of Mathematics Typing, TB 18

2.3.1. Punctuation

Say: If x<0, we have shown that


Do not say: for x=a,b, or c, but: for x=a, b, c, or use a tie: or c.

Exercise 18.1: R(n,t)=O(t n/2 ), as t0 + . Adding braces improves the Html version: R(n,t)=O(t n/2 ).

2.3.2. Non-italics letters in formulas

TeX has 32 predefined operators, some of them behave like sums according to the placement of limits.

arccos x +arcsin x +arctan x +arg x +cos x +cosh x +cot x +coth x +csc x +deg x
det x +dim x +exp x +gcd x +hom x +inf x +ker x +lg x +lim x +lim inf x
lim sup x +ln x +log x +max x +min x +Pr x +sec x +sin x +sinh x +sup x
tan x +tanh x +inj lim x +proj lim x

The last two operators are defined by amsmath. Variants shown later. More formulas (there should be small space around these operators, that is invisibile on my browser).

sin2θ=2sinθcosθO(nlognloglogn)Pr(X>x)=exp(-x/μ)max 1nm log 2 P n lim x0 sinx x=1

Exercise 18.2:

p 1 (n)=lim m ν=0 1 - cos 2m (ν! n π/n)

Example of formulas using \rm: Var (X), x max -x min , LL (k) LR (k), exp(x+ constant ), and x 3 + lower order terms .

Some formulas using \hbox for roman font: Var(X), LL(k)LR(k), exp(x+constant), and x 3 +lowerorderterms.

The same formulas using \text for roman font: Var(X), LL(k)LR(k), exp(x+constant), and x 3 +lowerorderterms.

190 \def\Varliminf{\mathop{\underline{\mathmo{lim}}}}
191 \def\Varlimsup{\mathop{\overline{\mathmo{lim}}}}
192 \[\lim_{n\to\infty}x_n\text{ exists}\iff
193 \Varlimsup_{n\to\infty}x_n=\Varliminf_{n\to\infty}x_n.\]

Exercise 18.3:

lim n x n existslim sup n x n =lim inf n x n .
lim n x n existslim ¯ n x n =lim ̲ n x n .

The code above is wrong, because `lim´ is a known operator, with movable limits, hence, in non-display mode, both the underline and the real subscript will move. The real definitions adds movablelimits = `false´ to the operator.

194 $\gcd(m,n)=\gcd(n,m\bmod n)$, or $x\equiv y+1\pmod{m^2}$
195 $x\equiv0(\pmod y^n)$.

Modulo: gcd(m,n)=gcd(n,mmodn), or xy+1(modm 2 )

Exercise 18.4: B.L. User got the unexpected formula x0((mody) n ).

Exercise 18.5: In this example, there are braces around n/p, but not k/p; this can affect the size of the slash operator (HTML version only).

n kn/p k/pnmodp kmodp(modp)

Example of bold face a+b=Φ m ; normal Phi is U+03A6, bold Phi is U+1D6BD, italic Phi is U+1D6F7, bold italic Phi is U+1D731, sans serif bold Phi is U+1D76B, sans serif bold italic Phi is U+1D7A5. In the current version of Tralics, font changes apply only to ASCII letters. Commands like \cal are robust, so that $\cal Ab\Phi$ produces AbΦ; command \mit is not implemented. Note that in some cases, digits and lower case letters do not exist in the font, and may be replaced by random glyphs.

Exercise 18.6: If you want x ¯ T Mx=0x=0 in Tralics 2.9.4, you have to explicitly say that you want a bold face zero, and an upright T, see below. In version 2.9.5, nothing special needed. Note how we use colon-equal here.

196 $\bf\bar x^{\mathmo{T}}Mx={\rm0}\iff x=\mathmn[mathvariant][bold]{0}$
197 Compare $This\ is\ math\ italics$ with {\it This is text italics}.
198 Compare $different$ and $\it different$. We have also
199 $\it last\mathmo{:=}first$, $\it x\_coord(point\_2)$

Compare Thisismathitalics with This is text italics. Compare different and different. We have also last:=first, x_coord(point_2).

Exercise 18.8: We use \mathit instead of \it here.

available+ i=1 n max(full(i),reserved(i))=capacity

Exercise 18.9: The following code was obtaining by taking the answer from the TeXbook, with the following modifications: the \sfcode of the semi colon not changed; math formulas put outside scope of \bf, because my browser shows letters (not digits) in bold face otherwise. Note that the XML to HTML processor converted the whole environment (seven paragraphs) into a single paragraph with <br> as separator (inter-paragraph width too big), and a huge left margin (for fun). We show here the start of the code:

200 \begin{xmlelement+}{pseudocode}\XMLaddatt{leftskip}{5cm}
201 \obeylines
202 \def\coleq{\mathmo{:=}}
203 \textbf{for} $j\coleq 2$ \textbf{step} $1$ \textbf{until} $n$ \textbf{do}
204 ...
205 \end{xmlelement+}

for j:=2 step 1 until n do
   begin accum:=A[j]; k:=j-1; A[0]:=accum;
   while A[k]>accum do
      begin A[k+1]:=A[k]; k:=k-1;

2.3.3. Spacing between formulas


F n =F n-1 +F n-2 ,n2.

with (lot of white space in the formula)

F n =F n-1 +F n-2 ,n2.

and (no unnecessary white space in the formula)

F n =F n-1 +F n-2 ,n2.

Normally, the spacing should be the same in the last two formulas. In fact, Knuth says that \quad is the same as \hskip 1em\relax. The translation of a \quad in math mode is <mspace width="1.em">, but the \hskip command reads a dimension, and converts one em into ten points(note: ).

Exercise 18.10: Three versions:

Let H be a Hilbert space, C a closed bounded convex subset of H, T a non-expansive self map of C. Suppose that as n, a n,k 0 for each k, and γ n = k=0 (a n,k+1 -a n,k ) + 0. Then for each x in C, A n x= k=0 a n,k T k x converges weakly to a fixed point of T.

Let H be a Hilbert space,  C a closed bounded convex subset of H,  T a non-expansive self map of C. Suppose that as n,  a n,k 0 for each k, and γ n = k=0 (a n,k+1 -a n,k ) + 0. Then for each x in C,  A n x= k=0 a n,k T k x converges weakly to a fixed point of T.

Let C be a closed, bounded, convex subset of a Hilbert space H, and let T be a non-expansive self map of C. Suppose that as n, we have a n,k 0 for each k, and γ n = k=0 (a n,k+1 -a n,k ) + 0. Then for each x in C, the infinite sum A n x= k=0 a n,k T k x converges weakly to a fixed point of T.

Comments: the translation of the three characters: space, backslash, space is formed of two spaces. Such a construct is used four times in the first version. This produces a nice dvi file, but HTML interprets the double space the same as a single space. In the second version, we have used a double tilde character. This inhibits line breaks. (My browser does not seem to honor this). No special characters appear in the last example.

2.3.4. Spacing within formulas

206 $a\,b\>c\;d\!e\quad f\qquad g\ h$~j
207 %\the\thinmuskip\the\medmuskip\the\thickmuskip

The math spacing commands: abcdefghj. In TeX, the value of the glue inserted depends on three registers: \thinmuskip (3mu), \medmuskip (4mu plus 2mu minus 4mu) and \thickmuskip (5mu plus 5mu). You can try to execute the line above that is commented out: all dimensions come out as 0mu in Tralics, but the math formula contains 0.166667em, 0.222222em, 0.277778em, etc, this is the same as 3mu, 4mu and 5mu, because 1em=18mu. In Tralics, \mskip 18mu is equivalent to \hskip1em, and, as said above, this is the same as \hskip10pt. The same is true for \mkern18mu; the translation is an empty <mspace> element, with attribute value = `10.0pt´. The amount of space given by backslash-space changed from 6pt to 4pt (this is the same amount of space used by the \text command).

208 $\int_0^\infty f(x)\,dx$, $y\,dx-x\,dy$, $dx\,dy=r\,dr\,d\theta$, $x\,dy/dx$

Translation 0 f(x)dx, ydx-xdy, dxdy=rdrdθ, xdy/dx.

Exercise 18.11:

1 x dt t 0 t-ib t 2 +b 2 e iat dt=e ab E 1 (ab),a,b>0
209 $55\,\mathrm{mi/hr}$, $g=9.8\,\mathrm{m/sec}^2$,
210 $1\mathrm{ml}=1.000028\,\mathrm{cc}$

Units: 55 mi / hr , g=9.8m/ sec 2 , 1 ml =1.000028 cc . Note that digits are outside the scope of \mathrm.

Exercise 18.12: Inline math, displaystyle: =1.054×10 -27 erg sec .

211 $(2n)!/\bigl(n!\,(n+1)!\bigr)$, $\sqrt2\,x$,
212 $\sqrt{\,\log x}$, $O\bigl(1/\sqrt n\,\bigr)$,
213 $[\,0,1)$, $\log n\,(\log\log n)^2$, $x^2\!/2$, $n/\!\log n$,
214 $\Gamma_{\!2}+\Delta^{\!2}$, $R_i{}^j{}_{\!kl}$, $\int_0^x\!\int_0^y dF(u,v)$
215  \[\frac{52!}{13!\,13!\,26!}\qquad \int\!\!\!\int_D dx\,dy\]

Test: (2n)!/n ! ( n + 1 ) !, 2x, logx, O1 / n , [0,1), logn(loglogn) 2 , x 2 /2, n/logn, Γ 2 +Δ 2 , R i j kl , 0 x 0 y dF(u,v)

52! 13!13!26! D dxdy

Same formulas, without thin spaces

Test: (2n)!/n ! ( n + 1 ) !, 2x, logx, O1 / n, [0,1), logn(loglogn) 2 , x 2 /2, n/logn, Γ 2 +Δ 2 , R i j kl , 0 x 0 y dF(u,v)

52! 13!13!26! D dxdy

Amaya shows a strange behavior here. Without the space the first integral is larger than the second. In thee case of negative space, the absolute value is used.

Exercise 18.14: intervals with left/right: -,T×-,T; with mathopen, mathclose ]-,T[×]-,T[; with nothing ]-,T[×]-,T[. And with left/right: -,3 4×-,3 4; with mathopen, mathclose ]-,3 4[×]-,3 4[; with nothing ]-,3 4[×]-,3 4[.

Exercise 18.15: The spacing in x++1 differs between TeX and MathML.

2.3.5. Ellipses

216 $x_1+\cdots+x_n$, $x_1=\cdots=x_n=0$, $A_1\times\cdots\times A_n$,
217 $f(x_1,\ldots,x_n)$, $x_1x_2\ldots x_n$, $(1-x)(1-x^2)\ldots(1-x^n)$,
218 $n(n-1)\ldots(1)$.

Translation of these formulas x 1 ++x n , x 1 ==x n =0, A 1 ××A n , f(x 1 ,...,x n ), x 1 x 2 ...x n , (1-x)(1-x 2 )...(1-x n ), n(n-1)...(1).

Exercise 18.16: Answer x 1 +x 1 x 2 ++x 1 x 2 ...x n , (x 1 ,...,x n )·(y 1 ,...,y n )=x 1 y 1 ++x n y n . Prove that (1-x) -1 =1+x+x 2 +. Clearly a i <b i , for i=1, 2, ...n. The coefficients c 0 c 1 , ..., c n are positive. With braces surrounding the LHS: (1-x) -1 =1+x+x 2 +.

Exercise 18.17: Clearly a i <b i , for i=1,2,...,n. Note that the `2´ here is a math digit, while it is text digit in the sentence above.

Exercise 18.18: Knuth used \dots.

2.3.6. Line breaking

The TeX book explains how TeX can break a math formula. This does not apply to Tralics. Commands \nobreak and \allowbreak do nothing in math mode.

2.3.7. Braces

You should use braces only for grouping. You can use a brace character via \{ in text or math mode. This character is a delimiter (it can be preceded by \left or \big).

219 $\{a,b,c\}$, $\{1,2,\ldots,n\}$, $\{\mathrm{red,white,blue}\}$
220 $\{\,x\mid x>5\,\}$, $\{\,x:x>5\,\}$,
221 $\bigl\{\,\bigl(x,f(x)\bigr)\bigm|x\in D\,\big\}$
222 $\bigl\{\,\bigl(x,f(x)\bigr)\bigm\mid x \in D\,\big\}$
223 $\bigl\{\,\bigl(x,f(x)\bigr)\mid x\in D\,\big\}$

Translation {a,b,c}, {1,2,...,n}, { red , white , blue }, {xx>5}, {x:x>5}, x , f ( x ) | x D x , f ( x ) |xD. Note that \mid gives better spacing than a single bar x , f ( x ) x D , x , f ( x ) x D .

Exercise 18.21: x 3 h (x) {-1,0,+1}

Exercise 18.22: {pp and p+2 are prime}.

We show here the use of the cases enviroment, this is a two-column cmatrix, with a left brace delimiter on the left.


Exercise 18.23: The \cases command is not implemented, but there is a environment. You cannot use \noalign. After a double backslash you can put a dimension in brackets, but this is currently ignored.

224 \[\overbrace{x+\cdots+x}^{k\; \textrm{times}} \qquad \underbrace{x+y+z}_{>\,0}\]

We show here braces can stretch horizontally, when used as over-accent or under-accent.

x++x k times x+y+z >0

2.3.8. Matrices

The plain TeX command \matrix should not be used. The `array´ environment can be used in math mode, and you must specify for each column the alignment method. The `matrix´ environment can be used, cells are centered. He we use `pmatrix´, because it adds automatically parentheses.

225 \[A=\begin{pmatrix}x-\lambda&1&0\\0&x-\lambda&1\\0&0&x-\lambda\end{pmatrix}\]
226 \[\begin{pmatrix}a&b&c\\d&e&f\end{pmatrix}
227 \begin{pmatrix}u&x\\v&y\\w&z\end{pmatrix}\]

Exercise 18.24: This looks bad in the HTML version, but it OK is Pdf. Delimiters are \lgroup and \rgroup.


Exercise 18.25:

A=a 11 a 12 ...a 1n a 21 a 22 ...a 2n a m1 a m2 ...a mn y 1 y k

Border matrix(note: )

Small matrices 11 00 and a l b m c n. Note that horizontal alignment is only approximative.

2.3.9. Vertical Spacing

228 \def\Limsup{\mathop{\smash\limsup\vphantom\liminf}}
229 $\Limsup\limits_3=\limsup\limits_3$

Compare: lim suplim inf 3 =lim sup 3 ! The second index should be lower than the first.

Commands \raise and \lower not yet implemented. Commands \llap and \rlap not yet implemented.(note: )

230 \def\undertext#1{$\underline{\hbox{#1}}$}
231 \undertext{This} \undertext{does} \undertext{not} \undertext{always}
232 \undertext{work} \undertext{right}.
233 \def\undertext#1{$\underline{\smash{\hbox{#1}}}$}
234 \undertext{This} \undertext{does} \undertext{not} \undertext{always}
235 \undertext{work} \undertext{right}.

Exercise 18.26: A sentence where each word is an underlined math formula (text only): This ̲ does ̲ not ̲ always ̲ work ̲ right ̲. The same, where the \smash is used to hide the depth of the text (all lines vertically aligned): This ̲ does ̲ not ̲ always ̲ work ̲ right ̲.

236 $\rm Fe_2^{+2}Cr_2^{\vphantom{+2}}O_4^{\vphantom{+2}}$

Use of phantoms: Fe 2 +2 Cr 2 +2 O 4 +2

2.3.10. Special features for math hackers

Commands \nonscript, \everymath and \everydisplay are OK.

237 {\everydisplay{a}\everymath{b} \def\X{x\nonscript\qquad y}
238 \[u = \text{ v $w$ }\frac{\X}{\textstyle\X} \]}
au=vbwxy xy

2.3.11. Summary

Exercise 18.27: n th from the TeXbook, n th is LaTeX, and nth is textsuperscript.

Exercise 18.28: S -1 TS=dg(ω 1 ,...,ω n )Λ, uses \mathnormal, no bf lambda?

Exercise 18.29: Pr(m=nm+n=3).

Exercise 18.30: sin18 =1 4(5-1).

Exercise 18.31: k=1.38×10 -16 erg / K.

Exercise 18.32: Φ ¯NL 1 * /N=L ¯ 1 * NL n * /N=L ¯ n * .

Exercise 18.33: I(λ)= D g(x,y)e iλh(x,y) dxdy.

Exercise 18.34: 0 1 0 1 f(x 1 ,...,x n )dx 1 ...dx n . Note: Firefox shows small integral signs, and larger ones in the previous exercise.

Exercise 18.35: Using cases environment

x 2m Q(X m 2 -P 2 W m 2 )-2S 2 (modd)P 2 2 (X m 2 -P 2 W m 2 )-2S 2 (meven)(modN).

Exercise 18.36: with a \frac

(1+x 1 z+x 1 2 z+)...(1+x n z+x n 2 z 2 +)=1 (1-x 1 z)...(1-x n z)

Exercise 18.37:

j0 k0 a jk z k = n0 z n k 0 ,k 1 ,...0 k 0 +k 1 +=n a 0k 0 a 1k 1 ... .

Exercise 18.38: Using \frac and \binom

(n 1 +n 2 ++n m )! n 1 !n 2 !...n m !=n 1 +n 2 n 2 n 1 +n 2 +n 3 n 3 ...n 1 +n 2 ++n m n m .

Exercise 18.39: Using \genfrac

Π R a 1 ,a 2 ,...,a M b 1 ,b 2 ,...,b M = n=0 R (1-q a 1 +n )(1-q a 2 +n )...(1-q a M +n ) (1-q b 1 +n )(1-q b 2 +n )...(1-q b N +n ).

Exercise 18.40:

p prime f(p)= t>1 f(t)dπ(t).
239 \def\X{\char`'}
240 \[{
241 \{\underbrace{\overbrace{\mathstrut a,\ldots,a}^{k\;a\X\mathrm{s}},
242   \overbrace{\mathstrut
243     b,\ldots,b}^{l\;b\X\mathrm{s}}}_{k+l\;\mathrm{elements}}\}
244 }\quad\text{vs}\qquad {
245 {\{\,}\underbrace{\overbrace{\mathstrut a,\ldots,a}^{k\;a'\mathrm{s}},
246   \overbrace{\mathstrut
247     b,\ldots,b}^{l\;b'\mathrm{s}}}_{k+l\;\mathrm{elements}}{\}\,}.}\]

Exercise 18.41: In this formula, we want the denote the plural of the token a by as apostrophe followed by the letter s. The first attempt is not good. The second is a bit better, because it is a-prime followed by s. The first expression is formed of open brace, underbraced formula, closing brace; and this produces large braces in the HTML version; small braces are obtaing by replacing the first token by a list, containing the brace and little bit space.

{(a,...,a ka's ,(b,...,b lb's k+l elements }vs{(a,...,a ka ' s ,(b,...,b lb ' s k+l elements }.

Exercise 18.42:


A non trivial question: what is the distance X between two lines in a matrix like these? or said otherwise, what is the vertical glue Y added between two lines? Let x be the value of \baselineskip, y the value of \lineskiplimit and z the value of \lineskip. Then, the quantity y is computed so that X=x, unless this gives Y<y, case where z is used instead. Typically, for a normal paragraph, x=12, y=0, z=1, and for a `align´ environment, we have x=15, y=3, z=4. In the case of an array, all three values are zero. This means: normal baseline in a paragraph is 12pt, but there is at least one pt between two lines, and in the case of multiline equations, the baseline is larger, as well as the clearance. In the case of an array, no extra space is added. However, a strut is added to each line, this is an invisible rule; as a consequence, the total height plus depth of each line is the matrix is at least 12pt, hence X is at least 12pt.

This has as consequence that, in the big matrix above, parentheses do touch. We changed, in the file raweb-cfg.sty, the code of the \@array command: z=5, and y is 3 or 5, depending on whether the `displaystyle´ attribute array of the array is true (if the attribute is true, then all entries are typeset in \display mode; this is the case for all environments like `gather´ or `align´ that are translated by Tralics as an array).

Exercise 18.43: Note: entries are left aligned because of explicit \hfil.

detc 0 c 1 c 2 ...c n c 1 c 2 c 3 ...c n+1 c 2 c 3 c 4 ...c n+2 c n c n+1 c n+2 ...c 2n

Exercise 18.44:

' xA f(x)= def xA x0 f(x).

Exercise 18.45: This is not so nice

2k2 2 2 · · · 2 1 2k

Exercise 18.46: Vertical arrow centered via the use of phantom on the left; command \hidewidth not used (the purpose of the command is to make \halign believe that the cell has a very small width; this will produce an overfull box, but who cares: there is enough white space at both ends).

00 O k ι E ρ L 0φφψψ0 O C π * O D δ R 1 f * O V (-D) 0θ i γ -1 θ i γ -1 R 1 f * O V (-iM)γ -1 0

2.4. Displayed Equations, TB19

2.4.1. One-line displays

Example of a display, containing only text


Another one, with text and math

X n =X k ifandonlyifY n =Y k andZ n =Z k .

Compare the following two examples: the translation is the same, but you cannot put arbitrary text in a math formula!

248 $$Y_n=X_n\bmod p \quad\hbox{and}\quad Z_n=X_n\bmod q \qquad\hbox{for all }n\ge 0.$$
249 $$Y_n=X_n\bmod p \quad\hbox{and}\quad Z_n=X_n\bmod q\qquad\hbox{for all $n\ge0$}.$$
Y n =X n modpandZ n =X n modqforalln0.
Y n =X n modpandZ n =X n modqforalln0.

Exercise 19.1: The exercise contains four formulas; for the first three ones, we give a LaTeX variant. For the first formula, the delimiters hace different sizes.

250 $$\sum_{n=0}^\infty a_nz^n\qquad \hbox{converges if}\qquad |z| <
251 \Bigl(\limsup_{n\to\infty}\root n\!\of{|a_n|}\,\Bigr)^{-1}.$$
252 \[\sum_{n=0}^\infty a_nz^n\qquad \text{converges if} \qquad |z| <
253 (\limsup_{n\to\infty}\sqrt[n\!]{|a_n|}{\,)}^{-1}. \]
254 \[\sum_{n=0}^\infty a_nz^n\qquad \text{converges if} \qquad |z| <
255 (\limsup_{n\to\infty}\sqrt[n\!]{|a_n|}\,)^{-1}. \]
n=0 a n z n convergesif|z|<lim sup n |a n | n -1 .
n=0 a n z n convergesif|z|<(lim sup n |a n | n) -1 .
n=0 a n z n convergesif|z|<(lim sup n |a n | n) -1 .

Next two formulas.

256 $${f(x+\Delta x)-f(x)\over\Delta x}\to f'(x)\qquad \hbox{as $\Delta\to0$.}$$
257 \[\frac{f(x+\Delta x)-f(x)}{\Delta x}\to f'(x)\qquad \text{as }\Delta\to0.\]
258 $$\|u_i\|=1,\qquad u_i\cdot u_j=0\quad\hbox{if $i\ne j$.}$$
259 \[\|u_i\|=1,\qquad u_i\cdot u_j=0\quad\text{if } i\ne j.\]
f(x+Δx)-f(x) Δxf ' (x)asΔ0.
f(x+Δx)-f(x) Δxf ' (x)asΔ0.
u i =1,u i ·u j =0ifij.
u i =1,u i ·u j =0ifij.

Last formula; you cannot use the \matrix command defined by plain TeX, but you have to use the matrix environment.

260 \[\it\text{The confluent image of}\quad
261 \begin{Bmatrix}\text{an arc}\hfill\\\text{a circle}\hfill\\\text{a fan}\hfill
262 \end{Bmatrix}
263 \quad\text{is}\quad
264 \begin{Bmatrix}\text{an arc}\hfill\\\text{an arc or a circle}\hfill\\
265 \text{a fan or an arc}\hfill\end{Bmatrix}.\]

Since version 2.9.5, you can use font changes in \text commands and friends (the previous formula is in italics). This is a more elaborate example

266 $\hbox{upright} \it \text{Italic\bf Boldface} {\tt \text{x = y$^2$}}$

Translation: uprightItalicBoldfacex=y 2 .

Exercise 19.2: Compare B. L. User´s solution, Knuth´s solutions and \tfrac:

y=1 2xvsy=1 2xvs1 2x

Exercise 19.3: We demonstrate in this example that using $$\hbox{$formula$}$$ is non-trivial.

267 \everymath={A}
268 \everyhbox={B}
269 \def\X{\ifhmode H\else \ifvmode V \else \ifmmode M \else U\fi\fi\fi}
270 \def\Y{\X\ensuremath{\beta}}
271 $$ \Y\hbox{\X$\Y $\X}\Y \text{\X}$$

Guess what happens if \X were replaced by \Y? the problem might be solved in a future version. Note that \text does not insert the every-hbox token list.

Exercise 19.4: Look at these four identical formulas.

1-1 2+1 3-1 4+=ln2
1-1 2+1 3-1 4+=ln2(14)
1-1 2+1 3-1 4+=ln2(14)
1-1 2+1 3-1 4+=ln2

In TeX, equations are centered, and an equation number is added to the left or the right. In the HTML version, an equation-with-number is a 3-column table, columns 1 and 3 are of width 4em (this is defined in the CSS file), one of them contains the equation number. If the equation number is big, the width of the column might be larger than 4em, columns 1 and 3 could have different widths, so that column 2 is not centered. Otherwise it is centered, and the equation is centered in column 2 (is there a way to do this better?)

Normally, there should be a way to put the equation at some position (say 3cm from the left margin). This is done in LaTeX via a package option (can we easily modify LaTeX so that each equation can be centered or not?). In this examples, first two formulas should be centered, other ones should flushed left. Equations two and three have a number.

Note on Equation Numbering For a very long time, I have used the \eqno command without any difficulty; of course, you have to be very careful if you introduce an equation between equations (11) and (12), you have to change every reference for any equation starting with 12. A big advantage of LaTeX is its automatic numbering scheme; more precisely if you flag an equation with \label{eq+12}, you can get its number via \ref{eq+12} (the only difficulty then is to find mnemonic tag names). In a first pass, LaTeX computes the value of the label, and stores it in a file, in a second pass, it reads the file, and uses this number. No number is computed by Tralics, in some cases, this can be annoying. A side effect of the translation of the \label command is the addition of an id (for instance `id12´ to the equation(note: )), and translation of the \ref is a <ref> element with a reference to the id.

Equation numbers are computed by the XML-to-whathever processor. In fact, in the case of conversion from XML to HTML, the style sheet computes the equation number twice: once when the equation is converted, and once when the <ref> is converted. In the case of XML to XSL/FO, a number is computed only for <ref>, the equation number is added to the equation by LaTeX, when the XSL/FO is converted to Pdf (this is not really important, because nobody looks at the FO file).

Assume that you have hundreds of equations, and you want to refer the previous one; very often it is tagged `(*)´, in some cases `(**)´. Some people use `(***)´. Exercise 19.7 that follows says that, in math mode, these come out as (*), in some cases (**) and (***). In particular, a non-trivial question is: should equation numbers by typeset as math or as text? In Tralics, we implemented \eqno and \tag; that´s a bit tricky, let´s explain some difficulties.

Summary: There are three ways to obtain an equation number. First, if an equation has a label, an equation number will be assigned to it automatically, when converting from XML to HTML, or whatever. The second method consists in using the amsmath command \tag, described below. Finally, you can use the TeX command \eqno. This command reads everything up to the end of the formula, expanding tokens when needed; if this yields foo, then \y@tag{foo} is evaluated again; this the same as if you said \tag*{foo}. Its effect by default is to convert the tag as an attribute to the formula. Moreover, the attribute eqnpos is added to the formula, with a value of left and right, depending on whether \leqno or \eqno has been used. The equals signs should be aligned for the five next formulas.

x 2 -y 2 =(x+y)(x-y).(15R)
(15L)x 2 -y 2 =(x+y)(x-y).

Equation number of (7) is on the left, of (8) on the right, and (9) depends on the class option.

(7)x 2 -y 2 =(x+y)(x-y).
x 2 -y 2 =(x+y)(x-y).(8)
x 2 -y 2 =(x+y)(x-y).(9)

Exercise 19.5:

k0 1 1-q k z= n0 z n / 1kn (1-q k ).(16´)

Exercise 19.6: In TeX, you can put an en-dash in an equation number by using \hbox. This is not allowed in Tralics: the equation 1=1 below gives an error. On the other hand, any character can be put in an equation number; the case of an apostrophe is a bit special: it is not converted to an exponent, but replaced by \apostrophe.

The example below illustrates one complexity. The end of the tag (via \eqno) is the end of the formula. In order to get the end of the formula, all tokens have to be expanded. The question is what to do with \char: remember that this command reads and typesets a character. In this case it cannot typeset a character; assume that we delay its interpretation. In this case, the command that follows the backquote will be expanded (this is wrong: we do not want to put an acute accent somewhere). Hence, the \char command reads a character, and pushes back a character token, with the same value, but category code 12. We explained above that \mathchar is not implemented. This means that there is one and only one active math character: the apostrophe, it produces a prime exponent even when it has category code 12. This is not desired: a tag should consist in characters only. This explains why something special is done. You can define the \apostrophe command as you like (the default value is character U+B4, but you can use an apostrophe, case where an exponent will be created when the token list is read again; formula 2=2 gives a double superscript error, guess why). Note how we insert an en-dash (of course \textendash is a non-math command, we had to modify some files in order to allow this character in the Pdf).

272 \[1=1\eqno\hbox{(3--1)} \]
273 \[0=0\eqno(*,{**},{***},16'\char`\'\char`\^,3^^^^20131)\]
274 \[\def\apostrophe{'} 2=2\eqno(16'\char`\')\]
275 \[\def\apostrophe{'} 3=3\eqno(16')\]

Exercise 19.7: It is possible to insert the equation number in the formula. What you can see here is that the spacing for two and three stars is the same: Knuth says that TeX converts binary star to type Ord, in the case of three stars, the middle one is of type Ord.

3=3(16 ' )

Exercise 19.8: Knuth says: if \hsize is less than 10000pt, then the natural width of the equation will be too large. Tralics ignores the shrink part of the glue. In the case of the HTML document, the text will flush in the right margin (and the equation number will be far away). We have replaced 10000 by 600, this should be big enough to see something.

276 \[\quad x=y\hskip10000pt minus 1fill\eqno(5)\]

2.4.2. Multi-line displays

Exercise 19.9: The \eqalign feature of plain TeX is not implemented; you can use the align environment like here:

T(n)T(2 lgn )c(3 lgn )-c(2 lgn )<3c·3 lgn =3cn lg3 .

Using aligned, you can get

α=f(z)β=f(z 2 )γ=f(z 3 )x=α 2 -βy=2γ

Exercise 19.10:

P(x)=a 0 +a 1 x+a 2 x 2 ++a n x n ,P(-x)=a 0 -a 1 x+a 2 x 2 ++(-1) n a n x n .(10)

Currently, the following code does not work.

277 \begin{eqalignno}
278 (x+y)(x-y)&=x^2-xy+yx-y^2\\
279 &=x^2-y^2;&(4)\\
280 (x+y)^2&=x^2+2xy+y^2 ;
281 \end{eqalignno}
282 \begin{leqalignno}
283 (x+y)(x-y)&=x^2-xy+yx-y^2\\
284 &=x^2-y^2;&(4)\\
285 (x+y)^2&=x^2+2xy+y^2 .
286 \end{leqalignno}

The best we can do is using phantoms:

287 \def\xcenter#1#2#3{\phantom{#3}{#1#2#3}\phantom{#1}}
288 \[\xcenter{(x+y)(x-y)}{=}{x^2-xy+yx-y^2} \]
289 \[\xcenter{{}}{=}{x^2-y^2;}\label{192-0}\]
290 \[\xcenter{{(x+y)^2}}{=}{x^2+2xy+y^2 .}\label{192-5}\]
x 2 -xy+yx-y 2 (x+y)(x-y)=x 2 -xy+yx-y 2 (x+y)(x-y)
x 2 -y 2 ;=x 2 -y 2 ;(11)
x 2 +2xy+y 2 .(x+y) 2 =x 2 +2xy+y 2 .(x+y) 2 (12)

Exercise 19.12: First two equations use \leqno, Equations (13) and (14) have a label.


Exercise 19.13: Note: Knuth has a small space before the first dx, this seems unnecessary. Some operators are big by default in MathML, so that no \big is required. However, there is a rule in Tralics that says that small parentheses are used in f(x)dx, even when the integral has limits. In this cases, this mechanism produces small parentheses. The remedy is to put f(x) in a group; the size of the parentheses depend only on what is in the group. In a case like (x 2 +y 2 ), large parentheses are used. If you want small ones, you must use the \smash command, and you get (x 2 +y 2 ). In the pdf version, the vertical bar is too small.

291 \[\xcenter{\left(\int_{-\infty}^{\infty}e^{-x^2}dx\right)^2}{=}
292 {\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}e^{-(\smash{x^2+y^2})}dx\,dy}\]
293 \[\xcenter{}{=}{\int_0^{2\pi}\int_0^\infty e^{-r^2}r\,dr\,d\theta}\]
294 \[\xcenter{}{=}{\int_0^{2\pi}{\left(-\frac{e^{-r^2}}{2}|
295         _{r=0}^{r=\infty}\right)}\,d\theta}\]
296 \[\xcenter{}{=}{\pi.}\label{e19.13}\]
- - e -(x 2 +y 2 ) dxdy - e -x 2 dx 2 = - - e -(x 2 +y 2 ) dxdy - e -x 2 dx 2
0 2π 0 e -r 2 rdrdθ= 0 2π 0 e -r 2 rdrdθ
0 2π -e -r 2 2| r=0 r= dθ= 0 2π -e -r 2 2| r=0 r= dθ

Exercise 19.14: Knuth explains that eqalign and eqalignno environments are based on \halign, so that \noalign can be used. In environments like gather, you can try \multicolumn. As you can see here, the word `and´ occurs at the left of the table, not at the left margin; this is the same as what happens with \eqalign.

x=y+zandx 2 =y 2 z 2

Exercise 19.16: This uses \gather. There are no equation numbers, because \hfil, \hfill or \hfilneg are not allowed.


2.4.3. Long formulas

The long formula is

σ(2 34 -1,2 35 ,1)=-3+(2 34 -1)/2 35 +2 35 /(2 34 -1)+7/2 35 (2 34 -1)-σ(2 35 ,2 34 -1,1).

It can be split as

σ(2 34 -1,2 35 ,1)=-3+(2 34 -1)/2 35 +2 35 /(2 34 -1)+7/2 35 (2 34 -1)-σ(2 35 ,2 34 -1,1).

Exercise 19.17:

x n u 1 ++x n+t-1 u t =x n u 1 +(ax n +c)u 2 ++(a t-1 x n +c(a t-2 ++1))u t =(u 1 +au 2 ++a t-1 u t )x n +h(u 1 ,...,u t ).(16)

Attempt to use multline for the long formula.

σ(2 34 -1,2 35 ,1)=-3+(2 34 -1)/2 35 +2 35 /(2 34 -1)+7/2 35 (2 34 -1)-σ(2 35 ,2 34 -1,1).

Exercise 19.18:

1jn 1 (x j -x 1 )...(x j -x j-1 )(x-x j )(x j -x j+1 )...(x j -x n )=1 (x-x 1 )...(x-x n ).(17)

Exercise 19.19: This is a silly expression. It is formed of A and B over C. We show here the code of A, B and C, using the shorthands of Knuth. We redefine locally the \\ command. The \Paren command puts parentheses around the argument., the \Slash command produces a slash.

297 {
298 \def\\#1;{\noexpand\Paren{#1;q^2}_\infty}
299 \xdef\formA{q^{\frac 12 n(n+1)}\\ea;\\eq\noexpand\Slash a;}
300 \xdef\formB{\\caq\noexpand\Slash e;\\cq^2\!\noexpand\Slash ae;}
301 \xdef\formC{(e;q)_\infty(cq/e;q)_\infty}
302 }

The question is: What is the size of the parentheses? In the case of f(x)dx some browsers show parentheses whose size are the same as that of the current group; if nothing special is done, it includes the integral sign and the bounds, this is wrong. For this reason, Tralics inserts some braces for opening and closing delimiters. If a group is created for the parenthesis, it contains no big objects (e.g., something with exponents). If possible, opening and closing parentheses are part of the same group. The algorithm is not obvious: consider what should be done if x or f(x) is replaced by its square. The following exercise is interesting. Note: in the Pdf version, all formulas look the same, this is because parentheses have fixed size. See also discussion after exercise 16.2: there are no multiple scripts here.

We give here four variants. In case one, there is no group, and the size of the parentheses is given by the exponent of the q. Hence they are too big. Tralics tries to compensate, but this does not work well, because of the index attached to parenthesis; there are two parts (ea; and q 2 ) . In the second case, we have added an empty group. In this case, we have a group with (ea; followed by q 2 followed by a group with ) followed by . This gives small parentheses. Variant three is logically better: we put the parentheses in a group, so that its size depends only on the content of the group; in this case Tralics leaves the formula unchanged. If you feel that the parentheses are too big, you can reduce them: variant four uses \smash.

A non trivial point is that the size of the slash character is also variable. In the case where a group is used (variant 3 and 4), it size depends on the q 2 that follows. Otherwise, when Tralics tries to insert a group, in order to reduce the size of the parentheses, it uses a complicated algorithm: when a group is created for the parentheses, it does not include big objects. In particular, since each semi-colon is followed by q 2 , this group cannot contain both parentheses. Expressions can be split after binary operators or relations, in the case of a/b=c, only the equals sign is considered. Understanding exactly where the expression is split is not easy. Obviously, in the case when there are two q 2 in the expression, none of them is in a group. Since the slash character is between these two expressions, it is outside of the group, its size is affected by the exponent of the first q. This gives a very big slash (in the case of the Pdf version, only small characters are used).

One fundamental change in Tralics 2.10.8 concerns the case where a superscript or subscript is attatched to a parenthesis. In this case, the script is detached, the soliiting algorithme is called, and the script is attached to what preceeds. An like (x)^2, will be converted into (x){}^2, that can be converted into (x){}^2, and after removal of the dummy group into (x)^2.

303 \def\Paren#1{(#1)}
304 \def\Paren#1{(#1){}}
305 \def\Paren#1{{(#1)}}
306 \def\Paren#1{{(\smash{#1})}}
307 \def\Slash{/}
308 \[ \frac{\formA\formB}{\formC} \]
309 \[ \frac{\textstyle\formA\qquad \atop\hfill\textstyle\formB}{\formC} \]

The whole formula version 1

q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q)

Version two

q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q)

Version 3

q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q)

Version 4

q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q)

The split formula

q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q)

One trick in order to get a smaller slash: define \Slash to be a group consisting of a slash (and something else, here a \kern of width minus 1pt). The whole formula version two

q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q)

Version 4

q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q)

The split formula, version 4

q 1 2n(n+1) (ea;q 2 ) (eq/a;q 2 ) (caq/e;q 2 ) (cq 2 /ae;q 2 ) (e;q) (cq/e;q)

3. Higher Mathematics, TLC2

In this chapter we present examples from the LaTeX companion, second edition, chapter 8; the book is distributed with a CDrom containing all examples. These examples are formed of two parts; black and blue, the blue part contains material to be inserted before the \begin{document}; whenever needed, we shall explain what these commands are assumed to do, what they do, and how the feature might be implemented. Unless stated otherwise, the black part is taken verbatim.

3.1. Introduction to amslatex

The following packages are defined for use with Tralics:

All undefined math symbols are defined to be \ams@unimp, a command that expands to an undefined command, the one defined here to produce a red X.

310 \def\UnimplementedOperator{\mathbox{mstyle}[color][red]{X}}

3.2. Display and alignment structures for equations

Source code for some formulas used below:

311 \begin{equation} (a+b)^2 = a^2+2ab+b^2\end{equation}
312 \[  \sin^2\eta+\cos^2\eta = 1  \]
313 \begin{equation} x^2 + y^2  =  z^2 \end{equation}
314 \begin{align} x^2 + y^2 &=  z^2 \\ x^3 + y^3 &<  z^3 \end{align}
315 \begin{eqnarray} x^2 + y^2 &=& z^2 \\ x^3 + y^3 &<& z^3 \end{eqnarray}
316 \begin{equation*}  n^2 + m^2 = k^2 \end{equation*}
317 \begin{equation} n^p +m^p \neq k^p  \qquad p > 2 \end{equation}
318 \begin{multline}  \tag{2}
319   \sum_{t \in \mathbf{T}} \int_a^t
320     \biggl\lbrace \int_a^t f(t - x)^2 \,
321             g(y)^2 \,dx \biggr\rbrace \,dy \\
322   = \sum_{t \notin \mathbf{T}} \int_t^a
323       \biggl\lbrace g(y)^2 \int_t^a
324         f(x)^2 \,dx \biggr\rbrace \,dy
325 \end{multline}

Example 8-2-1. This uses the `leqno´ option of the amsmath package, that is assumed to put equation numbers on the left. In Tralics, this will set the attribute equation-number = `left´ of the document element.

In Tralics, if a formula has no \label, no number is associated to it. Here we have a formula using the equation environment, or a displaymath formula enclosed in a \[, \] pair.

(a+b) 2 =a 2 +2ab+b 2
sin 2 η+cos 2 η=1

Example 8-2-2. This uses options `reqno´ option of the amsmath package (equations to the right), it puts equation-number = `left´ on the document element. It uses also `fleqn´, that sets flushed-equation = `true´; in LaTeX, you must define \mathindent, here to 1pc, as the distance between the left margin and the formula; ignored by Tralics. Same formulas as above, with a label added, in order to show the difference.

(a+b) 2 =a 2 +2ab+b 2 (18)
sin 2 η+cos 2 η=1

Example 8-2-3. The code was modified in order to add labels; you see three 3 numbers; one per environment, equation, align, and eqnarray. Also text added between the groups of equations. First environment is equation:

x 2 +y 2 =z 2 (19)

Second environment is align:

x 2 +y 2 =z 2 x 3 +y 3 <z 3 (20)

Third environment is eqnarray:

x 2 +y 2 =z 2 x 3 +y 3 <z 3 (21)

Note: amsmath adds a new complexity to how spaces are handled: spaces after \\ are no more ignored. This mechanism is not implemented in Tralics.

Example 8-2-4. We modified the examples by adding a label; you can see that this produces an equation number for equation*, (22) as well as equation, (23).

n 2 +m 2 =k 2 (22)
n p +m p k p p>2(23)

Example 8-2-5. Translation of \multline is a table, elements are centered, except first, last, and lines using \shoveleft or \shoveright. No & should be given; last line should not be terminated with \\.


Example 8-2-6. This is the default behavior for tags.

tT a t a t f (t-x) 2 g (y) 2 d xdy= tT t a g (y) 2 t a f (x) 2 d xdy(2)

Same formulas, with \multlinegap set to zero. This has no effect in Tralics

tT a t a t f (t-x) 2 g (y) 2 d xdy= tT t a g (y) 2 t a f (x) 2 d xdy(2)

From now on, we redefine the \tag command via \tagasattribute; the second equation with a tag gives:

sin 2 η+cos 2 η=1(3)

The magic is that this uses \formulaattribute, a command added in Tralics 2.9.5 that adds an attribute pair to the formula; our style sheet handles a formula with a tag in the same way as a formula with an id (after converting the id into a tag). There are four commands of the form \XXattribute that add an attribute to an element under construction: the math formula, the math expression, the current row, the current cell. In these cases \mathattribute cannot be used (it adds an attribute to the last element created). It is not possible to use \XMLaddatt in math mode, and it is not possible to use this command after a math formula in order to add an attribute (If the token that follows a display math formula is not a \par, then \noindent is inserted, thus, if this token is \XMLaddatt, the current element is an empty paragraph). Example

326 \begin{align}
327 \formulaattribute{tag}{8-2-3}
328 \thismathattribute{background}{white}
329 \rowattribute{mathvariant}{bold} x^2 + y^2+100 &=  z^2 \\
330 \cellattribute{columnalign}{left}  x^3 + y^3+1 &<  z^3
331 \end{align}

Translation (bold attribute ignored in the Pdf version):

x 2 +y 2 +100=z 2 x 3 +y 3 +1<z 3 8-2-3
332 \begin{equation} \begin{split} % 8-2-7
333  (a + b)^4
334    &= (a + b)^2 (a + b)^2      \\
335    &= (a^2 + 2ab + b^2)   (a^2 + 2ab + b^2)        \\
336    &= a^4 + 4a^3b + 6a^2b^2 + 4ab^3 + b^4
337  \end{split}\end{equation}
338 \begin{equation} \begin{split} % 8-2-8
339   (a + b)^3 &= (a + b) (a + b)^2        \\
340             &= (a + b)(a^2 + 2ab + b^2) \\
341             &= a^3 + 3a^2b + 3ab^2 + b^3
342  \end{split}\end{equation}

Example 8.2.7 Single equation on several lines with alignment

(a+b) 4 =(a+b) 2 (a+b) 2 =(a 2 +2ab+b 2 )(a 2 +2ab+b 2 )=a 4 +4a 3 b+6a 2 b 2 +4ab 3 +b 4

Example 8.2.8. The LaTeX companion explains that the amsmath package can be loaded with options `centertags´ or `tbtags´. In the first case, tags centered with the formula (left or right), in the second case, tags are on the first line (on the left) or last line (on the right). By default, Tralics does nothing, and in the case of `tbtags´, it sets split-tags = `tb´ on the root element.

(a+b) 3 =(a+b)(a+b) 2 =(a+b)(a 2 +2ab+b 2 )=a 3 +3a 2 b+3ab 2 +b 3
343 \newcommand\relphantom[1]{\mathrel{\phantom{#1}}}
344 \newcommand\ve{\varepsilon}  \newcommand\tve{t_{\varepsilon}}
345 \newcommand\vf{\varphi}      \newcommand\yvf{y_{\varphi}}
346 \newcommand\bfE{\mathbf{E}}
348 \begin{equation} \begin{split}
349   f_{h, \ve}(x, y)
350     &= \ve \bfE_{x, y} \int_0^{\tve} L_{x, \yvf(\ve u)} \vf(x) \,du  \\
351     &= h \int L_{x, z} \vf(x) \rho_x(dz)                             \\
352     &\relphantom{=} {} + h \biggl[
353        \frac{1}{\tve}
354        \biggl( \bfE_{y} \int_0^{\tve}  L_{x, y^x(s)} \vf(x) \,ds
355                - \tve \int L_{x, z} \vf(x) \rho_x(dz)      \biggr) + \\
356     &\relphantom{=} \phantom{{} + h \biggl[ }
357        \frac{1}{\tve}
358        \biggl( \bfE_{y} \int_0^{\tve}  L_{x, y^x(s)} \vf(x) \,ds
359                - \bfE_{x, y} \int_0^{\tve} L_{x, \yvf(\ve s)}
360                                             \vf(x) \,ds    \biggr) \biggr]
361 \end{split} \end{equation}

Example 8-2-9

f h,ε (x,y)=εE x,y 0 t ε L x,y ϕ (εu) ϕ(x)du=hL x,z ϕ(x)ρ x (dz)=+h[1 t ε E y 0 t ε L x,y x (s) ϕ (x) d s - t ε L x,z ϕ (x) ρ x (dz)+=+h[1 t ε E y 0 t ε L x,y x (s) ϕ (x) d s - E x,y 0 t ε L x,y ϕ (εs) ϕ (x) d s](24)
362 \begin{gather}
363   (a + b)^2 = a^2 + 2ab + b^2          \\
364   (a + b) \cdot (a - b) = a^2 - b^2
365 \end{gather}

Example 8-2-10, equation groups without alignment.

(a+b) 2 =a 2 +2ab+b 2 (a+b)·(a-b)=a 2 -b 2
366 \begin{gather}
367   D(a,r) \equiv \{ z \in \mathbf{C}   \colon |z - a| < r \}    \notag \\
368   \operatorname{seg} (a, r) \equiv    \{ z \in \mathbf{C} \colon
369       \Im z < \Im a, \ |z - a| < r \}    \\
370     C (E, \theta, r) \equiv    \bigcup_{e \in E} c (e, \theta, r)
371 \end{gather}

Example 8-2-11

D(a,r){zC:|z-a|<r}seg(a,r){zC:z<a,|z-a|<r}C(E,θ,r) eE c(e,θ,r)
372 \begin{align}
373   (a + b)^3  &= (a + b) (a + b)^2        \\
374              &= (a + b)(a^2 + 2ab + b^2) \\
375              &= a^3 + 3a^2b + 3ab^2 + b^3
376 \end{align}
377 \begin{align} x^2  + y^2 & = 1 \\ x  & = \sqrt{1-y^2}\end{align}

Example 8-2-12

(a+b) 3 =(a+b)(a+b) 2 =(a+b)(a 2 +2ab+b 2 )=a 3 +3a 2 b+3ab 2 +b 3


x 2 +y 2 =1x=1-y 2
378 \begin{align}
379  \text{Compare } x^2 + y^2 &= 1 &  x^3 + y^3 &= 1 \\
380   x &= \sqrt   {1-y^2} & x &= \sqrt[3]{1-y^3}
381 \end{align}
382 \begin{align}
383 x&= y & X  &= Y  &a  &= b+c \\
384 x' &= y'& X' &= Y' &a' &= b\\
385  x + x' &= y + y'  &  X + X' &= Y + Y' & a'b &= c'b
386 \end{align}

Example 8-2-13. This example has two column-pairs.

Comparex 2 +y 2 =1x 3 +y 3 =1x=1-y 2 x=1-y 3 3

This example has three column-pairs.

x=yX=Ya=b+cx ' =y ' X ' =Y ' a ' =bx+x ' =y+y ' X+X ' =Y+Y ' a ' b=c ' b
387 \begin{flalign}  \text{Compare }
388   x^2 + y^2 &= 1               &  x^3 + y^3 &= 1               \\
389   x         &= \sqrt   {1-y^2} &  x         &= \sqrt[3]{1-y^3}
390 \end{flalign}
391 \begin{flalign}
392     x    &= y      & X  &= Y  &      a  &= b+c               \\
393     x'   &= y'     & X' &= Y' &      a' &= b                 \\
394   x + x' &= y + y'            &  X + X' &= Y + Y' & a'b &= c'b
395 \end{flalign}

Example 8-2-14 This example has two column-pairs.

Comparex 2 +y 2 =1x 3 +y 3 =1x=1-y 2 x=1-y 3 3

This example has three column-pairs.

x=yX=Ya=b+cx ' =y ' X ' =Y ' a ' =bx+x ' =y+y ' X+X ' =Y+Y ' a ' b=c ' b
396 \renewcommand\minalignsep{0pt}
397 \begin{align}    \text{Compare }
398   x^2 + y^2 &= 1               &  x^3 + y^3 &= 1              \\
399   x         &= \sqrt   {1-y^2} &  x         &= \sqrt[3]{1-y^3}
400 \end{align}
401 \renewcommand\minalignsep{15pt}
402 \begin{flalign}
403     x    &= y      & X  &= Y  &      a  &= b+c              \\
404     x'   &= y'     & X' &= Y' &      a' &= b                \\
405   x + x' &= y + y'            &  X + X' &= Y + Y' & a'b &= c'b
406 \end{flalign}

Example 8-2-15 This example has two column-pairs.

Comparex 2 +y 2 =1x 3 +y 3 =1x=1-y 2 x=1-y 3 3

This example has three column-pairs.

x=yX=Ya=b+cx ' =y ' X ' =Y ' a ' =bx+x ' =y+y ' X+X ' =Y+Y ' a ' b=c ' b
407 \renewcommand\minalignsep{2em}
408 \begin{align}
409   x      &= y      && \text{by hypothesis} \\
410       x' &= y'     && \text{by definition} \\
411   x + x' &= y + y' && \text{by Axiom 1}
412 \end{align}

Example 8-2-16

x=ybyhypothesisx ' =y ' bydefinitionx+x ' =y+y ' byAxiom1
413 \begin{equation}
414 \begin{aligned}
415   x^2 + y^2  &= 1 \\ x &= \sqrt{1-y^2} \\ \text{and also }y &= \sqrt{1-x^2}
416 \end{aligned}               \qquad
417 \begin{gathered}
418  (a + b)^2 = a^2 + 2ab + b^2    \\ (a + b) \cdot (a - b) = a^2 - b^2
419 \end{gathered}      \end{equation}

Example 8-2-17

x 2 +y 2 =1x=1-y 2 andalsoy=1-x 2 (a+b) 2 =a 2 +2ab+b 2 (a+b)·(a-b)=a 2 -b 2
420 \begin{equation}
421 \begin{aligned}[b]
422   x^2 + y^2  &= 1\\ x &= \sqrt{1-y^2}    \\ \text{and also }y &= \sqrt{1-x^2}
423 \end{aligned}               \qquad
424 \begin{gathered}[t]
425  (a + b)^2 = a^2 + 2ab + b^2    \\ (a + b) \cdot (a - b) = a^2 - b^2
426 \end{gathered}\end{equation}

Example 8-2-18 (note: )

x 2 +y 2 =1x=1-y 2 andalsoy=1-x 2 (a+b) 2 =a 2 +2ab+b 2 (a+b)·(a-b)=a 2 -b 2
427 \newenvironment{rcase}{\left.\begin{aligned}} {\end{aligned}\right\rbrace}
428 \begin{equation*}
429   \begin{rcase}
430     B' &= -\partial\times E  \\  E' &=  \partial\times B - 4\pi j \,
431   \end{rcase}
432   \quad \text {Maxwell's equations}
433 \end{equation*}

Example 8-2-19(note: )

B ' =-×EE ' =×B-4πjMaxwell'sequations
435 \renewcommand\minalignsep{5pt}
436 \begin{equation} \begin{aligned}
437   V_j &= v_j &  X_i &= x_i - q_i x_j &      &= u_j + \sum_{i\ne j} q_i \\
438   V_i &= v_i - q_i v_j &  X_j &= x_j &  U_i &= u_i
439 \end{aligned} \end{equation}

Example 8-2-20

V j =v j X i =x i -q i x j =u j + ij q i V i =v i -q i v j X j =x j U i =u i
440 \begin{align}
441   A_1 &= N_0 (\lambda ; \Omega') -  \phi ( \lambda ; \Omega')   \\
442   A_2 &= \phi (\lambda ; \Omega') \phi (\lambda ; \Omega)     \\
443 \intertext{and finally}
444   A_3 &= \mathcal{N} (\lambda ; \omega)
445 \end{align}

Example 8-2-21

A 1 =N 0 (λ;Ω ' )-φ(λ;Ω ' )A 2 =φ(λ;Ω ' )φ(λ;Ω)andfinallyA 3 =N(λ;ω)

Example 8-2-22, 8-2-23, 8-2-24 explain that spacing around equations can be wrong; we omit them.

446 \begin{align}
447   x^2+y^2 &= z^2 \label{eq:A}            \\
448   x^3+y^3 &= z^3 \notag                  \\
449   x^4+y^4 &= r^4 \tag{$*$}               \\
450   x^5+y^5 &= r^5 \tag*{$*$}              \\
451   x^6+y^6 &= r^6 \tag{\ref{eq:A}$'$}     \\
452       A_1 &= N_0 (\lambda ; \Omega')
453              - \phi ( \lambda ; \Omega') \\
454       A_2 &= \phi (\lambda ; \Omega')
455              \, \phi (\lambda ; \Omega)
456              \tag*{ALSO (\theequation)}  \\
457       A_3 &= \mathcal{N} (\lambda ; \omega)
458 \end{align}

Example 8-2-25. In the Companion, first equation is numbered (1), second equation has no number, third is (*), then come *, (1´), (2), ALSO (2) and (3). Since Tralics does not compute equation numbers, you will not see (1), (2), (3). Since (1´) is obtained by a reference to the first equation, the whole set of equations is numbered, namely (25). It is currently impossible to use a reference, we locally change \ref, so that it produces a number, here 17. This is also the current value of the equation counter. Hence, the full tag, concatenation of all four tags is *,*,17x,ALSO (17); we have replaced the apostrophe by x, because of a bug in current Tralics. This full tag is put on the math formula.

Note: the style sheet that converts XML to HTML attributes a number to each equation that has a label, and \ref uses this number. If the equation has a tag, no number should be attributed, and \ref should use the tag. This might change.

Note: LaTeX uses \text to format the tag, and as a consequence, spaces are not ignored. In Tralics, nothing special is done, and they are ignored. Should be fixed some day.

x 2 +y 2 =z 2 x 3 +y 3 =z 3 x 4 +y 4 =r 4 x 5 +y 5 =r 5 x 6 +y 6 =r 6 A 1 =N 0 (λ;Ω ' )-φ(λ;Ω ' )A 2 =φ(λ;Ω ' )φ(λ;Ω)A 3 =N(λ;ω)(25)

Same example, with default behavior of \tag. Note that the equation number is still the same. The equation has an another label, it is now equation (17), but \ref is still defined to be 17.

x 2 +y 2 =z 2 x 3 +y 3 =z 3 x 4 +y 4 =r 4 (*)x 5 +y 5 =r 5 *x 6 +y 6 =r 6 (17 ' )A 1 =N 0 (λ;Ω ' )-φ(λ;Ω ' )A 2 =φ(λ;Ω ' )φ(λ;Ω) ALSO (17)A 3 =N(λ;ω)(26)
459 \begin{equation}  \begin{split} \label{e-8-2-26}
460   \lvert I_2 \rvert  &=    \left\lvert \int_{0}^T \psi(t)
461       \left\{  u(a, t) - \int_{\gamma(t)}^a \frac{d\theta}{k}
462         (\theta, t) \int_{a}^\theta c (\xi) u_t (\xi, t) \,d\xi
463       \right\} dt \right\rvert                                     \\
464                      &\le  C_6  \Biggl\lvert
465       \left\lvert f \int_\Omega \left\lvert
466           \widetilde{S}^{-1,0}_{a,-} W_2(\Omega, \Gamma_l)
467         \right\rvert \ \right\rvert
468       \left\lvert \lvert u \rvert
469         \overset{\circ}{\to} W_2^{\widetilde{A}} (\Omega; \Gamma_r,T)
470       \right\rvert              \Biggr\rvert
471 \end{split} \end{equation}

Example 8-2-26. The book explains that the tag is not correctly positioned. We modified the example by adding a label, and this gives an equation number in the HTML file. This number is vertically centered, whatever the size of the formula.

|I 2 |= 0 T ψ(t)u(a,t)- γ(t) a dθ k(θ,t) a θ c(ξ)u t (ξ,t)dξdtC 6 f Ω S ˜ a,- -1,0 W 2 (Ω,Γ l ) |u| W 2 A ˜ (Ω;Γ r ,T)(27)

Example 8-2-27. Equation (28) should be the same as (27); but in order to test our algorithm we have replaced some \lvert and \rvert by \lVert and \rVert, that are the same as \Vert, but declared as mathopen and mathclose symbols

|I 2 |= 0 T ψ(t)u(a,t)- γ(t) a dθ k(θ,t) a θ c(ξ)u t (ξ,t)dξdtC 6 f Ω S ˜ a,- -1,0 W 2 (Ω,Γ l ) |u| W 2 A ˜ (Ω;Γ r ,T)(28)
472 \begin{gather}   \raisetag{-40pt}
473  \text{The sign function: \ } \mathcal{S}(x) =
474  \begin{cases}-1   &  x < 0 \\ 0   &  x = 0 \\ 1   &  x > 0\end{cases}
475 \end{gather}

Example 8-2-28, showing the command \raisetag. It is defined as doing nothing in Tralics (the tag, i.e., the equation number, is inserted by the style sheet that converts from XML to HTML.) We have redefined here the command as follows

476 \def\raisetag#1{%
477 \dimen0=#1\relax
478 \ifdim\dimen0<0pt
479   \dimen0=-\dimen0
480    \formulaattribute{tag-down}{\the\dimen0}%
481 \else
482 \formulaattribute{tag-up}{\the\dimen0}\fi}

Thus \raisetag with a value of -10pt will add tag-down = `10pt´ to the formula element. In this case, the style sheet adds style = `padding-top:10pt´ to the cell containing the equation number. In the case of a positive value, padding-bottom is used instead. In this example, we use 40pt.

483 begin{subequations}  \label{eq:1}
484 \begin{align}  f  &= g            \label{eq:1A} \\
485                f' &= g'           \label{eq:1B} \\
486     \mathcal{L}f  &= \mathcal{L}g \label{eq:1C}
487 \end{align}
488 \end{subequations}
489 \begin{subequations}  \label{eq:2}
490 \renewcommand\theequation{\theparentequation\roman{equation}}
491 \begin{align}  f  &= g            \label{eq:2A} \\
492                f' &= g'           \label{eq:2B} \\
493     \mathcal{L}f  &= \mathcal{L}g + K  \label{eq:2C}
494 \end{align}
495 \end{subequations}
496 Note the relationship between~\eqref{eq:1}
497 and~\eqref{eq:2}: only~\ref{eq:1C} and~\ref{eq:2C} differ.

Example 8-2-29: the amsmath package provides a subequations environment to support “equation subnumbering” with tags of the form (2a), (2b), (2c), and so on. All the tagged equations within it use this sub-numbering scheme based on two normal LaTeX counters parentequation and equation. First group, with only labels eq:1 and eq1:C

f=gf ' =g ' Lf=Lg(30)

The Tralics implementation is trivial: the environment does nothing. Thus, the \label command in the subequations corresponds to the current section. Second group, with only labels eq:2 and eq2:C

f=gf ' =g ' Lf=Lg+K(31)

We have removed two \labels from the align, because it produces a single equation number and accepts a single label. Thus, the text after the equations reads: Note the relationship between (3.2) and (3.2): only 30 and 31 differ.

3.3. Matrix-like environments

498 \begin{equation}    P_{r - j} =
499  \begin{cases}
500     0   &  \text{if $r - j$ is odd,} \\
501     r! \, (-1)^{(r - j)/2}
502         &  \text{if $r - j$ is even.}
503  \end{cases}                \end{equation}

Example 8-3-1

P r-j =0ifr-jisodd,r!(-1) (r-j)/2 ifr-jiseven.
504 \begin{gather*}
505   \begin{matrix}  0 &  1 \\ 1 &  0 \end{matrix}  \quad
506   \begin{pmatrix} 0 & -i \\ i &  0 \end{pmatrix} \\
507   \begin{bmatrix} 0 & -1 \\ 1 &  0 \end{bmatrix} \quad
508   \begin{Bmatrix} 1 &  0 \\ 0 & -1 \end{Bmatrix} \\
509   \begin{vmatrix} a &  b \\ c &  d \end{vmatrix} \quad
510   \begin{Vmatrix} i &  0 \\ 0 & -i \end{Vmatrix}
511 \end{gather*}

Example 8-3-2, using a single equation(note: )

512 \newcommand\hdotsfor[2][x]{\multicolumn{5}{c}{.\ .\ .\ .\ .\ .\ .\ .\ .}}
513 \setcounter{MaxMatrixCols}{20}
514 \[
515  \begin{Vmatrix}
516   \,a&b&c&d&e&f&g&h&i&j &\cdots\,{} \\
517      &a&b&c&d&e&f&g&h&i &\cdots\,{} \\
518      & &a&b&c&d&e&f&g&h &\cdots\,{} \\
519      & & &a&b&c&d&e&f&g &\cdots\,{} \\
520      & & & &\ddots&\ddots&\hdotsfor[2]{5}%\,{}
521  \end{Vmatrix} \]

Example 8-3-3. The example uses \hdotsfor, a command equivalent to \multicolumn{5}{c}{leaders}. Leaders cannot be implemented in MathML, so that the command is redefined in this case.


In the example above, there was a \,{} at the end of each line. We had to remove it on the last line, because Tralics complains if a cell contains \multicolumns and additional commands. The following example is refused by Tralics; but LaTeX is happy with it, but x is typeset outside math mode. Thus the question: what is the exact effect of the last \,{} in the LaTeX case?

522 $\begin{array}{ccc}
523 111&222&333\\
524 \hdotsfor{2}x&t\\
525 \end{array}$

Example 8-3-4. This example uses the environment smallmatrix, which is defined by Tralics to be the same as matrix, i.e., a matrix without delimiters, 100-1 the same with \left and \right parentheses 100-1. There is some text after the matrix. It happens that matrices in text style are badly rendered by Firefox. There is a huge amount of white space on the left of each column.

526 \begin{gather}
527   \sum_{\substack{0 \le i \le m \\ 0 < j < n}} P(i, j) \\
528   \sum_{\begin{subarray}{l}  i \in \Lambda   \\
529                              0 \le i \le m   \\
530                              0 < j < n
531         \end{subarray}}  P(i, j)
532 \end{gather}

Example 8-3-5. The style of the subarray should be smaller

0im0<j<n P(i,j) iΛ0im0<j<n P(i,j)
533 \DeclareMathOperator\add{add}
534 \DeclareMathOperator\cf {cf}
535 \DeclareMathOperator\cov{cov}
536 \DeclareMathOperator\non{non}
537 \DeclareMathOperator\End{End}
538 \[ \begin{CD}
539      \cov (L) @>>> \non (K) @>>> \cf (K)  \\
540        @VVV          @AAA          @AAA   \\
541      \add (L) @>>> \add (K) @>>> \cov (K) \\
542    \end{CD} \]

Example 8-3-6. You must be careful with the CD environment, because the at-sign is an active character, that reads some text, depending on the character that follows; more examples are given below.

cov(L) non(K) cf(K)add(L) add(K) cov(K)
543 \[ \begin{CD}
544      S^{W_\Lambda}\otimes T @>j>>      T       \\
545       @VVV                        @VV{\End P}V \\
546     (S \otimes T)/I         @=   (Z\otimes T)/J
547    \end{CD} \]

Example 8-3-7

S W Λ T jTEndPEndP(ST)/I=(ZT)/J

Example 8-3-8. This uses \longrightarrow, that produces character U+27F9, unknown to FM.

S W Λ T jTEndPEndP(ST)/I=(ZT)/J
548 \[ \mathcal{Q} =
549 \begin{delarray}[t] ( {cc} ) X & Y \end{delarray}
550 \begin{delarray}[t] [ {cc} ] A & B \\ C & D   \end{delarray}
551 \begin{delarray}[b] \lgroup{cc}\rgroup L \\ M \end{delarray}
552 \]

Example 8-3-9. This example uses the delarray package that changes the meaning of the array environment. In the current version of Tralics, there is no \array command, hence no possibility to redefine it. The delarray.plt file defines a delarray environment that is used here.


3.4. Compound structures and decorations

553 \[   0 \xleftarrow [\zeta]{}  F \times \Delta (n - 1)
554      \xrightarrow {\partial_0 \alpha(b)} E^{\partial_0 b}\]

Example 8-4-1

0 ζF×Δ(n-1) 0 α(b)E 0 b
555 \begin{equation*}
556 \cfrac {1}{\sqrt{2} +
557  \cfrac {1}{\sqrt{3} +
558   \cfrac {1}{\sqrt{4} +
559    \cfrac[r] {1}{\sqrt{5} +
560     \cfrac[l] {1}{\sqrt{6} + \dotsb }
561    }}}}
562 \end{equation*}

Example 8-4-2

1 2+1 3+1 4+1 5+1 6+
563 \begin{equation} \boxed { W_t - F \subseteq V(P_i) \subseteq W_t }\end{equation}

Example 8-4-3

W t -FV(P i )W t
564 \[  \sum_{i=1}^n \qquad \int_0^\infty \qquad \lim_{n \to 0} \]
565 Text: $\sum_{i=1}^n$, $\int_0^\infty$, $\lim_{n \to 0}$.

Example 8-4-4

i=1 n 0 lim n0

Text: i=1 n , 0 , lim n0 .

566 \[
567    \sum\nolimits_{i=1}^n \qquad \int\limits_0^\infty
568    \qquad  \lim\displaylimits_{n \to 0}
569 \]
570 Text: $\sum\nolimits_{i=1}^n$, $\int\limits_0^\infty$,
571 $\lim\displaylimits_{n \to 0}$.

Example 8-4-5 (limits placement is wrong in the Pdf version, text style).

i=1 n 0 lim n0

Text: i=1 n , 0 , lim n0 .

572 \begin{gather*}
573  \xiint     \limits _V \mu(v,w)   \,du \,dv  \quad
574  \xiiint    \limits _V \mu(u,v,w)   \,du \,dv \,dw  \quad
575  \xiiiint   \limits _V \mu(t,u,v,w)   \,dt \,du \,dv \,dw  \\
576  \idotsint \limits _V \mu(z_1, \dots, z_k)   \,\mathbf{dz}\\
577  \iint     \limits _V \mu(v,w)   \,du \,dv \qquad
578  \iiint    \limits _V \mu(u,v,w)   \,du \,dv \,dw  \qquad
579  \iiiint   \limits _V \mu(t,u,v,w)    \,dt \,du \,dv \,dw  \\ \textstyle
580  \iint     \limits _V \mu(v,w)   \,du \,dv \qquad
581  \iiint    \limits _V \mu(u,v,w)   \,du \,dv \,dw  \qquad
582  \iiiint   \limits _V \mu(t,u,v,w)   \,dt \,du \,dv \,dw
583 \end{gather*}

Example 8-4-6. Modified, using \xiint, \xiiint, \xiiiint command that produce Unicode character U+222c, U+222D and U+2A0C, or simple integrals.

V μ(v,w)dudv V μ(u,v,w)dudvdw V μ(t,u,v,w)dtdudvdw... V μ(z 1 ,,z k )dz V μ(v,w)dudv V μ(u,v,w)dudvdw V μ(t,u,v,w)dtdudvdw V μ(v,w)dudv V μ(u,v,w)dudvdw V μ(t,u,v,w)dtdudvdw
584 \begin{align*}
585   u & \equiv v + 1 \mod{n^2}  \\
586   u & \equiv v + 1 \bmod{n^2} \\
587   u &   =    v + 1 \pmod{n^2} \\
588   u &   =    v + 1 \pod{n^2}
589 \end{align*}
590 The in-text layout: $ u = v + 1 \pmod{n^2} $
591 \begin{gather*}
592    (m \bmod n) = k^2 \, ; \quad
593   x \equiv y \pmod b \, ;     \\
594   x \equiv y \mod c \, ;  \quad
595   x \equiv y \pod d\, .
596 \end{gather*}

Example 8-4-7

uv+1modn 2 uv+1modn 2 u=v+1(modn 2 )u=v+1(n 2 )

The in-text layout: u=v+1(modn 2 )

(mmodn)=k 2 ;xy(modb);xymodc;xy(d).
597 \begin{equation} \frac{1}{k} \log_2 c(f)
598           \quad \tfrac{1}{k} \log_2 c(f) \end{equation}
599 Text: $ \sqrt{ \frac{1}{k} \log_2 c(f) } \quad
600         \sqrt{ \dfrac{1}{k} \log_2 c(f) }\, $.

Example 8-4-8

1 klog 2 c(f)1 klog 2 c(f)

Text: 1 klog 2 c(f)1 klog 2 c(f).

601 \begin{equation} \binom{k}{2} 2^{k - 1}
602           + \tbinom{k - 1}{2} 2^{k - 2} \end{equation}
603 Text: $ \binom{k}{2} 2^{k - 1} + \dbinom{k - 1}{2} 2^{k - 2} $.
604 $ \dot{S} \quad \ddot{P} \quad \dddot{Q} \quad \ddddot{R} $

Example 8-4-9

k 22 k-1 +k-1 22 k-2

Text: k 22 k-1 +k-1 22 k-2 .

Example 8-4-10: Four dots above: character unknown by FM. S ˙P ¨Q R

605 \[ \accentset{\ast}{X}                 \quad
606    \hat{\accentset{\star}{\hat h}}     \quad
607    \underaccent{\diamond}{\mathcal{M}} \quad
608    \undertilde{C}\quad\undertilde{M}\quad\undertilde{ABC} \]

Example 8-4-11. Commands \accentset and \underaccent are defined in the amsmath.plt file, they produce a <munder> or <mover> element, with attribute accent or mathaccent set to true. Note that accents might be too big.

X *h ^ ^M C ˜M ˜ABC ˜
609 $(xyz)\spdddot$ \quad $(xyz)\spddot$ \quad $(xyz)\spdot$
610 $(xyz)\spbreve$ \quad $(xyz)\spcheck$
611 $(xyz)\sphat$   \quad $(xyz)\sptilde$

Example 8-4-12. (breve and hat are invisible on Firefox, too high on Amaya). (xyz) ...    (xyz) ..    (xyz) .    (xyz) ˘    (xyz)    (xyz) ^    (xyz)

612 \[ \overset{*}{X} > \underset{*}{X}
613      \iff \sideset{}{'}\sum_{a,b \in \mathbf{R^*}}
614                        \overset{a}{\underset{b}{X}} = X \]

Example 8-4-13. Commands \overset and \underset are defined in the amsmath.plt file, they produce a <munder> or <mover> element.

X *>X *' a,bR * X b a=X
615 \[ \sideset{_{i = 1}^n}{_{j = 2}^m}\prod_{k > 1}  \mathcal{T}_{i, j}^k \]

Example 8-4-14.

j=2mi=1n k>1 T i,j k

3.5. Variable symbol commands

616 A series $H_1, H_2, \dots, H_n$, a sum
617 $H_1 + H_2 + \dots + H_n$, an orthogonal product
618 $H_1 \times H_2 \times \dots \times H_n$.
619 A series $H_1, H_2, \dotsc\,$, a sum
620 $H_1 + H_2 + \dotsb\,$, an orthogonal product
621 $H_1 \times H_2 \times \dotsm\,$, and an infinite
622 integral:   \[ \int_{H_1} \int_{H_2} \dotsi \;  {-\Gamma}\, d\Theta \]

Example 8-5-1. A series H 1 ,H 2 ,,H n , a sum H 1 +H 2 ++H n , an orthogonal product H 1 ×H 2 ××H n .

Example 8-5-2. A series H 1 ,H 2 ,, a sum H 1 +H 2 +, an orthogonal product H 1 ×H 2 ×, and an infinite integral:

H 1 H 2 -ΓdΘ
623 \begin{align*}
624 \widehat  {\psi_\delta(t) E_t h} &= \widetilde   {\psi_\delta(t) E_t h}    \\
625 \overline  {\psi_\delta(t) E_t h}&= \underline   {\psi_\delta(t) E_t h}    \\
626 \overbrace      {\psi_\delta(t) E_t h}&= \underbrace  {\psi_\delta(t) E_t h}
627 & & \text{Do not change style}            \\
628 \overrightarrow {\psi_\delta(t) E_t h}&= \overleftarrow {\psi_\delta(t) E_t h}
629 & &   \text{Do not change style}     \\[-3pt]
630 & & & \text{without \textsf{amsmath}}     \\
631 \underrightarrow  {\psi_\delta(t) E_t h}
632 &= \underleftarrow  {\psi_\delta(t) E_t h}
633 & & \text{Do need \textsf{amsmath}}       \\
634 \overleftrightarrow {\psi_\delta(t) E_t h}
635 &=\underleftrightarrow{\psi_\delta(t) E_t h}
636 & & \text{Do need \textsf{amsmath}}
637 \end{align*}

Example 8-5-3

ψ δ (t)E t h ^=ψ δ (t)E t h ˜ψ δ (t)E t h ¯=ψ δ (t)E t h ̲ψ δ (t)E t h =ψ δ (t)E t h Donotchangestyleψ δ (t)E t h =ψ δ (t)E t h Donotchangestylewithoutamsmathψ δ (t)E t h =ψ δ (t)E t h Doneedamsmathψ δ (t)E t h =ψ δ (t)E t h Doneedamsmath
638 \[   \sqrtsign{1 + \sqrtsign{1 + \sqrtsign{1 +
639       \sqrtsign{1 + \sqrtsign{1 + \sqrtsign{1 + x}}}}}} \]

Example 8-5-4

Table 1. Vertically extensible symbols
(() ( ) {(} \{\} ( \lVert\rVert
( \langle\rangle {(} \lbrace\rbrace |(| \lvert\rvert
( \lgroup\rgroup [(] [ ] |( |
( \lmoustache\rmoustache [(] \lbrack\rbrack |( \vert
( \Downarrow ( \lceil\rceil |( \arrowvert
( \Uparrow ( \lfloor\rfloor |( \bracevert
( \Updownarrow ( \llbracket\rrbracket ( \Arrowvert
( \downarrow /( / ( \|
( \uparrow ( \backslash ( \Vert
( \updownarrow ( . ( \sqrtsign

3.6. Words in mathematics

Table 2. Predefined operators and functions
arccos \arccos varcsin \arcsin arctan \arctan arg \arg
cos \cos cosh \cosh cot \cot coth \coth
csc \csc deg \deg det \det dim \dim
exp \exp gcd \gcd hom \hom inf \inf
inj lim \injlim ker \ker lg \lg lim \lim
lim inf \liminf lim sup \limsup ln \ln log \log
max \max min \min Pr \Pr proj lim \projlim
sec \sec sin \sin sinh \sinh sup \sup
tan \tan tanh \tanh lim \varinjlim lim ̲ \varliminf
lim ¯ \varlimsup lim \varprojlim
640 \begin{gather}
641   \text{Also, if } \Delta_{\text{max up}}
642            = \Delta_{\text{min down}} \notag \\
643   \text{(for all ups and downs) then} \notag \\
644   \Delta_{\text{sum of ups}}
645            = \Delta_{\text{sum of downs}}
646 \end{gather}

Example 8-6-1

Also,ifΔ maxup =Δ mindown (forallupsanddowns)thenΔ sumofups =Δ sumofdowns
647 \newcommand\abs[1]{\lvert#1\rvert}
648 \setlength\mathindent{0pt}
649 \begin{gather*}
650   \lim_{x \rightarrow 0} \frac{ \sin^2(x) }{ x^2 } = 1 \\
651   \varliminf_{n \rightarrow \infty}
652     \abs{a_{n+1}} / \abs{a_n} = 0                      \\
653  %{ JG
654  \varinjlim (m_i^\lambda \cdot M)^*
655   %} JG
656 \le \varprojlim_{A/p \rightarrow \lambda(A)}A_p \le 0
657 \end{gather*}

Example 8-6-2. Braces uncommented out for the last equation.

lim x0 sin 2 (x) x 2 =1lim ̲ n |a n+1 |/|a n |=0lim (m i λ ·M) * lim A/pλ(A) A p 0lim (m i λ ·M) * lim A/pλ(A) A p 0
658 \let\abs\relax
659 \DeclareMathOperator \meas    {meas}
660 \DeclareMathOperator*\esssup  {ess \, sup}
661 \DeclareMathOperator*\supminus{sup - minus*}
662 \newcommand\abs [1]{\lvert#1\rvert}
663 \newcommand\norm[1]{\lVert#1\rVert}
664 \begin{gather*}
665   \norm{f}_\infty = \esssup_{x \in R^n} \abs{f(x)}  \\
666   \norm{f}_\infty = \smash{\esssup_{x \in R^n}} \abs{f(x)}  \\
667   \meas_1 \{ u \in R_+^1 \colon f^*(u)>\alpha \} =
668    \esssup_{x \in R^i} \; \meas_i
669      \{ u \in R^n \colon \abs{f(u)} \geq \alpha \}  \\
670   \quad (\forall \alpha \in \supminus_{f^*} R_{*+})
671 \end{gather*}

Example 8-6-3. We removed the line break between equations 2 and 3. Note that an asterisk is printed as a normal character. Note the use of the \smash command:

f =ess sup xR n |f(x)|f =ess sup xR n |f(x)|meas 1 {uR + 1 :f * (u)>α}=ess sup xR i meas i {uR n :|f(u)|α}(αsup-minus* f * R *+ )
672 \[\varlimsup_{n\to\infty}\calQ (u_n, u_n - u^{\#}) \ge \csc (\calQ' (u^{\#})) \]

Example 8-6-4

lim ¯ n Q(u n ,u n -u # )cosec(Q ' (u # ))

3.7. Fine tuning the mathematical layout

673 \let\LB\relax\let\RB\relax\let\DS\relax
674 \def\Test{
675    b                       %% D
676     ^0                     %% S
677    +                       %% D
678    \frac{\LB(k + p)        %% T
679           _{j'}\RB         %% S'
680          \DS% \displaystyle
681          \pm               %% T  [D]
682          \frac{(f + q)     %% S  [T]
683                 ^{(pk)     %% SS [S]
684                    ^y      %% SS
685                    _{j'}}} %% SS'
686               {(h + y)}}   %% S' [T']
687         {(l + q)           %% T'
688           ^{(pk)}}         %% S'
689 }
690 \[\Test\qquad \let\LB={ \let \RB=} \Test \]

Example 8-7-1. Original LaTeX version, plus version with braces added.

b 0 +(k+p) j ' ±(f+q) (pk) j ' y (h+y) (l+q) (pk) b 0 +(k+p) j ' ±(f+q) (pk) j ' y (h+y) (l+q) (pk)

Example 8-7-2. Same, with \DS replaced by \displaystyle

b 0 +(k+p) j ' ±(f+q) (pk) j ' y (h+y) (l+q) (pk) b 0 +(k+p) j ' ±(f+q) (pk) j ' y (h+y) (l+q) (pk)
691 \[ \biggl( \mathbf{E}_{y} \int_0^{t_\varepsilon}
692    L_{x, y^x(s)} \varphi(x)\, ds \biggr) \]

Example 8-7-3. This demonstrates that commands like \Large do affect the size delimiters as \biggl. In Tralics, translation of math formulas is unaffected by font size commands. Thus, second part of example omitted.

E y 0 t ε L x,y x (s) ϕ (x) d s
693 \[
694    \sqrt[\beta]{k} \qquad
695    \sqrt[\leftroot{2}\uproot{4} \beta]{k} \qquad
696    \sqrt[\leftroot{1}\uproot{3} \beta]{k}
697 \]

Example 8-7-4 Commands \leftroot and \uproot implemented as no-op.

k βk βk β
698 $\sqrt{x} + \sqrt{y}            + \sqrt{z}$,
699 $\sqrt{x} + \sqrt{\mathstrut y} + \sqrt{z}$,
700 $\sqrt{x} + \sqrt{\smash{y}}    + \sqrt{z}$,
701 $\sqrt{x} + \sqrt{\smash[b]{y}} + \sqrt{z}$

Example 8-7-5, explaining smash. x+y+z, x+(y+z, x+y+z, x+y+z

More uses of smash (top, bottom, all):

x+1 2+z,x+1 2+z,x+1 2+z,x+1 2+z.
702 \[
703   f_p (x) =
704   \begin{cases}
705     \frac{1}{\smash[b]{p}}                & x = p  \\
706     \frac{\strut
707           \smash[t]{\frac{(1 - x)^{\frac{1}{2}} }
708                          { x - \sin (x - p)     } } }
709          {\sqrt{1 - p} \, \cos (x - p)}   & x \neq p
710   \end{cases}
711 \]

Example 8-7-6. The \strut above needed by amsmath, see TLC2.

f p (x)=1 px=p((1-x) 1 2 x-sin(x-p) 1-pcos(x-p)xp
712 \[
713    \sqrt{ \frac{a+b}{x_j} }           \quad
714    \sqrt{ \frac{a+b}{\smash{x_j}} }   \quad
715    \sqrt{ \frac{a+b}{{}\smash{x_j}} } \quad
716    \sqrt{ \frac{a+b}{\smash{x_j+b}} }
717 \]

Example 8-7-7. The empty group above needed by amsmath, see TLC2.

a+b x j a+b x j a+b x j a+b x j +b

3.8. Fonts in formulas

718 $ \forall n \in \mathbb{N} : \mathfrak{M}_n \leq \mathfrak{A} $
719 \DeclareMathAlphabet\mathbb{U}{fplmbb}{m}{n}
720 $ \lbrace n,m \in \mathbb{N} \mid  \mathfrak{N}_{n,m} \rbrace $
721 \DeclareMathAlphabet\mathscr{T1}{hlcw}{m}{it}
722 $A_B \neq \mathscr{A}_\mathscr{B} \neq \mathcal{A}_\mathcal{B}$

Example 8-8-1 nN:M n A

Example 8-8-2 {n,mNN n,m }

Example 8-8-3 The \DeclareMathAlphabet command takes five arguments and defines the first one to be \relax. A B A B A B

723 \newcommand\bfB{\mathbf{B}}   \newcommand\bfx{\mathbf{x}}
724 \bmdefine\bpi{\pi}            \bmdefine\binfty{\infty}
725 \section{The bold equivalence
726   $\sum_{j < B} \prod_\lambda : \bm{\sum_{x_j} \prod_\lambda}$}
727 \begin{gather}
728   B_\infty + \pi B_1 \sim  \bfB_{\binfty} \bm{+}\bpi \bfB_{\bm{1}}
729     \bm {\sim B_\infty + \pi B_1}                                   \\
730   B_\binfty + \bpi B_{\bm{1}} \bm{\in} \bm{\biggl\lbrace}
731     (\bfB, \bfx) : \frac {\partial \bfB}{\partial \bfx}
732     \bm{\lnapprox} \bm{1} \bm{\biggr\rbrace}
733 \end{gather}

Example 8-8-4. Currently \bndefine is \def and \bm is \mathbf.

3.9. The bold equivalence j<B λ : x j λ

B +πB 1 B +πB 1 B +πB 1 B +πB 1 (B,x) : B x 1

Example 8-8-5: same code different packages

734 $\bm{\Biggl\lbrace\biggl\lbrace\Bigl\lbrace\bigl\lbrace \lbrace
735      \mathcal{Q}
736      \rangle \bigr\rangle\Bigr\rangle\biggr\rangle\Biggr\rangle}$

Example 8-8-6 { Q

Example 8-8-7: same code different packages.

737 $ \bm{\sqrt[2]{x \times \alpha}} $  but
738 $\let\unboldmath\relax
739  \bm{\sqrt[2]{x \mathbin{\mbox{\unboldmath$\times$}} \alpha}} $
740   or the similar
741 \def\sqrtsign{\sqrt{}}
742 $ \bm{\sqrtsign}{\bm{x} \times \bm{\alpha}} $
743 %% $\bf \sqrt \it {\bf x \IT \times \bf \alpha \IT } $ see below A
744 %% $\bf {\sqrt} \it {\bf {x} \IT \times \bf {\alpha} \IT } $ see below B

Example 8-8-8. Second formula modified: you cannot use \unboldmath. Third formula: the command \sqrtsign is identical to \sqrt; you may wonder what the argument is. Currently \bm is the same as \mathbf, it takes one argument and typesets it in bold face font. Hence, Tralics executes the line shown above, marked `see below A´. Here \bf and \it are the tokens inserted by the \bm command corresponding to the new and old font (in reality, these tokens have complicated names). Thus, the argument of \sqrt is the \it command. Note that the \sqrt command uses a local group (is this good idea?), so that the \it command changes font locally; said otherwise, current font remains bold, and \IT is \bf. It is a wonder that this works. We noticed that LaTeX font change commands like \mathbf typeset their arguments in a group, and modified the Tralics code; thus the equivalent of line marked `see below B´ is executed. Suddenly \sqrt looses its argument. For this reason, we changed the command \sqrtsign to \sqrt{}. The example is x×α 2 but x×α 2 or the similar x×α

745 \bmdefine\bhat{\hat}
746 % This does not work
747 %$\hat a \neq \bm{\hat a} \neq \bm{\hat a} = \bhat a \neq \bm{\widehat a}$
748 $\hat a \neq \bm{\hat a} \neq \bm\hat a = \bhat a \neq \bm\widehat a$

Example 8-8-9 modified a ^a ^a ^=a ^a ^

749 \section{Sample page of mathematical typesetting}
751 First some large operators
752 both in text: \( \iiint\limits_{\mathcal{Q}}
753 f(x,y,z)\,dx\,dy\,dz \) and
754 \(\prod_{\gamma\in\Gamma_{\widetilde{C}}}
755 \partial(\widetilde{X}_\gamma)\); and also on display:
757 \begin{equation}
758 \begin{split}
759 %%     This line is deliberately long so as to show
760 %%     differences in widths; it is a little over the measure
761 %%     in article/cmr.
762 \iiiint\limits_{\mathbf{Q}} f(w,x,y,z)\,dw\,dx\,dy\,dz  &\leq
763 \oint_{\bm{\partial Q}} f' \left( \max \left\lbrace
764 \frac{\lVert w \rVert}{\lvert w^2 + x^2 \rvert} ;
765 \frac{\lVert z \rVert}{\lvert y^2 + z^2 \rvert} ;
766 \frac{\lVert w \oplus z \rVert}{\lVert x \oplus y \rVert}
767 \right\rbrace\right)
768 \\
769 &\precapprox \biguplus_{\mathbb{Q} \Subset \bar{\mathbf{Q}}}
770 \left[ f^{\ast} \left(
771     \frac{\left\lmoustache\mathbb{Q}(t)\right\rmoustache}
772          {\sqrt {1 - t^2}}
773     \right)\right]_{t=\alpha}^{t=\vartheta}
774 \\
775 \end{split}
776 \end{equation}
778 For $x$ in the open interval \( \left] -1, 1 \right[ \)
779 the infinite sum in Equation~\eqref{eq:binom1} is convergent;
780 however, this does not hold
781 throughout the closed interval \( \left[ -1, 1 \right] \).
782 \begin{align}
783   (1 - x)^{-k} &=
784     1 + \sum_{j=1}^{\infty} (-1)^j \ibinom{k}{j} x^j
785     \quad \text{ for } k \in \mathbb{N}; k \neq 0.
786     \label{eq:binom1}
787 \end{align}

Example 8-8-10. Changed a little bit: it is currently not possible to put a \quad in a \text in math mode. Thus, the \text contains only the word `for´.

3.10. Sample page of mathematical typesetting

First some large operators both in text: Q f(x,y,z)dxdydz and γΓ C ˜ (X ˜ γ ); and also on display:

Q f(w,x,y,z)dwdxdydz Q f ' maxw |w 2 +x 2 |;z |y 2 +z 2 |;wz xy QQ ¯ f * Q(t) 1-t 2 t=α t=ϑ

For x in the open interval -1,1 the infinite sum in Equation (32) is convergent; however, this does not hold throughout the closed interval -1,1.

(1-x) -k =1+ j=1 (-1) j k jx j forkN;k0.(32)

Other examples here omitted.

3.11. Symbols in formulas

788 \[ a          \#          \top _x^\alpha x^\alpha_b \]
789 \[ a \mathrel{\#} \mathop{\top}_x^\alpha x^\alpha_b \]
790 \thinmuskip=10mu \medmuskip=17mu \thickmuskip=30mu
791 \[ a  -  b  =  -\max \{ x , y \}\]

Example 8-9-1. In this example, \# and \top are changed into a Rel and a Op operator, so that <msub> or <mover> is used in the translation, but in the current version of Tralics, no information is attached to the symbol.

a# x α x b α
a# x α x b α

Example 8-9-2. This example demonstrates that spacing in math formulas depend on three registers that the user can change, but the value is ignored by Tralics.


Example 8-9-3. This demonstrates that different spacing is used for \bigl/\bigr or \left/\right. Tralics tries very hard to convert big open/close pairs to left-right ones.

792 \thinmuskip=10mu \medmuskip=17mu \thickmuskip=30mu
793 \[ a \Bigl( \sum x \Bigr) \neq  a \left( \sum x \right) \]
a xax
794 \DeclareMathSymbol\bneg   {\mathbin}{symbols}{"3A}
795 \DeclareMathSymbol\rsquare{\mathrel}{AMSa}{"03}
796 \[ a \neg b           \qquad  x \square           y + z \]
797 \[ a \mathbin{\neg} b \qquad  x \mathrel{\square} y + z \]
798 \[ a \bneg          b \qquad  x \rsquare          y + z \]

Example 8-9-4. This example demonstrates that 1) spacing is wrong if an ordinary symbol is used instead of a binary symbol, 2) adding \mathrel or \mathbin in Tralics does not change this behavior, 3) using the declare-something command is not enough in Tralics: no error is signaled, but no symbol appears.

799 \[  a = b  \text{ but }  a \tilde{=} b
800    \text{ which is not } a \mathrel{\tilde{=}} b  \]

Example 8-9-5. This example indicates how embellished operators can have type Rel or whatever. As usual, nothing special is added to the XML file. This means that the equal-with-hat should be a relation in the HTML file, an ordinary symbol in the Pdf version.

a=bbuta= ˜bwhichisnota= ˜b
801 $ u \not< v$ or $a \not\in \mathbf{A} $,
802 {\makeatletter\let\not\@@not $ u \not< v$ or $a \not\in \mathbf{A} $}
803 $ \not\leq \ \not\succeq \ \not\sim $ $ \nleq \ \nsucceq \ \nsim $

Example 8-9-6. By default \not< is translated at \neg<; this is wrong, so that we redefined it. The only trouble is that \not\in does not work. We show here both behaviors:

uX<v or aXA, u¬<v or aA

Example 8-9-7. This is not really good. XXX and X

804 $\Longarrownot\longleftrightarrow \qquad  \arrownot\hookleftarrow$

Example 8-9-8, demonstrating how to negate an arrow XX, this is not implemented in Tralics.

Table 3. Symbols of class \mathbin, miscellaneous
* * + + - -
⨿ \amalg * \ast \baro
\barwedge X \bbslash \bigtriangledown
\bigtriangleup \Cap \cap
\Cup \cup \curlyvee
\curlywedge \dag \dagger
\ddag \ddagger \diamond
\divideontimes ÷ \div \dotplus
\doublecap \doublecup X \fatbslash
\fatsemi X \fatslash \gtrdot
\intercal \interleave \land
X \lbag \leftslice \leftthreetimes
\lessdot \lor \ltimes
\merge X \minuso X \moo
\mp X \nplus ± \pm
X \rbag \rightslice \rightthreetimes
\rtimes \setminus \smallsetminus
\sqcap \sqcup \sslash
\star ⫿ \talloblong × \times
\triangleleft \triangleright \uplus
\varbigtriangledown \varbigtriangleup \varcurlyvee
\varcurlywedge × \vartimes \veebar
\vee \wedge \wr
X \Ydown X \Yleft X \Yright
X \Yup
Table 4. Symbols of class \mathrel, (arrows)
\circlearrowleft \circlearrowright \curvearrowleft
\curvearrowright \dasharrow \dashleftarrow
\dashrightarrow \Downarrow \downarrow
\downdownarrows \downharpoonright \gets
\hookleftarrow \hookleftarrow \hookrightarrow
\Leftarrow \leftarrow \leftarrowtail
\leftarrowtriangle \leftrightarrowtriangle \leftharpoondown
\leftharpoonup \leftleftarrows \Leftrightarrow
\leftrightarrows \leftrightarrow \leftrightharpoons
\leftrightsquigarrow \Lleftarrow \Longleftarrow
\longleftarrow \Longleftarrow \longleftrightarrow
\Longmapsfrom \longmapsfrom \Longmapsto
\longmapsto \Longrightarrow \longrightarrow
\looparrowleft \looparrowright \Lsh
\Mapsfrom \mapsfrom \Mapsto
\mapsto \multimap \nearrow
\nwarrow \restriction \rightarrowtail
\rightarrowtriangle \Rightarrow \rightarrow
\rightharpoondown \rightharpoonup \rightleftarrows
\rightleftharpoons \rightrightarrows \rightsquigarrow
\Rrightarrow \Rsh \searrow
\shortdownarrow \shortleftarrow \shortrightarrow
\shortuparrow \swarrow \to
\twoheadleftarrow \twoheadrightarrow \Uparrow
\uparrow \upharpoonleft \upharpoonright
\Updownarrow \updownarrow \upuparrows
Table 5. Symbols of class \mathrel, (arrows, continued)
X \curlyveedownarrow X \curlyveeuparrow X \curlywedgedownarrow
X \curlywedgeuparrow X \nnearrow X \nnwarrow
X \ssearrow X \sswarrow
Table 6. Symbols of class \mathord, Greek
Δ \Delta Γ \Gamma Λ \Lambda Ω \Omega Φ \Phi
Π \Pi Ψ \Psi Σ \Sigma Θ \Theta Υ \Upsilon
Ξ \Xi α \alpha β \beta χ \chi δ \delta
ϝ \digamma ϵ \epsilon η \eta γ \gamma ι \iota
κ \kappa λ \lambda μ \mu ν \nu ω \omega
φ \phi π \pi ψ \psi ρ \rho σ \sigma
τ \tau θ \theta υ \upsilon ε \varepsilon ϰ \varkappa
ϕ \varphi ϖ \varpi ϱ \varrho ς \varsigma ϑ \vartheta
ξ \xi ζ \zeta
Table 7. Symbols of class \mathord, letter-shaped
$ \$ \Im \Re \aleph
k \Bbbk \beth \circledS \complement
\daleth \ell ð \eth \Finv
\Game \gimel \hbar \hslash
ı \imath j \jmath $ \mathdollar \mathparagraph
§ \mathsection £ \mathsterling \mho \P
\partial £ \pounds § \S \wp
Table 8. Symbols of class \mathord, miscellaneous
! ! . . / / ? ?
@ @ | | # \# % \%
& \& _ \_ \| \angle
\Arrowvert | \arrowvert \backprime \backslash
| \bracevert \bigstar \blacklozenge \blacksquare
\blacktriangledown \blacktriangle \bot \clubsuit
© \copyright \diagdown \diagup \diamondsuit
\emptyset \exists \flat \forall
\heartsuit \infty \lightning ¬ \lnot
\lozenge \measuredangle \nabla \natural
¬ \neg \nexists ' \prime \sharp
\spadesuit \sphericalangle \square \surd
\top \triangledown \triangle © \varcopyright
\varnothing \Vert | \vert
Table 9. Mathematical accents
x ´ \acute{x} x ¯ \bar{x} x ˘ \breve{x} x ˇ \check{x}
x \ddddot{x} x \dddot{x} x ¨ \ddot{x} x ˙ \dot{x}
x ` \grave{x} x ^ \hat{x} x ˚ \mathring{x} x ˜ \tilde{x}
x \vec{x} xyz ^ \widehat{xyz} xyz ˜ \widetilde{xyz}
Table 10. Symbols of class \mathbin, (boxes)
\boxast X \boxbar \boxbox \boxbslash \boxcircle \boxdot
\boxempty \boxminus \boxplus \boxslash \boxtimes \oblong
Table 11. Symbols of class \mathbin, (circles)
\bullet · \cdot \centerdot \bigcirc
\circledast \circledcirc \circleddash \circ
\oast \obar \ocircle \obar
\odot \ogreaterthan \olessthan \ominus
\oplus \oslash \otimes X \ovee
X \owedge \varobslash \varocircle \varodot
\varogreaterthan \varolessthan \varominus \varoplus
\varoslash \varotimes X \varovee X \varowedge
Table 12. Symbols of class \mathrel, (equality and order)
< < = = > > \approxeq
\approx \asymp \backsimeq \backsim
\Bumpeq \bumpeq \circeq \cong
\curlyeqprec \curlyeqsucc \Doteq \doteqdot
\doteq \eqcirc \eqsim \eqslantgtr
\eqslantless \equiv \fallingdotseq \geqq
\geqslant \geq \ge \gggtr
\ggg \gg \gtrapprox \gtreqless
\gtreqqless \gtrless \gtrsim X \leftrightarroweq
\leqq \leqslant \leq \lessapprox
\lesseqgtr \lesseqqgtr \lessgtr \lesssim
\le \llless \lll \ll
\precapprox \preccurlyeq \preceq \prec
\risingdotseq \simeq \sim \succapprox
\succcurlyeq \succeq \succsim \succ
\thickapprox \thicksim \triangleq
Table 13. Symbols of class \mathrel, (equality and order—negated)
\gnapprox \gneqq \gneq \gnsim
X \gvertneqq \lnapprox \lneqq \lneq
\lnsim X \lvertneqq \ncong \neq
\ne \ngeqq \ngeqslant \ngeq
\ngtr \nleqq \nleqslant \nleq
\nless X \npreceq \nprec \nsim
X \nsucceq \nsucc \precnapprox \precneqq
\precnsim \precsim \succnapprox \succneqq
Table 14. Symbols of class \mathrel, (sets and inclusions)
\blacktriangleleft \blacktriangleright \inplus
\in \niplus \ni
\ntriangleleftsqslant \ntrianglerightsqslant \owns
\sqsubseteq \sqsubset \sqsupseteq
\sqsupset \Subset \Supset
\subseteqq \subseteq X \subsetpluseq
X \subsetplus \subset \supseteqq
\supseteq X \supsetpluseq X \supsetplus
\supset \trianglelefteq \trianglerighteq
X \trianglerighteqslant X \trianglelefteqslant \vartriangleleft
\vartriangleright X \vartriangle
Table 15. Symbols of class \mathpunct, \mathord, \mathinner (punctuation)
, ,    \cdots    \hdots    ... \ldots    ... \mathellipsis
; ; : \colon \ddots \vdots
Table 16. Symbols of class \mathrel, (sets and inclusions—negated)
\notin X \nsubseteqq \nsubseteq X \nsupseteqq
\nsupseteq \ntrianglelefteq \ntriangleleft \ntrianglerighteq
\ntriangleright \subsetneqq \subsetneq \supsetneqq
X \varsubsetneqq X \varsubsetneq X \varsupsetneqq X \varsupsetneq
Table 17. Symbols of class \mathrel, (arrows—negated)
\nLeftarrow       \nLeftrightarrow       \nRightarrow
\nleftarrow \nleftrightarrow \nrightarrow
Table 18. Symbols of class \mathrel, (negation and arrow extensions). These are currently unimplemented.
X \Arrownot X \Longarrownot X \Mapsfromchar X \Mapstochar
X \arrownot X \longarrownot X \mapsfromchar X \mapstochar
X \lhook X \not X \rhook
Table 19. Symbols of class \mathrel (miscellaneous). Symbols short-foo, small-foo, var-foo not implemented.
: : ϶ \backepsilon \because \between
\bowtie \dashv \frown \Join
\mid \models \nmid \nparallel
X \nshortmid X \nshortparallel \nVDash \nvDash
\nVdash \nvdash \parallel \perp
\pitchfork \propto X \shortmid X \shortparallel
X \smallfrown X \smallsmile \smile \therefore
X \varpropto \Vdash \vDash \vdash
Table 20. Symbol pairs of class \mathop
\int \oint \bigbox
\bigcap \bigcup \bigcurlyvee
\bigcurlywedge \biginterleave XX \bignplus
\bigodot \bigoplus \bigotimes
\bigparallel \bigsqcap \bigsqcup
\bigtriangledown \bigtriangleup \biguplus
\bigvee \bigwedge \coprod
\prod \smallint \sum
Table 21. Symbol pairs of class \mathopen and \mathclose extensible. \bgroup and \lgroup wrong on HTML, not better in Pdf. Moustaches not good in Pdf.
[(] [] {(} \{\} ( \lVert\rVert
[(] \lbrack\rbrack {(} \lbrace\rbrace |(| \lvert\rvert
( \lceil\rceil (() () ( \lgroup\rgroup
( \lfloor\rfloor ( \langle\rangle ( \lmoustache\rmoustache
( \llbracket\rrbracket
Table 22. Symbol pairs of class \mathopen and \mathclose non-extensible> Lets of symbols missing in Unicode
XX \llceil\rrceil & \binampersand\bindnasrepma XX \Lbag\Rbag
XX \llfloor\rrfloor \llparenthesis\rrparenthesis
Table 23. Latin letters and arabic numerals

4. Other Examples

805 \def\EXP{\frac{x^1_2}3Foo}
806 \[\dfrac {\EXP1}{\phantom{\EXP}1}=\dfrac {\EXP1}{\hphantom{\EXP}1}=\dfrac21=
807 \dfrac{\EXP1}{\EXP1}=
808 \dfrac{\EXP1}{\vphantom{\EXP}1}\]

Example of a \phantom, a \hphantom and a \vphantom. In the case of a \hphantom, the 1 should be vertically aligned as in the case of 2/1, otherwise should be aligned as in the case E/E (where E is the big expression); in the case of a \vphantom, it should be centered otherwise flushed right (aligned with the numerator).

x 2 1 3Foo1 x 2 1 3Foo1=x 2 1 3Foo1 x 2 1 3Foo1=2 1=x 2 1 3Foo1 x 2 1 3Foo1=x 2 1 3Foo1 x 2 1 3Foo1

Test of multiscripts: F10, F1234abcd, F123456abcdef,

809 \[\sideset{}{_d^c}\sum _xy \qquad \sideset{^a_b}{}\sum _xy \qquad
810 \sideset{'^a}{^c}\sum_xy\qquad \sideset{_b}{_d}\sum_xy \qquad
811 \sideset{^{aA}_{bB}}{^{cC}_{dD}}\sum_xy
812 \]

More examples of sideset

dc x yba x yc'a x ydb x ydDcCbBaA x y

Differences between \uplus and \biguplus. Consider the following input lines.

813 \[{\uplus a}, {\uplus _ab}, {\mathop \uplus_ab}, {\mathop \uplus\limits_ab} \]
814 \[{x\uplus a}, {x\uplus _ab}, {x\mathop \uplus_ab}, {x\mathop \uplus\limits_ab} \]

Initial code

a, a b, a b, a b(33)
xa,x a b,x a b,x a b(34)

Unicode character U+2A04 used instead of \uplus.

a, a b, a b, a b(35)
xa,x a b,x a b,x a b(36)

In Tralics 2.9.4, translation of \uplus was a character &uplus;, translation of \biguplus was &biguplus;, characters U+22E8 (multiset union) and U+2A04 (n-ary union operator with plus). Thus lines 33 and 34 correspond to \uplus, while lines 35 and 36 correspond to \biguplus. On FL, I see a big operator on line 33, a smaller one on line 34 (the version without index being smaller than the other ones), and small operators on lines 35 and 36. On FM, I see a very big operator on line 33, a small one on line 34, question marks on lines 35 and 36, and Amaya gives the same for35 and 36. Thus, translation of \biguplus seems to be wrong. Thus, we changed it: in Tralics 2.9.5, \biguplus is the same character as \uplus. Same formulas as above, with command \biguplus used instead of \uplus

a, a b, a b, a b(37)
xa,x a b,x a b,x a b(38)

Same, with \textstyle

a, a b, a b, a b(39)
xa,x a b,x a b,x a b(40)
815 \[ A\xleftarrow{u}B\xleftarrow[d]{}C\xleftarrow[d]{u}
816    D\xrightarrow{u}E\xrightarrow[d]{}F\xrightarrow[d]{u}G \]

This example shows the use of \xleftarrow and \xrightarrow. Optional argument below the arrow, mandatory argument below.

A uB dC d uD uE dF d uG
817 \[\begin{CD}
818 @.  0               @.     0\\
819 @.       @VVV                @VVV\\
820 0 @>>> D^{1 \times q} @>.R>> D^{1 \times p} @>\pi>> M @>>> 0\\
821 @.     @|  @VV.UV\\
822 0 @>>> D^{1 \times q} @>.J>> D^{1 \times p} @>\kappa>> D^{1 \times (p-q)} @>>>0\\
823 @.       @VVV                @VVV\\
824 @.  0               @.     0\\
825 \end{CD}\]

This example shows how to produce a commutative diagram (adapted from [5])

000 D 1×q .RD 1×p πM 0.U.U0 D 1×q .JD 1×p κD 1×(p-q) 000
826 \[\begin{CD}
827 @.  0               @.     0\\
828 @.       @VLLVV                @VVDV\\
829 0 @<\mathrm{above}<< D      @))\mathrm{below}) D @>\mathrm{above}>\mathrm{below}> 0\\
830 @.     @\vert  @VLLVDV\\
831 @.  0               @.     0\\
832 \end{CD}\]

A variant that shows how to put data above and below the arrows.

00LLLLDD0 above D below D below above 0DLLDLL00

Some formulas that were badly rendered: u(t)=1 2(x ˙ 1 (t-h)-x ¨ 1 (t)), z 2 (t)=-1 2(ψ ¨(t)+2ψ(t)), v(t)=1 2(-ψ ¨(t)+ψ ˙(t)).

More formulas: formula A: u(t)=1 2, formula B: u(t)=1 2, formula C: u(t)=1 2, formula D: u(t)=1 2, and finally u(t)=1 2+1. Using display style 1 2(x(1)+ψ(t))

4.1. The connexion examples

These are example where Tralics 2.10.5 produces the wrong size for closing delimiters.

Example 1: d fine ' ={d j,λ ' } λΔ J-1 Δ j max and

d fine ' ={d j,λ ' } λΔ J-1 Δ j max

Example 2: μ 1 (d)=d(1-e -d 2 /2 ) -1 -2d -1 .

Example 3: a k * (a n ) p k -1 p .

Example 4: σ n (x) p Cn -r x w l τ ,1 τ=r+1 p.

Example 5: #Λ k 2 (-k-1)p c j Λ k |c j | p f X p p and

#Λ k 2 (-k-1)p c j Λ k |c j | p f X p p .

Example 6: d n (K) X E n (K) X .

Example 7: ||x-ΔΦ(x)|| 2 Cσ k (x) 1 k.

Example 8: smaller parens f ¯(n λA) versus larger parens f(n Aλ).

Example 9:

||η 0 || 2 C 2 2 k j=2 s ||η T j-1 +η T j || 1 C 2 2 k j=2 s ||η T j-1 || 1 +||η T j || 1 2C 2 2 k j=1 s ||η T j || 1 2C 2 2 kσ 2k (η) 1 .(41)

4.2. Test of brackets

833 $\bra{X}=\bra{x^2}=\ket{Y}=\ket{y^2} = \braket{X|Y}=\braket{x^2| y^2}$
834 $\Bra{X}=\Bra{x^2}=\Ket{Y}=\Ket{y^2} = \Braket{X|Y}=\Braket{x^2| y^2}$
835 $\Braket{x|y||z}$, $\Braket{x\|y|z}$
836 $\Braket{x+x_2|y+y^3||z+z^4+-5}$, $\Braket{x+x_2\|y+y^2|z+z^4_5}$
837 $   \Braket{ \phi | \frac{\partial^2}{\partial t^2} | \psi } $
838 $   \Set{ x\in\mathbf{R}^2 | 0<{|x|}<5 }$

Formula one X|=x 2 |=|Y=|y 2 =X|Y=x 2 |y 2

Formula two X=x 2 =Y=y 2 =X|Y=x 2 |y 2

Formula three x|yz, xy|z

Formula four x+x 2 |y+y 3 z+z 4 +-5,

Formula five x+x 2 y+y 2 |z+z 5 4 .

These are from the style file φ| 2 t 2 |ψ and xR 2 |0<|x|<5.

4.3. Recursion test

|f| 2 -|p n q n | 2 L (T) <ε,
g L 2 (dμ) 2 =1 2π -π π |g(e iθ )| 2 dμ(θ),
letting:E n,m (K,K ' )={pP m (K),qP n (K ' )suchthatxI,p(x) q(x)1},

5. Font tests

We assume that the property of each math font is one (later one we shall set it to zero), and the translation of a character is an ASCII character with an attribute. Otherwise, it is a Unicode character between U+1D400 and U+1F7FF. In our test we use internal font commands like \mml@font@italic.

839 \def\F#1{\mbox{#1: }\csname mml@font@#1\endcsname}
840 \def\La{AB=c+1+23}
842 \def\Lc{$\Lx abcde$ $\Lx fghijklm$ $\Lx nopqrs$ $\Lx tuvwxyz$}
843 \def\Ld{0123456789}
844 \def\Test#1{\par Test of #1: \def\Lx{\csname mml@font@#1\endcsname}
845   $\Lx\La$, $\Lx\Lb$, \Lc, $\Lx\Ld$.}
847 \Test{normal}
848 \Test{upright}
849 \Test{bold}
850 \Test{italic}
851 \Test{bolditalic}
852 \Test{script}
853 \Test{boldscript}
854 \Test{fraktur}
855 \Test{doublestruck}
856 \Test{boldfraktur}
857 \Test{sansserif}
858 \Test{boldsansserif}
859 \Test{sansserifitalic}
860 \Test{sansserifbolditalic}
861 \Test{monospace}

Test of normal: AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

Test of upright: AB =c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ , abcde fghijklm nopqrs tuvwxyz , 0123456789.

Test of bold: AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

Test of italic: AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

Test of bolditalic: AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

Test of script: AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

Test of boldscript: AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

Test of fraktur: AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

Test of doublestruck: AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

Test of boldfraktur: AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

Test of sansserif: AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

Test of boldsansserif: AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

Test of sansserifitalic: AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

Test of sansserifbolditalic: AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

Test of monospace: AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

In the Pdf version, we have problems with script and bold script for lower letters and digits. In the MTML version, Firefox has no script, fraktur or double struck font.

862 \mathfontproperty0=0
863 \mathfontproperty1=0
864 \mathfontproperty2=0
865 \mathfontproperty3=0
866 \mathfontproperty4=0
867 \mathfontproperty5=0
868 \mathfontproperty6=0
869 \mathfontproperty7=0
870 \mathfontproperty8=0
871 \mathfontproperty9=0
872 \mathfontproperty10=0
873 \mathfontproperty11=0
874 \mathfontproperty12=0
875 \mathfontproperty13=0
876 \mathfontproperty14=0

Test of normal: AB=c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ, abcde fghijklm nopqrs tuvwxyz, 0123456789.

Test of upright: AB =c+1+23, ABCDEFGHIJKLMNOPQRSTUVWXYZ , abcde fghijklm nopqrs tuvwxyz , 0123456789.

Test of bold: 𝐀𝐁=𝐜+1+23, 𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙, 𝐚𝐛𝐜𝐝𝐞 𝐟𝐠𝐡𝐢𝐣𝐤𝐥𝐦 𝐧𝐨𝐩𝐪𝐫𝐬 𝐭𝐮𝐯𝐰𝐱𝐲𝐳, 0123456789.

Test of italic: 𝐴𝐵=𝑐+1+23, 𝐴𝐵𝐶𝐷𝐸𝐹𝐺𝐻𝐼𝐽𝐾𝐿𝑀𝑁𝑂𝑃𝑄𝑅𝑆𝑇𝑈𝑉𝑊𝑋𝑌𝑍, 𝑎𝑏𝑐𝑑𝑒 𝑓𝑔ℎ𝑖𝑗𝑘𝑙𝑚 𝑛𝑜𝑝𝑞𝑟𝑠 𝑡𝑢𝑣𝑤𝑥𝑦𝑧, 0123456789.

Test of bolditalic: 𝑨𝑩=𝒄+1+23, 𝑨𝑩𝑪𝑫𝑬𝑭𝑮𝑯𝑰𝑱𝑲𝑳𝑴𝑵𝑶𝑷𝑸𝑹𝑺𝑻𝑼𝑽𝑾𝑿𝒀𝒁, 𝒂𝒃𝒄𝒅𝒆 𝒇𝒈𝒉𝒊𝒋𝒌𝒍𝒎 𝒏𝒐𝒑𝒒𝒓𝒔 𝒕𝒖𝒗𝒘𝒙𝒚𝒛, 0123456789.

Test of script: 𝒜ℬ=𝒸+1+23, 𝒜ℬ𝒞𝒟ℰℱ𝒢ℋℐ𝒥𝒦ℒℳ𝒩𝒪𝒫𝒬ℛ𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵, 𝒶𝒷𝒸𝒹ℯ 𝒻ℊ𝒽𝒾𝒿𝓀𝓁𝓂 𝓃ℴ𝓅𝓆𝓇𝓈 𝓉𝓊𝓋𝓌𝓍𝓎𝓏, 0123456789.

Test of boldscript: 𝓐𝓑=𝓬+1+23, 𝓐𝓑𝓒𝓓𝓔𝓕𝓖𝓗𝓘𝓙𝓚𝓛𝓜𝓝𝓞𝓟𝓠𝓡𝓢𝓣𝓤𝓥𝓦𝓧𝓨𝓩, 𝓪𝓫𝓬𝓭𝓮 𝓯𝓰𝓱𝓲𝓳𝓴𝓵𝓶 𝓷𝓸𝓹𝓺𝓻𝓼 𝓽𝓾𝓿𝔀𝔁𝔂𝔃, 0123456789.

Test of fraktur: 𝔄𝔅=𝔠+1+23, 𝔄𝔅ℭ𝔇𝔈𝔉𝔊ℌℑ𝔍𝔎𝔏𝔐𝔑𝔒𝔓𝔔ℜ𝔖𝔗𝔘𝔙𝔚𝔛𝔜ℨ, 𝔞𝔟𝔠𝔡𝔢 𝔣𝔤𝔥𝔦𝔧𝔨𝔩𝔪 𝔫𝔬𝔭𝔮𝔯𝔰 𝔱𝔲𝔳𝔴𝔵𝔶𝔷, 0123456789.

Test of doublestruck: 𝔸𝔹=𝕔+1+23, 𝔸𝔹ℂ𝔻𝔼𝔽𝔾ℍ𝕀𝕁𝕂𝕃𝕄ℕ𝕆ℙℚℝ𝕊𝕋𝕌𝕍𝕎𝕏𝕐ℤ, 𝕒𝕓𝕔𝕕𝕖 𝕗𝕘𝕙𝕚𝕛𝕜𝕝𝕞 𝕟𝕠𝕡𝕢𝕣𝕤 𝕥𝕦𝕧𝕨𝕩𝕪𝕫, 0123456789.

Test of boldfraktur: 𝕬𝕭=𝖈+1+23, 𝕬𝕭𝕮𝕯𝕰𝕱𝕲𝕳𝕴𝕵𝕶𝕷𝕸𝕹𝕺𝕻𝕼𝕽𝕾𝕿𝖀𝖁𝖂𝖃𝖄𝖅, 𝖆𝖇𝖈𝖉𝖊 𝖋𝖌𝖍𝖎𝖏𝖐𝖑𝖒 𝖓𝖔𝖕𝖖𝖗𝖘 𝖙𝖚𝖛𝖜𝖝𝖞𝖟, 0123456789.

Test of sansserif: 𝖠𝖡=𝖼+1+23, 𝖠𝖡𝖢𝖣𝖤𝖥𝖦𝖧𝖨𝖩𝖪𝖫𝖬𝖭𝖮𝖯𝖰𝖱𝖲𝖳𝖴𝖵𝖶𝖷𝖸𝖹, 𝖺𝖻𝖼𝖽𝖾 𝖿𝗀𝗁𝗂𝗃𝗄𝗅𝗆 𝗇𝗈𝗉𝗊𝗋𝗌 𝗍𝗎𝗏𝗐𝗑𝗒𝗓, 0123456789.

Test of boldsansserif: 𝗔𝗕=𝗰+1+23, 𝗔𝗕𝗖𝗗𝗘𝗙𝗚𝗛𝗜𝗝𝗞𝗟𝗠𝗡𝗢𝗣𝗤𝗥𝗦𝗧𝗨𝗩𝗪𝗫𝗬𝗭, 𝗮𝗯𝗰𝗱𝗲 𝗳𝗴𝗵𝗶𝗷𝗸𝗹𝗺 𝗻𝗼𝗽𝗾𝗿𝘀 𝘁𝘂𝘃𝘄𝘅𝘆𝘇, 0123456789.

Test of sansserifitalic: 𝘈𝘉=𝘤+1+23, 𝘈𝘉𝘊𝘋𝘌𝘍𝘎𝘏𝘐𝘑𝘒𝘓𝘔𝘕𝘖𝘗𝘘𝘙𝘚𝘛𝘜𝘝𝘞𝘟𝘠𝘡, 𝘢𝘣𝘤𝘥𝘦 𝘧𝘨𝘩𝘪𝘫𝘬𝘭𝘮 𝘯𝘰𝘱𝘲𝘳𝘴 𝘵𝘶𝘷𝘸𝘹𝘺𝘻, 0123456789.

Test of sansserifbolditalic: 𝘼𝘽=𝙘+1+23, 𝘼𝘽𝘾𝘿𝙀𝙁𝙂𝙃𝙄𝙅𝙆𝙇𝙈𝙉𝙊𝙋𝙌𝙍𝙎𝙏𝙐𝙑𝙒𝙓𝙔𝙕, 𝙖𝙗𝙘𝙙𝙚 𝙛𝙜𝙝𝙞𝙟𝙠𝙡𝙢 𝙣𝙤𝙥𝙦𝙧𝙨 𝙩𝙪𝙫𝙬𝙭𝙮𝙯, 0123456789.

Test of monospace: 𝙰𝙱=𝚌+1+23, 𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉, 𝚊𝚋𝚌𝚍𝚎 𝚏𝚐𝚑𝚒𝚓𝚔𝚕𝚖 𝚗𝚘𝚙𝚚𝚛𝚜 𝚝𝚞𝚟𝚠𝚡𝚢𝚣, 0123456789.

The Pdf version should be the same. The HTML version is different; only characters in the BMP are shown (for instance, the set of integers, complex numbers, etc, are often represented using a blackboard font, using characters U+2124, U+2102, these are not repeated at U+1D551 and UD1D3A).

Testing internal commands that read/write math font properties.

877 \def\entity#1{\xmllatex{\&\#x#1;}{}}
878 \makeatletter
879 \mathfontproperty2=3 $\mathbf{x}$
880 Font property:\the\mathfontproperty\mml@font@bold,
881 Character propery:\the\setmathchar\mathbf`x.\\
882 \mathfontproperty\mathbf=0
883 Bold x: \setmathchar\mathbf`x={\entity{1d431}}$\mathbf{x}$
884 ComplexC: \setmathchar\mathbf`c={\entity{2102}}$\mathbf{c}$
885 \setmathchar 5 6 7 ok

x Font property:1, Character property:&#x1D431;. Bold x: 𝐱 ComplexC: ok

6. Examples from the MathML recommendation

Examples and italic text taken from [4] (Mathematical Markup Language (MathML) Version 2.0, W3C recommendation 21 October 2003.

6.1. Introduction

886 \newcommand\Apply[2]{\mathbox{apply}{\mathbox{#1}{}#2}}
887 $\mathbox{mfenced}{{a+b}}^2$  % F1
888 $\Apply{power}{\Apply{plus}{\mathci{a}\mathci{b}} \mathcn{2}}$ %F2
889 ${(a+b)}^2$ % F3

The four lines above show a command and three math formulas, representing the square of the sum of a and b. The MathML recommendation, in its introduction, explains that there are three types of elements: presentation elements (formula F1) and content elements (formula F2), as well as interface elements (the toplevel <math> element, not discussed here). In any case, a formula is a tree; leafs are token elements or canonically empty elements. The main difference between these two types is the following: in the case of formula F2, there is a possibility to evaluate the formula, for instance, with a=2 and b=3, this should yield 25. In the case of F1, we have a formula with a superscript; in a case like x 2 , it is impossible to tell if this means the square of the variable x, or the second component of the vector x.

In the example F3, there are five leafs, two identifiers, a number, two operators. The default translation is a token element in presentation markup. This means that the translation of `a´ is implicitly a <mi> obtained by \mathmi, instead of a <ci> obtained by \mathci. A non-trivial question is how to translate `xy25´ (the default is one or two identifiers, followed by a number). Our formulas contain characters that are neither letters nor digits: parenthesis, plus sign, superscript character. These are operators; in the case of presentation markup, an operator can be represented as a special element (<msup> for a construction base plus exponent), or a token element (a <mo> element for a sum). In the case of content markup, special element can be used (for instance <list>, or empty elements, like <plus/>.

In content markup, the sum of two objects is specified by a <apply> element, whose children are the operator <plus/> followed by the objects, and a list of three objects is represented by a <list> element whose children are the objects. In presentation markup, a sum is a sequence (an explicit or implicit <mrow> element) containing the arguments and operators in order. In the same fashion, a list can be defined as the sequence of all elements, plus the separators (opening parentheses, closing parentheses, commas, etc.); it can also be specified by a <mfenced> element, whose attributes define what is at the start of the list, the end of the list, and between the elements. These attributes have a default value adapted for lists, meaning that f(x,y,z) can be obtained by the juxtaposition of f and a <mfenced> element containing x, y and z. In the case of formula F1, the content of <mfenced> element is the translation of {a+b}; because of the braces this is a <mrow> element, with three children. Formulas F1 and F3 are equivalent: a base and an exponent, the base contains an opening parenthesis, the identifier a, the operator plus, the identifier b, and a closing parenthesis. The renderer gives a+b 2 .

The second formula renders as ab2. My Web browser knows only some of the operators; hence it is possible that you see the same as ab2. In the Pdf version, we implement the <apply> element as follows: first the operator, then the arguments as a list. We could do better, but all n-ary operators can have implicit arguments: it is possible to represent the sum of all f(x) such that x satisfies some condition, for instance, xN and x is a square. Since Tralics does not generate content markup, this is not implemented at all.

890 ${\mathbox{apply}{\mathbox{minus}{}\mathci{a}\mathci{b}}}$ %2.1.3

Simple example of presentation markup: ab. Note that the minus operator takes one or two arguments.

6.2. More complicated examples

891 ${x^2+{4\*x}+4}=0$

Rendering: x 2 +4x+4=0. Note the use of nested elements, to denote terms, for example, the left-hand side of the equation; this is obtained here by simply putting braces in the TeX source. The &InvisibleTimes; MathML character entity is used here to indicate to a renderer that there are special spacing rules between the 4 and the x and that the 4 and the x should not be broken onto separate lines. This special character can be obtained by the \* command whose meaning is: do not consider any special spacing rule, but allow a break here. We decide to translate \* in this way because it converts an invisible product into an invisible product. We do not believe in hyphenation for math formulas (inline formulas should be small, and not split, big formulas should be in display mode). Translation from XML to Pdf is empty for this character.

892 $x=\frac{{-b}\pm\sqrt{b^2-{4\* a\* c}}}{2\* a}$

Second example, x=-b±b 2 -4ac 2a. Notice that the `plus or minus´ sign is given by the entity name &PlusMinus; this is equivalent to using the character reference &#00B1;. When converting an XML document into Pdf, the character reference is required (notice that the style sheet that converts from XML to XSL/FO replaces entity names by character references, so that this is not a problem). On the other hand, there are cases where entity names are refused in a HTML document: if that document is presented as XML, and the DTD makes no reference to MathML (this very document is likely to be XHTML1.0 strict).

893 $z\mathbox{mfenced}{{x+y}}$
894 $A=\begin{bmatrix}x&y\\z&w\end{bmatrix}$

Example three: zx+y. The MathML recommendation says that there is some ambiguity: what is the relation between z and the expression x+y that follows? implicit product or function application? A translator like Tralics cannot guess.

Example four A=xyzw. Most elements have a number of attributes that control the details of their screen and print rendering. The attributes for operator elements given using <mo> are set to default values determined by a dictionary. Translation of the environment is a <mfenced> element, with two attributes; all other attributes are ignored in the XML to Pdf conversion. No dictionary is currently used; translation of a <mo> is complicated: the difference between lim and is that we have a sequence of 3 ASCII characters, and a character reference (that could be given in base 10, in base 16, or directly as a UTF-8 character). The XML reader converts this into a command (with a complicated name) that expands to \sum, that expands to whatever is defined by the style files.

895 \def\Cx{\mathci{x}} \def\Dz{\mathcn{0}}
896 \def\Dt{\mathcn{2}} \def\Df{\mathcn{4}}
897 $\Apply{eq}{
898   \Apply{plus}{ \Apply{power}{\Cx\Dt} \Apply{times}{\Df\Cx}\Df}
899   \Dz}$

Example 2.3.2, content markup. x24x40 This example shows that content markup is sometimes easier.

900 \def\Ca{\mathci{a}}\def\Cb{\mathci{b}} \def\Cc{\mathci{c}}
901 \def\Cpm{\mathcsymbol{^^b1}}
902 $\Apply{eq}{
903    \Cx
904    \Apply{divide}{
905      \mathbox{apply}{
906        \Cpm
907        \Apply{minus}{\Cb}
908        \Apply{root}{\mathbox{degree}{\Dt}
909           \Apply{minus}{
910             \Apply{power}{\Cb\Dt}
911             \Apply{times}{\Df\Ca\Cc}}}}
912      \Apply{times}{\Dt\Ca}}}$

Next example x±b2b24ac2a. This example has two interesting points. The first one is that some operators can have optional arguments (in this case, the default value 2 is used). The second point is that the first child of <apply> can be any function; in this example, it is a <csymbol> element (equivalent of <mo>), whose value is the character ± (that has to be entered as a character, not a command). Other content markup examples omitted.

913 $\mathbox{mrow}{\mathbox{apply}{\mathbox{eq}{}\mathci{A}
914 \mathbox{matrix}{\mathbox{matrixrow}{\mathci{x}\mathci{y}}
915 \mathbox{matrixrow}{\mathci{z}\mathci{w}}}}}$

Next example Axyzw. This example is badly rendered in the Pdf (matrix operators not implemented), and my favorite HTML browser shows the same result!

6.3. Presentation Markup

916 \def\X#1#2{\mathbox{#1}{\mathcnothing{\char32#2\char32}}}
917 $\X{mi}{x}\X{mo}{+}{\X{mi}{a}\X{mo}{/}\X{mi}{b}}$
918 $x+{a/b}$

Compare ` x + a / b ´ with `x+a/b´. These two examples should look the same; in the first case the content of each element is a space, a character, a space; for the second example, there are no spaces.

919 $\mathmi[fontweight][bold][mathvariant][normal]{a}$
920 $\mathmi[fontweight][bold][mathvariant][sans-serif]{a}$
921 $\mathmi[fontweight][bold][mathvariant][fraktur]{a1}$
922 $\mathbox{mstyle}[fontstyle][italic]{\mathbf{a}b}$

Deprecated styles: `a´ should be a normal a, `a´ should be a sans-serif a, and `a1´ should be fraktur. In the case of `ab´, the a should be bold upright, and the b should be italic. The MathML recommendation says that `mathvariant´ should have precedence over `fontstyle´, which is deprecated, and not used by Tralics. In the Pdf, attributes of \mstyle are currently ignored.

923 $x$ $\mathmi{\char32x\char32}$
924 $D$ $\mathmi{\char32sin\char32}$ $\mathmi[mathvariant][script]{L}$
925 $\mathmi{}$

Examples for 3.2.3: `x´ (an x without spaces), ` x ´ (an x with spaces), `D´, ` sin ´, ´L´ and `´ (empty identifier). An italic font should be used unless defined by an attribute, or an upright font if the element has more than one character. In the Pdf, spaces are incorreclty counted as characters.

926 $\sin(x)$ $\mathmi{sin}\ApplyFunction x$ $1+x+\mathmo{...}+n$
927 $1+x+\mathmi{...}+n$ $\pi, \ImaginaryI,\ExponentialE$

This is sin(x), using &ApplyFunction;, Unicode character U+2061: `sinx´. Ellipses using <mo>: `1+x+...+n´ and <mi>: `1+x+...+n´, constants π,, (these are somehow unusual in Pdf).

928 $2, \mathmn{0.123}, \mathmn{1,000,000}, \mathmn{2.1e10},
929 \mathmn{0xFFEF}, \mathmn{MCMLXIX}, \mathmn{twenty one}$.
930 $2+{3\*\ImaginaryI},\frac12, \pi, \ExponentialE$.

A <mathmn> element represents a number, typeset with an upright font, for instance 2, 0.123, 1,000,000, 2.1e10, 0xFFEF, MCMLXIX, twenty one. Numbers, that could be <mathcn> (content markup numbers), but are not <mathmn> (presentation markup numbers): 2+3,1 2,π,.

931 $+, <,\le, \mathmo{<=}, \mathmo{++}, \sum,\mathmo{.NOT}, \mathmo{and},
932 \*,\mathmo[mathvariant][bold]{+}$
933 $({a+b})$, $[{0,1})$, $f\ApplyFunction {({x,y})}$
934  $x\* y$, $f\ApplyFunction{(x)}$, $\sin\ApplyFunction x$
935 and $m_{1\InvisibleComma2}$.

Example of <mathmo> (operators): +,<,,<=,++,,.NOT,and,,+. In the Pdf version, font attributes are ignored for operators (they are complicated to implement, and only `bold´ variant is available with the current math fonts).

More examples: (a+b), [0,1), f(x,y).

Invisible operators: xy, f(x), sinx and m 12 .

936 $\frac{\DifferentialD}{\DifferentialD x}$

Embellishment x. The MathML recommendation says that the spacing around an embellished operator like + 4 should be the same as that of the operator at its core. An expression like 4 + is not an embellished operator, but phantoms are. More surprising: a fraction whose numerator is an operator is an embellished operator, the example shown here being the motivation.

937 $\underline{(}\frac ab \overline)$.
938 $\mathmo[maxsize][1]{(} \frac ab\mathmo[maxsize][1]{)}$,
939 $(\frac ab)$
940 $x\mathop\rightarrow\limits_{\mtext{ maps to }}y$

Stretching: ( ̲a b) ¯. With maxsize (a b), and without (a b). The rule is the following. An enbellished operator (for instance an underlined parenthesis) should stretch vertically, as it it were not embellished, this is not implemented in the Pdf. A maximum size can be given (either as a dimension, or a ratio to the default size, a value of 1 says that the operator should not stretch. Horizontal stretching: x maps to y. In the Pdf version, we have a normal arrow.

941 $\mtext{ Theorem 1: }$
942 $X\mathbox{mtext}{\mathcnothing{^^^^2009}}X$
943 $X\mathbox{mtext}{\mathcnothing{^^^^2009^^^^200a^^^^200a^^^^2009%
944 ^^^^200a^^^^200a}}X$'
945 $X\mkern10muX$
946 $X\mtext{ /* a comment */ }X$'
947 $\mathmo{ there exists }{{\delta>0}\mathmo{ such that
948 }{{f\ApplyFunction{(x)}}<1}}$

Text: ` Theorem 1: ´, `XX´ `X      X´ (expression obtained by inserting twice three characters: thickspace, thinspace and verythinspace, should be the same as `XX´, `X /* a comment */ X´. Other example: there exists δ>0 such that f(x)<1. The MathML rules say that initial and final space should be removed and consecutive space characters should be replaced by a single space character in elements like <mtext> or <mo>. This is not done in the Pdf version, and you will see the following: normally <mtext> is typeset via \text, and spaces are typeset as usual outside math mode; the default for all other operators is a math font, and spaces are ignored. A non-trivial question is: what amount of space is inserted between the `exists´ and the δ that follows? Firefox uses none, this is not good, TeX uses a small space, but ignores the space before it, the MathML recommendation is unclear, and the sample renderings of the MathML test suite show no space between two <mtext> elements or between a <mtext> and a comma.

949 ${x\mathbox{malignmark}[edge][right]{}}^2$

Alignment: x 2 . The empty element used in this formula is ignored in the Pdf version, (and, it seems, by my browser also). It defines an alignment mark, that is ignored outside tables. The idea is the following. If you want a table where all elements are centered, except for the first row, first column, and element at position (2,2), the easy way is to use a <mtable> element, specifying that alignment is left, center, etc, specify alternative alignment for the first row, or some specific elements. If this is not sufficient, an alternate method is provided. Typically each row contains a single cell, with some empty <maligngroup> elements. You can specify alignments for groups in the same way as alignment for cells, with two additions: if the group contains numbers, you can say that decimal points are aligned (there is an implicit point at the end of the group); moreover you can explicitly set a mark. In the example above, the mark is between the letter x and the superscript. Using a mark does not alter rendering of the expression.

950 $\mathbox{ms}{\mathcnothing{\&}}$
951 $\mathbox{ms}{\mathcnothing{\&amp;}}$
952 $\mathbox{ms}{\mathcnothing{double quote is "}}$
953 $\mathbox{ms}[lquote][aa][rquote][bb]{\mathcnothing{test}}$

Literals &, &amp;, double quote is ", test. This element is not yet correctly converted in Pdf. There should be some kind of quotes around the expression, the quotes may be given by attributes; my browser shows strange characters.

954 ${2\* x}+y-z$, $({x,y})$

Example of <mrow>: 2x+y-z, (x,y).

955 \[\frac{(\frac ab\mathattribute{linethickness}{0})\qquad
956 \frac ab}{\frac cd}\mathattribute{linethickness}{2}\qquad
957 \frac{1}{x^3+\frac x3} = \frac{1}{x^3+\frac x3}
958 \mathattribute{bevelled}{true}\qquad \frac{1+\sqrt 5}{2}
959 \]

Example of <mfrac>; if the bevelled attribute is true, a diagonal line should separate numerator and denoninator (not implemented in Pdf).

(a b)a b c d1 x 3 +x 3=1 x 3 +x 31+5 2
960 $\mathbox{mstyle}[maxsize][1]{(\frac ab)}$

Example of <mstyle>: (a b). Attributes of the element are used by children as default value. In the example, both opening and closing parentheses should use maxsize=1. This mechanism is not yet implemented in the Pdf.

961 $\mathbox{merror}{
962 \mtext{ Unrecognised element: mfraction; arguments were: }
963 {1+\sqrt5}\mtext{ and } 2}$

Error: Unrecognised element: mfraction; arguments were: 1+5 and 2.

964 \def\test{C\mathbox{mpadded}[width][0em]{\kern-0.3em\text{|}}}
965 $\test$, $\mathbox{semantics}
966 {\test\mathbox{annotation-xml}[encoding][MathML-Presentation]{\mathbb{C}}}$
967 $\mathbb{C}$
968 $\mathbox{mpadded}[width][0em]{C}\kern0.3em\text{|}$

Padding: C|, C|C. The previous expression contains two letters C with a vertical bar over it. None of them looks OK on my browser, because of the negative space. The Pdf version contains a third C because the <semantics> element is not implemented. The formula should mimic C. Positive padding C| is better in my browser.

969 $\frac{x+y+z}{x\phantom{\mathmo[form][infix]{+}y}+z}$
970 $\frac{x+y+z}{x\phantom{+}\phantom{y}+z}$

Phantom: x+y+z x+y+z and x+y+z x+y+z. These two expressions should produce the same result, the numerator and the denoninator have the same width. Said otherwise, spacing around the plus symbol (inside or outside phantom) should be that of a prefix plus operator if it is the first element in a row, followed by something else, should be infix if it is the sole element, or neither first nor last, should be postfix otherwise.

971 \def\mfence{\mathbox{mfenced}}
972 Fences: $\mfence{x}$, $(x)$, $\mfence{xy}$, $f\ApplyFunction\mfence{xy}$,
973 $(x,y)$, $\mfence{{a+b}}$, $\mfence[open][[]{0\relax1}$.
974 Wrong $\mfence{a+b}$, $\mfence{01}, \bf\mfence{xy}$,
975 right: $\bf\mfence{x y}$, $\bf\mfence{{x}{y}}$.

Fences: x, (x), xy, fxy, (x,y), a+b, 01. Wrong a+b, 01,xy, right: xy, xy. Note that separators do not show in the Pdf, so that it is unclear why some expressions are wrong.

The first expression is wrong, because the MathML documentation says that a <mrow> is necessary so that the <mfenced> has just one argument; a pair of braces should be added, this gives the \mrow. Examples that follow are wrong because `01´ or `xy´ produce a single <mn> or <mi> element; in the case of an identifier this may depend on the font. You can use a separator (space or \relax) or uses braces (no <mrow> is produced if there is a single element in the math list). Note: spaces are ignored in math mode; it is not completely clear whether or not a space is allowed as separator.

976 \[
977 \def\mtr{\mathbox{mtr}}
978 \def\mtdr{\mathbox{mtd}[columnalign][right]}
979 \def\ralign{\cellattribute{columnalign}{right}}
980 \def\X#1#2{\mathbox{menclose}[notation][#1]{#2}}
981 \mathbox{mtable}[columspacing][0pt][rowspacing][0pt]{
982   \mtr{\mathbox{mtd}{}\mtdr{10}}
983   \mtr{\mtdr{131}\mtdr{\X{longdiv}{1413}}}
984   \mtr{\mathbox{mtd}{}\mtdr{{\underline{131}\phantom{3}}}}
985   \mtr{\mathbox{mtd}{}\mtdr{103}}}
986 \qquad
987 a_{\X{actuarial}{n}\*i}
988 \qquad
989 \begin{array}{cc}
990   &\ralign10\\
991 \ralign131&\ralign\X{longdiv}{1413}\\
992   &\ralign \underline{131}\phantom{3}\\
993   &\ralign 103
994 \end{array}\mathattribute{columspacing}{0pt}\mathattribute{rowspacing}{0pt}
995 \]

Examples of menclose (Does not work in the Pdf or with Firefox; works with Amaya).

101311413131 ̲3103a ni 101311413131 ̲3103
996 $(x+y)^2$ ${(x+y)}^2$ $\int_0^1{\ExponentialE^x\*{\DifferentialD x}}$

Scripts: Compare (x+y) 2 (without braces) with (x+y) 2 (recommended), 0 1 x x

997 $\underbrace{x+y+z}\mathattribute{accentunder}{true} \text{~versus~}
998 \underbrace{x+y+z}\mathattribute{accentunder}{false}
999 $, $\hat x \text{~versus~}\hat x\mathattribute{accent}{false}$,
1000 $\overbrace{x+y+z}\mathattribute{accent}{true} \text{~versus~}
1001 \overbrace{x+y+z}\mathattribute{accent}{false}$,
1002 $\mathop{\int\limits_0}\limits^\infty \text{~versus~} \int\limits_0^\infty$

Underscript, overscripts: x+y+z versusx+y+z , x ^versusx ^, x+y+z versusx+y+z . Converting mathml to Pdf is not obvious because if a brace character is an accent-declared overscript, we must apply some command to the kernel. In order for this example to work, another command must be applied if the brace is non-accent (we use the same command, that´s simplier). In a case like 0 versus 0 there is no difference between an operator with underscript to which an overscript is added, and an operator with two scripts.

1003 $\mathbox{mmultiscripts}{F1\none\mathbox{mprescripts}{}0\none}
1004 \ApplyFunction{({;a;z})}$
1005 $\mathbox{mmultiscripts}{Ri\none\none jk \none l\none}$

Multiscripts: F10(;a;z) and Rijkl.

1006 $(\begin{array}{ccc}1&0&0\\0&1&0\\0&0&1\end{array})$,
1007 $\mathbox{mtable}{\mathbox{mlabeledtr}[id][e-is=m-c-square]{
1008 \mathbox{mtd}{\text{(2.1)}}
1009 \mathbox{mtd}{{E={m\*c^2}}}}}$.

Tables: a matrix (100010001), and an numbered equation: (2.1)E=mc 2 .

1010 $\def\X{\mathbox{maligngroup}{}}
1011 \def\A{{{\X\mathmn{8.44}\*\X x} \X +{\X \mathmn{55} \*\X y}}\X=\X0}
1012 \def\B{{{\X\mathmn{3.1} \*\X x} \X -{\X \mathmn{0.7}\*\X y}}\X=\X{-\mathmn{1.1}}}
1013 \mathbox{mtable}[groupalign][\char`\{decimalpoint left left decimalpoint left
1014 decimalpoint\char`\}]{
1015 \mathbox{mtr}{\mathbox{mtd}{{\A}}}
1016 \mathbox{mtr}{\mathbox{mtd}{{\B}}}}
1017 $

Alignment 8.44x+55y=03.1x-0.7y=-1.1. As explained above, this could be typeset, by aligning the \X. the material between two \X commands should be left-aligned, or aligned on the decimal point. In some cases, the \X is a direct child of the cell, but not always. For this reason, it is nearly impossible to typeset this correctlty in TeX.


[1] Thierry Bouche. A pdflatex-based automated journal production system. in « TUGboat », number 1, volume 27, 2006.

[2] David Carlisle. XMLTEX: A non validating (and not 100% conforming) namespace aware XML parser implemented in TeX. in « TUGboat », number 3, volume 21, 2000, pages 193-199.

[3] David Carlisle, Michel Goossens, Sebastian Rahtz. De XML à PDF avec xmltex et PassiveTeX. in « Cahiers Gutenberg », number 35-36, pages 79-114, 2000.

[4] David Carlisle, Patrick Ion, Robert Miner, Nico Poppelier (editors). Mathematical Markup Language (MathML) Version 2.0. 2001,

[5] Anna Fabiańska, Alban Quadrat. Applications of the Quillen-Suslin theorem to multidimensional systems theory. Rapport de recherche INRIA, number RR-6126, 2007,

[6] José Grimm. Tralics, a LaTeX to XML translator, Part I. Rapport Technique, number 309, Inria, 2006,

[7] José Grimm. Tralics, a LaTeX to XML translator, Part II. Rapport Technique, number 310, Inria, 2006,

[8] Donald E. Knuth. The TeXbook. Addison Wesley, 1984.

[9] Frank Mittelbach, Michel Goossens, Johannes Braams, David Carlisle, Chris Rowley. The LaTeX companion, second edition. Addison Wesley, 2004.

[10] Sebastian Rahtz. Passive TeX., 2003.

Table of Contents

1. Introduction
     1.1. Special features
     1.2. Compiling the example file
     1.3. Overview of math mode
2. Examples from the TEXbook
     2.1. Typing math formulas, TB 16
     2.2. More about Math, TB 17
     2.3. Fine points of Mathematics Typing, TB 18
          2.3.1. Punctuation
          2.3.2. Non-italics letters in formulas
          2.3.3. Spacing between formulas
          2.3.4. Spacing within formulas
          2.3.5. Ellipses
          2.3.6. Line breaking
          2.3.7. Braces
          2.3.8. Matrices
          2.3.9. Vertical Spacing
          2.3.10. Special features for math hackers
          2.3.11. Summary
     2.4. Displayed Equations, TB19
          2.4.1. One-line displays
          2.4.2. Multi-line displays
          2.4.3. Long formulas
3. Higher Mathematics, TLC2
     3.1. Introduction to amslatex
     3.2. Display and alignment structures for equations
     3.3. Matrix-like environments
     3.4. Compound structures and decorations
     3.5. Variable symbol commands
     3.6. Words in mathematics
     3.7. Fine tuning the mathematical layout
     3.8. Fonts in formulas
     3.9. The bold equivalence ∑ j<B ∏ λ :∑ x j ∏ λ
     3.10. Sample page of mathematical typesetting
     3.11. Symbols in formulas
4. Other Examples
          4.1. The connexion examples
          4.2. Test of brackets
     4.3. Recursion test
5. Font tests
6. Examples from the MathML recommendation
     6.1. Introduction
     6.2. More complicated examples
     6.3. Presentation Markup


Note 1. AM does not show the epsilon

Note 2. Amaya seems to ignore the style attribute

Note 3. The width of the strut should be zero; this is incorrectly rendered by Amaya, that shows a non-centered numerator; there is also additional space in the formulas before exercide 16.7

Note 4. As previously, the struts induce unwanted space in Amaya

Note 5. Amaya places the π/2 too low

Note 6. Maybe, one day, Tralics will have an em that depends on the context

Note 7. Command \bordermatrix not yet implemented

Note 8. Fixme

Note 9. The label name provided by the user cannot be used since it is an invalid XML id in this case

Note 10. We should do something with the optional argument

Note 11. Translation/rendering of apostrophe not always correct

Note 12. The delimiter for Vmatrix is badly rendered by Amaya