QuizComposer©
©2001 Olaf Kayser & Gunnar MohrContact: admin[at]quizcomposer[dot]dk Main site: www.quizcomposer.dk 
Topics:
Two TeX variants, two compilers
Examples of mathematical expressions Mathematical expressions written directly in MathML

This page can only be displayed properly with a browser
capable of displaying formulas in MathML, for example
Mozilla Firefox.
Mathematical expressions may be written directly in MathML as described below.
Mathematical expressions may also be written in a format
borrowed from TeX (LaTeX), and placed between a pair of
dollar signs, as in the circle equation: On every server with QuizComposer the TeX to MathML compiler, the TeX variant ITeX, to which references can be found on this Mozilla/MathML page is installed, if possible. Please notice on that page the posibility of having sample formulas displayed, and of trying out your own formulas. Expressions written between a pair of dollar signs (one before and one after) are translated using this compiler, when installed. On servers where the ITeX compiler is not installed formulas enclosed between single dollar signs are translated using a builtin compiler, denoted QCTeX. The possibilities with this compiler, QCTeX, are described below. If the expression $ \QC $ is translated into the word QuizComposer the ITeX compiler is not installed on the server, accordingly QCTeX will be used for all formulas between $signs. The ITeX compiler gives you more possibilities for writing formulas than the builtin compiler does. You may, for example, write tables ("\array") according to the guide to ITeX. Incidentally, for tables especially, notice the possibility in QuizComposer of indicating, in question fields, line continuation with a \ at the very end of a line (e.g. for tables, after space after \\). A possible advantage with the builtin compiler, QCTeX, is the possibility of associating a conversion table from TeX commands to MathML character sequences as described below. By writing a triple $$$ rather than a single $ before a formula you indicate that the formula should be translated using QCTeX. The rest of this guide specifies the formulas that can be translated with the builtin formula compiler in QuizComposer. An expression is composed of character groups separated by blanks (spaces). There are five categories of character groups, viz. names, numbers and symbols, plus socalled TeX words and MathML tags. TeX words start with the sign \. MathML tags start with < and end with >. begin with a letter. A name with only one letter will be displayed in italics. Otherwise names are displayed in a normal font (Roman). Please note, that function names which in TeX are written starting with a \ sign, e.g. \log, are displayed without this \ sign. are written with digits, decimal point and minus sign where applicable. may be written either as they are, e.g. with / for division, with \TeX words,with MathML tags or with an & symbol, as described in the following section. As mentioned above, TeX words begin with the sign \. The following six words have special significance: \sqrt specifies the square root of the subsequent argument \root specifies the nth root of the subsequent argument, with n as the second argument \frac specifies a fraction of the 2 subsequent arguments in the expression (numerator and denominator), \munder specifies that the subsequent argument will have the next subsequent argument beneath it, as often used in summation, \mover specifies likewise, a superscript, \munderover specifies a subscript and a superscript. All the other TeX words are looked up in a builtin table associated with the translator. If the TeX word is at the start of a line, it will be replaced in the expression by the rest of the table line (which is expected to be a MathML construct). For example, \infty shows the symbol for infinity, as in the table. If a TeX word does not appear in the table the \ sign will be replaced by & and a semicolon (;) will be appended to the word. Hopefully, this creates a "MathML Character Name", that will be displayed as a mathematical symbol. For example, \alpha displays Greek alpha. The builtin table contains most of TeX's mathematical symbols but if you can't find what your looking for you may define your own table using this form. You can also directly write MathML Character Names starting with an & sign and ending with a semicolon (;).
The table illustrates the format of MathML code.
A MathML element
is normally written with both start and end tags of which the simplest
are <mi> for "identifiers", <mn> for
numbers and <mo> for operators.
The latter type cover, generally speaking,
all other symbols including brackets (parentheses). MathML tags are not translated. With MathML tags, you just write direct MathML code, e.g. the start tag <mi>. In principle, you'll need to put in an end tag for every start tag. But if one or more end tags are missing in relation to the number of start tags, then end tags will be generated so that MathML's requirements for a bracket structure are kept. In the end markers which you write yourself, you may add "options", although quotation marks must not be used, only apostrophes ('). (This requirement will probably be lifted some time in the future). When writing a mathematical expression, you should be aware of how blanks (spaces) are used to separate groups of characters. The translator creates MathML code for each separate group of characters. Apart from blanks that you yourself have placed (e.g. between a function name like sin and an argument like x), the translator inserts blanks (spaces) as follows: In front of the following 4 signs:  \ & < After the following 4 signs: = ; , : Enclosing the following (groups of) characters: _ + ^( { [ ) } ] <> >= <= After a minus sign (), unless it's followed by a digit or a decimal point. In front of an equals sign (=), unless it's with a < or > After greater than (>), unless this is followed by = In front of a slash(/), unless this follows a < After a slash (/), unless this is followed by a > Please note, that the symbol ^ for power of , or superscript, and the symbol _ for subscript are treated differently from the other symbols written directly, e.g. + and /. From the _ and ^ signs, MathML code is created with start tags <msub>, <msup> or <msubsup> followed by the "base" (that which is indexed) and an index or two indices. See the examplesbelow. 
To view these mathematical formulas, you need a special browser that can display them, such as Mozilla Firefox.
$ a sin^2 x + cos^2 x = 1.5 $ is displayed $a{\mathrm{sin}}^{2}x+{\mathrm{cos}}^{2}x=1.5$
$ \frac {b \pm \sqrt { b^2  4 a c }}{2 a} $ is displayed as $\frac{b\pm \sqrt{{b}^{2}4ac}}{2a}$
$ \frac { \sqrt { 4 + \sqrt { 12 + 13 } } } { \root 64 3 } $ is displayed as $\frac{\sqrt{4+\sqrt{12+13}}}{\sqrt[3]{64}}$
$ \int _ 0 ^ \pi f(x)dx = \munderover \sum {i=1} {i=n} y _ j ^ m $ is displayed as ${\int}_{0}^{\pi}f\left(x\right)\mathrm{dx}=\sum _{i=1}^{i=n}{y}_{j}^{m}$
$ \frac {d ln x^4 } { d x} $ is displayed as $\frac{d\mathrm{ln}{x}^{4}}{dx}$
You can write MathML codes directly into a definition form's fields. For example, the codestring:
An option worth considering is to use a MathML composer to write MathML code. Amaya is a combined browser and composer/editor, a socalled WYSIWYG composer (What You See Is What You Get), where formulas can be constructed graphically by pointing and clicking. Amaya is able to display MathML codes in a separate window from which you can copy the code to the field in the definition form. Also, look into the Mozilla MathML project for a composer of MathML pages.