Contents:
Source code should always use syntax highlighting. For example this markup: It is quite important for an article to have a well-chosen list of references and pointers to the literature. Some reasons for this are the following:. Cite sources article has more information on this and also several examples for how the cited literature should look. Large scale formatting changes to an article or group of articles are likely to be controversial.
Proposed changes should generally be discussed on the talk page of the article before implementation. If there will be no positive response, or if planned changes affect more than one article, consider notifying an appropriate Wikiproject, such as WP: WikiProject Mathematics for mathematical articles. Rendering math for details. Though, for a formula on its own line the preferred formatting is the LaTeX markup, with a possible exception for simple strings of Latin letters, digits, common punctuation marks , and arithmetical operators.
Even for simple formulae the LaTeX markup might be preferred if required for the uniformity through an article. Wikipedia allows editors to typeset mathematical formulae in a subset of LaTeX markup see also TeX ; the formulae are, for a default reader, translated into PNG images. For more details on this, see Help: The LaTeX formulae can be displayed inline like this: When displaying formulae on their own line, one should indent the line with one or more colons: The above was typeset using. If you find an article which indents lines with spaces in order to achieve some formula layout effect, you should convert the formula to LaTeX markup.
By default, LaTeX code is rendered as if it were a displayed equation not inline , and this can frequently be too big. HTML-generating formatting, as described below , is adequate for most simple inline formulae and better for text-only browsers. Such formatting can be removed if a formula is edited and need not be added to new formulae. Images generated from LaTeX markup have alt text , which is displayed to visually impaired readers and other readers who cannot see the images. The default alt text is the LaTeX markup that produced the image.
You can override this by explicitly specifying an alt attribute for the math element. Small and easily explained formulas used in less technical articles can benefit from explicitly specified alt text. More complicated formulas, or formulas used in more technical articles, are often better off with the default alt text.
Doing so will also ensure that the text within a formula will not line-wrap, and that the font size will closely match the surrounding text in any skin. Note that certain special characters equal signs, absolute value bars require special attention. To start with, we generally use italic text for variables, but never for numbers or symbols. You can use ''x'' in the edit box to refer to the variable x.
Which method you choose is entirely up to you, but in order to keep with convention, we recommend the wiki markup method of enclosing the variable name between repeated apostrophe marks. While italicizing variables, things like parentheses, digits, equal and plus signs should be kept outside of the double-apostrophed sections. Descriptive subscripts should not be in italics, because they are not variables. For example, m foo is the mass of a foo. SI units are never italicized: Italicize lower-case Greek letters when they are variables in line with the general advice to italicize variables: It is also possible to enter Greek letters directly.
Commonly used sets of numbers are typeset in boldface, as in the set of real numbers R ; see blackboard bold for the types in use. Again, typically we use wiki markup: Font sizes and such should be entrusted to be handled with stylesheets. This does not combine well with other powers, as the following comparison shows:. Formulae formatted without using TeX should use the same syntax to maintain the same appearance.
There are list of mathematical symbols , list of mathematical symbols by subject and a list at Wikipedia: Mathematical symbols that may be useful when editing mathematics articles. As a rule of thumb, specific mathematical symbols shall be used, not similar-looking ASCII or punctuation symbols, even if corresponding glyphs are indistinguishable. Standard algebraic notation is best for formulae, so two variables q and d being multiplied are best written as qd when presented in a formula. However, when explaining the formula for a general audience not just mathematicians , or giving examples of its application, it is prudent to use the multiplication sign: Do not use the letter "x" to indicate multiplication.
Beautiful math in all browsers. No more setup for readers. Use MathML, TeX and ASCIImath as input and produce HTML+CSS, SVG and MathML as output. Tutorial is a review of high school algebra in 10 lessons and is lessonpdf: Setting up the environment This might be a good time to update to the latest version of the Reader, version . Forms available in html format and pdf format (see www.farmersmarketmusic.com); (9/6/97) Uploaded Lesson 10 DONE!.
It is not used for this purpose in professionally published mathematics, and most fonts render it in an inappropriate vertical position above the midline of the text rather than centered on it. Square brackets have two problems; they can occasionally cause problems with wiki markup, and editors sometimes 'fix' the brackets in asymmetrical intervals to make them symmetrical. The use of intervals for the range or domain of a function is very common.
An italicized letter f should be used instead. An exception would be if some of the definitions are very long for example, as in Heat equation , but, even in this case, each definition should end with a comma or semicolon, and the last one should end with a period if it terminates a sentence.
Just as in mathematics publications, a sentence which ends with a formula must have a period at the end of the formula. Similarly, if the conventional punctuation rules would require a question mark, comma, semicolon, or other punctuation at that place, the formula must have that punctuation at the end.
Functions that have multi-letter names should always be in an upright font. The most well-known functions—trigonometric functions, logarithms, etc. Special care is needed with subscripted labels to distinguish the purpose of the subscript as this is a common error: For single-letter variables, constants, and operators such as the differential , imaginary unit , and Euler's number , Wikipedia articles usually use an italic font.
Some authors prefer to use an upright Roman font, as in d, i, and e, and other authors use Roman boldface, as in i. Changes from one style to another should be done only to make an article consistent with itself. Formatting changes should not be made solely to make articles consistent with each other, nor to make articles conform to a particular style guide or standards body.
It is inappropriate for an editor to go through articles doing mass changes from one style to another. When there is dispute over the correct style to use, follow the same principles as MOS: Generally, one way to determine which usage is appropriate on Wikipedia is to look at prevalence in reliable sources in addition to relevant style guides, per WP: But this guide is rarely followed in reliable mathematical sources, and it is contradicted by other style guides, like Donald Knuth 's TeXbook.
So, it would be assigning undue weight to the ISO recommendation for the article e mathematical constant to use an upright Roman face for the constant e. Certain objects, such as the real numbers R , are traditionally printed in boldface. Plain TeX combined with AMS-TeX gave me the ability to write highly specialized formatting macros without being forced into a finite collection of packaged formats. This was the only system that had all the stated featuresand then some. They worked with me and added in some additional features that I argued were important and needed.
Without their help the initial phase of the project could not have progressed nearly as fast as it did. One of the problems with the concept of an on-line tutorial was that the students had to come into the computer labs to read the tutorial. This again made it very, very easy to move portions of the tutorial to the net.
See the next point. Hence, converting from dvi to pdf was a painless almost task. The Assistant calls the Distiller to convert the file to the pdf format. Some of the interactivity is lost however. As I learn more about Acrobat and it's capabilities, perhaps all the tricks that I used for the dvi files can eventually be ported to the pdf format. Of course, a pdf file can be read on most any platform using the free Adobe Acrobat Reader.
This TeX macro package unleashes the power of postscript within a TeX document. I utilize graphic files in the tiff format for two purposes: This new version of Algeboard, which uses Acrobat Forms 3. You must have installed Acrobat Forms 3. Report any bugs in the programming to me please. Forms available in html format and pdf format see mainmenu. Also lightly edited versions of Lessons 1 -- 6. Three more to go! Site Map For return visitors who want to jump directly to a topic of interest, here is a listing of the files. The tutorial is setup for the Web and so many of the brown links are relative path URL's Some brown links will work: The ones that simply load a pdf file; it is the links that have a named destination that will not work.
All of the green links will work. These are natural limitations put on the system by the Acrobat application. For example, it is reasonable to render a token with the mathvariant attribute set to "sans-serif" in Helvetica or Arial. However, rendering the token in a Times Roman font could be seriously misleading and should be avoided. In principle, any mathvariant value may be used with any character data to define a specific symbolic token.
In practice, only certain combinations of character data and mathvariant values will be visually distinguished by a given renderer. For example, there is no clear-cut rendering for a "fraktur alpha" or a "bold italic Kanji" character, and the mathvariant values "initial", "tailed", "looped", and "stretched" are appropriate only for Arabic characters.
Certain combinations of character data and mathvariant values are equivalent to assigned Unicode code points that encode mathematical alphanumeric symbols. These characters are described in detail in section 2. The description of each such character in the Unicode standard provides an unstyled character to which it would be equivalent except for a font change that corresponds to a mathvariant value. A token element that uses the unstyled character in combination with the corresponding mathvariant value is equivalent to a token element that uses the mathematical alphanumeric symbol character without the mathvariant attribute.
Note that the appearance of a mathematical alphanumeric symbol character should not be altered by surrounding mathvariant or other style declarations. Renderers should support those combinations of character data and mathvariant values that correspond to Unicode characters, and that they can visually distinguish using available font characters.
Renderers may ignore or support those combinations of character data and mathvariant values that do not correspond to an assigned Unicode code point, and authors should recognize that support for mathematical symbols that do not correspond to assigned Unicode code points may vary widely from one renderer to another. Since MathML expressions are often embedded in a textual data format such as XHTML, the surrounding text and the MathML must share rendering attributes such as font size, so that the renderings will be compatible in style.
For this reason, most attribute values affecting text rendering are inherited from the rendering environment, as shown in the "default" column in the table above. In cases where the surrounding text and the MathML are being rendered by separate software, e. If the requested mathsize of the current font is not available, the renderer should approximate it in the manner likely to lead to the most intelligible, highest quality rendering. These attributes were aligned to CSS but, in rendering environments that support CSS, it is preferable to use CSS directly to control the rendering properties corresponding to these attributes, rather than the attributes themselves.
However as explained above, direct manipulation of these rendering properties by whatever means should usually be avoided. An mi element represents a symbolic name or arbitrary text that should be rendered as an identifier. Identifiers can include variables, function names, and symbolic constants. Not all "mathematical identifiers" are represented by mi elements — for example, subscripted or primed variables should be represented using msub or msup respectively. It should be stressed that mi is a presentation element, and as such, it only indicates that its content should be rendered as an identifier.
In the majority of cases, the contents of an mi will actually represent a mathematical identifier such as a variable or function name. However, as the preceding paragraph indicates, the correspondence between notations that should render as identifiers and notations that are actually intended to represent mathematical identifiers is not perfect. Note that the deprecated fontstyle attribute defaults in the same way as mathvariant , depending on the content. Identifiers include function names such as "sin". Miscellaneous text that should be treated as a "term" can also be represented by an mi element, as in:.
When an mi is used in such exceptional situations, explicitly setting the mathvariant attribute may give better results than the default behavior of some renderers. The names of symbolic constants should be represented as mi elements:.
An mn element represents a "numeric literal" or other data that should be rendered as a numeric literal. Generally speaking, a numeric literal is a sequence of digits, perhaps including a decimal point, representing an unsigned integer or real number. The mathematical concept of a "number" can be quite subtle and involved, depending on the context. As a consequence, not all mathematical numbers should be represented using mn ; examples of mathematical numbers that should be represented differently are shown below, and include complex numbers, ratios of numbers shown as fractions, and names of numeric constants.
Conversely, since mn is a presentation element, there are a few situations where it may be desirable to include arbitrary text in the content of an mn that should merely render as a numeric literal, even though that content may not be unambiguously interpretable as a number according to any particular standard encoding of numbers as character sequences.
As a general rule, however, the mn element should be reserved for situations where its content is actually intended to represent a numeric quantity in some fashion. Many mathematical numbers should be represented using presentation elements other than mn alone; this includes complex numbers, negative numbers, ratios of numbers shown as fractions, and names of numeric constants.
Examples of MathML representations of such numbers include:. An mo element represents an operator or anything that should be rendered as an operator. In general, the notational conventions for mathematical operators are quite complicated, and therefore MathML provides a relatively sophisticated mechanism for specifying the rendering behavior of an mo element. As a consequence, in MathML the list of things that should "render as an operator" includes a number of notations that are not mathematical operators in the ordinary sense.
Besides ordinary operators with infix, prefix, or postfix forms, these include fence characters such as braces, parentheses, and "absolute value" bars; separators such as comma and semicolon; and mathematical accents such as a bar or tilde over a symbol. We will use the term "operator" in this chapter to refer to operators in this broad sense.
Renderers without access to complete fonts for the MathML character set may choose to render an mo element as not precisely the characters in its content in some cases. However, as a general rule, renderers should attempt to render the content of an mo element as literally as possible. All operators, in the general sense used here, are subject to essentially the same rendering attributes and rules. Subtle distinctions in the rendering of these classes of symbols, when they exist, are supported using the Boolean attributes fence , separator and accent , which can be used to distinguish these cases.
A key feature of the mo element is that its default attribute values are set on a case-by-case basis from an "operator dictionary" as explained below. In particular, default values for fence , separator and accent can usually be found in the operator dictionary and therefore need not be specified on each mo element. Note that some mathematical operators are represented not by mo elements alone, but by mo elements "embellished" with for example surrounding superscripts; this is further described below. Thus, mo accepts attributes to encode the desirability of breaking at a particular operator, as well as attributes describing the treatment of the operator and indentation in case the a linebreak is made at that operator.
Since the display of operators is so critical in mathematics, the mo element accepts a large number of attributes; these are described in the next three subsections. When a value that is listed as "inherited" is not explicitly given on an mo , mstyle element, math element, or found in the operator dictionary for a given mo element, the default value shown in parentheses is used.
The following attributes affect when a linebreak does or does not occur, and the appearance of the linebreak when it does occur. It does prevent breaks from occurring on either side of the mo element in all other situations. The following attributes affect indentation of the lines making up a formula. Primarily these attributes control the positioning of new lines following a linebreak, whether automatic or manual. However, indentalignfirst and indentshiftfirst also control the positioning of single line formula without any linebreaks. When these attributes appear on mo or mspace they apply if a linebreak occurs at that element.
When they appear on mstyle or math elements, they determine defaults for the style to be used for any linebreaks occurring within. Note that except for cases where heavily marked-up manual linebreaking is desired, many of these attributes are most useful when bound on an mstyle or math element. Note that since the rendering context, such as the available width and current font, is not always available to the author of the MathML, a render may ignore the values of these attributes if they result in a line in which the remaining width is too small to usefully display the expression or if they result in a line in which the remaining width exceeds the available linewrapping width.
Note that the mo elements in these examples don't need explicit fence or separator attributes, since these can be found using the operator dictionary as described below. Certain operators that are "invisible" in traditional mathematical notation should be represented using specific entity references within mo elements, rather than simply by nothing.
The characters used for these "invisible operators" are:. The reasons for using specific mo elements for invisible operators include:. For example, an audio renderer might render f x represented as in the above examples by speaking "f of x", but use the word "times" in its rendering of x y. Although its rendering must still be different depending on the structure of neighboring elements sometimes leaving out "of" or "times" entirely , its task is made much easier by the use of a different mo element for each invisible operator.
The reasons for explicitly using this special character are similar to those for using the special characters for invisible operators described in the preceding section. Typical visual rendering behaviors for mo elements are more complex than for the other MathML token elements, so the rules for rendering them are described in this separate subsection. Note that, like all rendering rules in MathML, these rules are suggestions rather than requirements. Furthermore, no attempt is made to specify the rendering completely; rather, enough information is given to make the intended effect of the various rendering attributes as clear as possible.
Many mathematical symbols, such as an integral sign, a plus sign, or a parenthesis, have a well-established, predictable, traditional notational usage. Typically, this usage amounts to certain default attribute values for mo elements with specific contents and a specific form attribute. If an mo element is not listed in the dictionary, the default values shown in parentheses in the table of attributes for mo should be used, since these values are typically acceptable for a generic operator.
Some operators are "overloaded", in the sense that they can occur in more than one form prefix, infix, or postfix , with possibly different rendering properties for each form. Typically, a visual renderer would add space around both sides of an infix operator, while only in front of a prefix operator. The form attribute allows specification of which form to use, in case more than one form is possible according to the operator dictionary and the default value described below is not suitable.
The form attribute does not usually have to be specified explicitly, since there are effective heuristic rules for inferring the value of the form attribute from the context. If it is not specified, and there is more than one possible form in the dictionary for an mo element with given content, the renderer should choose which form to use as follows but see the exception for embellished operators, described later:.
As with ordinary operators, these values do not usually need to be specified explicitly. If the operator does not occur in the dictionary with the specified form, the renderer should use one of the forms that is available there, in the order of preference: There is one exception to the above rules for choosing an mo element's default form attribute.
An mo element that is "embellished" by one or more nested subscripts, superscripts, surrounding text or whitespace, or style changes behaves differently. It is the embellished operator as a whole this is defined precisely, below whose position in an mrow is examined by the above rules and whose surrounding spacing is affected by its form, not the mo element at its core; however, the attributes influencing this surrounding spacing are taken from the mo element at the core or from that element's dictionary entry.
The precise definition of an "embellished operator" is:. Note that this definition permits nested embellishment only when there are no intervening enclosing elements not in the above list. The above rules for choosing operator forms and defining embellished operators are chosen so that in all ordinary cases it will not be necessary for the author to specify a form attribute. The following notes are included as a rationale for certain aspects of the above definitions, but should not be important for most users of MathML. An mfrac is included as an "embellisher" because of the common notation for a differential operator:.
Since the definition of embellished operator affects the use of the attributes related to stretching, it is important that it includes embellished fences as well as ordinary operators; thus it applies to any mo element. Note that an mrow containing a single argument is an embellished operator if and only if its argument is an embellished operator. This means that an mo element that is the sole argument of an mrow will determine its default form attribute based on that mrow 's position in a surrounding, perhaps inferred, mrow if there is one , rather than based on its own position in the mrow in which it is the sole argument.
Note that the above definition defines every mo element to be "embellished" — that is, "embellished operator" can be considered and implemented in renderers as a special class of MathML expressions, of which mo is a specific case. The amount of horizontal space added around an operator or embellished operator , when it occurs in an mrow , can be directly specified by the lspace and rspace attributes. Note that lspace and rspace should be interpreted as leading and trailing space, in the case of RTL direction.
By convention, operators that tend to bind tightly to their arguments have smaller values for spacing than operators that tend to bind less tightly. This convention should be followed in the operator dictionary included with a MathML renderer. Some renderers may choose to use no space around most operators appearing within subscripts or superscripts, as is done in T E X.
Non-graphical renderers should treat spacing attributes, and other rendering attributes described here, in analogous ways for their rendering medium. For example, more space might translate into a longer pause in an audio rendering.
Four attributes govern whether and how an operator perhaps embellished stretches so that it matches the size of other elements: In practice, typical renderers will only be able to stretch a small set of characters, and quite possibly will only be able to generate a discrete set of character sizes.
It is up to the renderer to know in which directions it is reasonable to stretch a character, if it can stretch the character. Most characters can be stretched in at most one direction by typical renderers, but some renderers may be able to stretch certain characters, such as diagonal arrows, in both directions independently. The minsize and maxsize attributes limit the amount of stretching in either direction.
These two attributes are given as multipliers of the operator's normal size in the direction or directions of stretching, or as absolute sizes using units. The symmetric attribute governs whether the height and depth above and below the axis of the character are forced to be equal by forcing both height and depth to become the maximum of the two. In this case, one wants the parentheses to stretch to cover the matrix, whereas stretching the parentheses symmetrically would cause them to protrude beyond one edge of the matrix. The symmetric attribute only applies to characters that stretch vertically otherwise it is ignored.
If a stretchy mo element is embellished as defined earlier in this section , the mo element at its core is stretched to a size based on the context of the embellished operator as a whole, i. For example, the parentheses in the following example which would typically be set to be stretchy by the operator dictionary will be stretched to the same size as each other, and the same size they would have if they were not underlined and overlined, and furthermore will cover the same vertical interval:. Note that this means that the stretching rules given below must refer to the context of the embellished operator as a whole, not just to the mo element itself.
The above should render as as opposed to the default rendering. If a stretchy operator is a direct sub-expression of an mrow element, or is the sole direct sub-expression of an mtd element in some row of a table, then it should stretch to cover the height and depth above and below the axis of the non -stretchy direct sub-expressions in the mrow element or table row, unless stretching is constrained by minsize or maxsize attributes. In the case of an embellished stretchy operator, the preceding rule applies to the stretchy operator at its core.
Let maxheight and maxdepth be the maximum height and depth of the non -stretchy siblings within the same mrow or mtr. Let axis be the height of the math axis above the baseline. Note that even if a minsize or maxsize value is set on a stretchy operator, it is not used in the initial calculation of the maximum height and depth of an mrow. By default, most vertical arrows, along with most opening and closing fences are defined in the operator dictionary to stretch by default.
In the case of a stretchy operator in a table cell i. Equivalently, the value of the rowspan attribute is assumed to be 1 for all the table cells in the table row, including the cell containing the operator. When this is not the case, the operator should only be stretched vertically to cover those table cells that are entirely within the set of table rows that the operator's cell covers.
Table cells that extend into rows not covered by the stretchy operator's table cell should be ignored. If a stretchy operator, or an embellished stretchy operator, is a direct sub-expression of an munder , mover , or munderover element, or if it is the sole direct sub-expression of an mtd element in some column of a table see mtable , then it, or the mo element at its core, should stretch to cover the width of the other direct sub-expressions in the given element or in the same table column , given the constraints mentioned above.
By default, most horizontal arrows and some accents stretch horizontally.
Equivalently, the value of the columnspan attribute is assumed to be 1 for all the table cells in the table row, including the cell containing the operator. When this is not the case, the operator should only be stretched horizontally to cover those table cells that are entirely within the set of table columns that the operator's cell covers. Table cells that extend into columns not covered by the stretchy operator's table cell should be ignored.
The rules for horizontal stretching include mtd elements to allow arrows to stretch for use in commutative diagrams laid out using mtable. The rules for the horizontal stretchiness include scripts to make examples such as the following work:. If a stretchy operator is not required to stretch i. If a stretchy operator is required to stretch, but all other expressions in the containing element as described above are also stretchy, all elements that can stretch should grow to the maximum of the normal unstretched sizes of all elements in the containing object, if they can grow that large.
If the value of minsize or maxsize prevents that, then the specified min or max size is used. For example, in an mrow containing nothing but vertically stretchy operators, each of the operators should stretch to the maximum of all of their normal unstretched sizes, provided no other attributes are set that override this behavior. Of course, limitations in fonts or font rendering may result in the final, stretched sizes being only approximately the same. Note that because indentalignlast defaults to "indentalign", in the above example indentalign could have been used in place of indentalignlast.
An mtext element is used to represent arbitrary text that should be rendered as itself. In general, the mtext element is intended to denote commentary text. Note that some text with a clearly defined notational role might be more appropriately marked up using mi or mo ; this is discussed further below. An mtext element can be used to contain "renderable whitespace", i. In non-graphical media, such characters are intended to have an analogous effect, such as introducing positive or negative time delays or affecting rhythm in an audio renderer.
Whitespace that is intended to be rendered as part of an element's content must be represented by entity references or mspace elements unless it consists only of single blanks between non-whitespace characters. In some cases, text embedded in mathematics could be more appropriately represented using mo or mi elements. An example involving an mi element is: On the other hand, expository text within MathML is best represented with an mtext element.
An example of this is:. Another factor to consider in deciding how to mark up text is the effect on rendering. Text enclosed in an mo element is unlikely to be found in a renderer's operator dictionary, so it will be rendered with the format and spacing appropriate for an "unrecognized operator", which may or may not be better than the format and spacing for "text" obtained by using an mtext element.
An ellipsis entity in an mi element is apt to be spaced more appropriately for taking the place of a term within a series than if it appeared in an mtext element. An mspace empty element represents a blank space of any desired size, as set by its attributes. It can also be used to make linebreaking suggestions to a visual renderer. Note that the default values for attributes have been chosen so that they typically will have no effect on rendering.
Thus, the mspace element is generally used with one or more attribute values explicitly specified. See also the other elements that can render as whitespace, namely mtext , mphantom , and maligngroup. Linebreaking was originally specified on mspace in MathML2, but controlling linebreaking on mo is to be preferred starting with MathML 3. MathML 3 adds new linebreaking attributes only to mo , not mspace.
The value "indentingnewline" was defined in MathML2 for mspace ; it is now deprecated. Its meaning is the same as newline , which is compatible with its earlier use when no other linebreaking attributes are specified. Note that linebreak values on adjacent mo and mspace elements do not interact; a "nobreak" on an mspace will not, in itself, inhibit a break on an adjacent mo element. A number of MathML presentation elements are "space-like" in the sense that they typically render as whitespace, and do not affect the mathematical meaning of the expressions in which they appear.
As a consequence, these elements often function in somewhat exceptional ways in other MathML expressions. The following MathML elements are defined to be "space-like":. Note that an mphantom is not automatically defined to be space-like, unless its content is space-like.
This is because operator spacing is affected by whether adjacent elements are space-like. Since the mphantom element is primarily intended as an aid in aligning expressions, operators adjacent to an mphantom should behave as if they were adjacent to the contents of the mphantom , rather than to an equivalently sized area of whitespace. Authors who insert space-like elements or mphantom elements into an existing MathML expression should note that such elements are counted as arguments, in elements that require a specific number of arguments, or that interpret different argument positions differently.
Therefore, space-like elements inserted into such a MathML element should be grouped with a neighboring argument of that element by introducing an mrow for that purpose. For example, to allow for vertical alignment on the right edge of the base of a superscript, the expression. The ms element is used to represent "string literals" in expressions meant to be interpreted by computer algebra systems or other systems containing "programming languages". By default, string literals are displayed surrounded by double quotes, with no extra spacing added around the string.
Note that the string literals encoded by ms are made up of characters, mglyph s and malignmark s rather than "ASCII strings". The content of ms elements should be rendered with visible "escaping" of certain characters in the content, including at least the left and right quoting characters, and preferably whitespace other than individual space characters.
The intent is for the viewer to see that the expression is a string literal, and to see exactly which characters form its content. Besides tokens there are several families of MathML presentation elements. One family of elements deals with various "scripting" notations, such as subscript and superscript. Another family is concerned with matrices and tables. The remainder of the elements, discussed in this section, describe other basic notations such as fractions and radicals, or deal with general functions such as setting style properties and error handling.
An mrow element is used to group together any number of sub-expressions, usually consisting of one or more mo elements acting as "operators" on one or more other expressions that are their "operands". Several elements automatically treat their arguments as if they were contained in an mrow element. The dir attribute can be used to specify the directionality for a specific mrow , otherwise it inherits the directionality from the context.
For aural agents, the arguments would be rendered audibly as a sequence of renderings of the arguments. MathML provides support for both automatic and manual linebreaking of expressions that is, to break excessively long expressions into several lines. Sub-expressions should be grouped by the document author in the same way as they are grouped in the mathematical interpretation of the expression; that is, according to the underlying "syntax tree" of the expression.
Specifically, operators and their mathematical arguments should occur in a single mrow ; more than one operator should occur directly in one mrow only when they can be considered in a syntactic sense to act together on the interleaved arguments, e. A precise rule is given below.
Proper grouping has several purposes: Although improper grouping will sometimes result in suboptimal renderings, and will often make interpretation other than pure visual rendering difficult or impossible, any grouping of expressions using mrow is allowed in MathML syntax; that is, renderers should not assume the rules for proper grouping will be followed. MathML renderers are required to treat an mrow element containing exactly one argument as equivalent in all ways to the single argument occurring alone, provided there are no attributes on the mrow element.
If there are attributes on the mrow element, no requirement of equivalence is imposed. This equivalence condition is intended to simplify the implementation of MathML-generating software such as template-based authoring tools. A precise rule for when and how to nest sub-expressions using mrow is especially desirable when generating MathML automatically by conversion from other formats for displayed mathematics, such as T E X, which don't always specify how sub-expressions nest.
When a precise rule for grouping is desired, the following rule should be used:. Two adjacent operators, possibly embellished, possibly separated by operands i. In all other cases, nested mrow s should be used. When forming a nested mrow during generation of MathML that includes just one of two successive operators with the forms mentioned above which mean that either operator could in principle act on the intervening operand or operands , it is necessary to decide which operator acts on those operands directly or would do so, if they were present.
Ideally, this should be determined from the original expression; for example, in conversion from an operator-precedence-based format, it would be the operator with the higher precedence. Note that the above rule has no effect on whether any MathML expression is valid, only on the recommended way of generating MathML from other formats for displayed mathematics or directly from written notation. The proper encoding of x , y furnishes a less obvious example of nesting mrow s:. In this case, a nested mrow is required inside the parentheses, since parentheses and commas, thought of as fence and separator "operators", do not act together on their arguments.
The mfrac element is used for fractions. It can also be used to mark up fraction-like objects such as binomial coefficients and Legendre symbols. The syntax for mfrac is. The mfrac element sets displaystyle to "false", or if it was already false increments scriptlevel by 1, within numerator and denominator.
The fraction line, if any, should be drawn using the color specified by mathcolor. These cases are shown below:.
Although this format is an established convention, it is not universally followed; for situations where a forward slash is desired in a RTL context, alternative markup, such as an mo within an mrow should be used. These elements construct radicals. The msqrt element is used for square roots, while the mroot element is used to draw radicals with indices, e. The syntax for these elements is:. The mroot element requires exactly 2 arguments. The mroot element increments scriptlevel by 2, and sets displaystyle to "false", within index , but leaves both attributes unchanged within base.
The msqrt element leaves both attributes unchanged within its argument. Note that in a RTL directionality, the surd begins on the right, rather than the left, along with the index in the case of mroot. The surd and overbar should be drawn using the color specified by mathcolor. The mstyle element is used to make style changes that affect the rendering of its contents. Additionally, it can be given any attribute accepted by any other presentation element, except for the attributes described below. Finally, the mstyle element can be given certain special attributes listed in the next subsection.
Loosely speaking, the effect of the mstyle element is to change the default value of an attribute for the elements it contains. Style changes work in one of several ways, depending on the way in which default values are specified for an attribute. Some attributes, such as displaystyle or scriptlevel explained below , are inherited from the surrounding context when they are not explicitly set.
Specifying such an attribute on an mstyle element sets the value that will be inherited by its child elements. Unless a child element overrides this inherited value, it will pass it on to its children, and they will pass it to their children, and so on. But if a child element does override it, either by an explicit attribute setting or automatically as is common for scriptlevel , the new overriding value will be passed on to that element's children, and then to their children, etc, unless it is again overridden.
Other attributes, such as linethickness on mfrac , have default values that are not normally inherited. That is, if the linethickness attribute is not set on the mfrac element, it will normally use the default value of "1", even if it was contained in a larger mfrac element that set this attribute to a different value. For attributes like this, specifying a value with an mstyle element has the effect of changing the default value for all elements within its scope.
The net effect is that setting the attribute value with mstyle propagates the change to all the elements it contains directly or indirectly, except for the individual elements on which the value is overridden. Unlike in the case of inherited attributes, elements that explicitly override this attribute have no effect on this attribute's value in their children.
Another group of attributes, such as stretchy and form , are computed from operator dictionary information, position in the enclosing mrow , and other similar data.
For these attributes, a value specified by an enclosing mstyle overrides the value that would normally be computed. Note that attribute values inherited from an mstyle in any manner affect a descendant element in the mstyle 's content only if that attribute is not given a value by the descendant element. On any element for which the attribute is set explicitly, the value specified overrides the inherited value.
The only exception to this rule is when the attribute value is documented as specifying an incremental change to the value inherited from that element's context or rendering environment. Note also that the difference between inherited and non-inherited attributes set by mstyle , explained above, only matters when the attribute is set on some element within the mstyle 's contents that has descendants also setting it. Thus it never matters for attributes, such as mathsize , which can only be set on token elements or on mstyle itself.
MathML specifies that when the attributes height , depth or width are specified on an mstyle element, they apply only to mspace elements, and not to the corresponding attributes of mglyph , mpadded , or mtable. Similarly, when rowalign , columnalign , or groupalign are specified on an mstyle element, they apply only to the mtable element, and not the mtr , mlabeledtr , mtd , and maligngroup elements.
When the lspace attribute is set with mstyle , it applies only to the mo element and not to mpadded. To be consistent, the voffset attribute of the mpadded element can not be set on mstyle. When the deprecated fontfamily attribute is specified on an mstyle element, it does not apply to the mglyph element.
The deprecated index attribute cannot be set on mstyle. When the align attribute is set with mstyle , it applies only to the munder , mover , and munderover elements, and not to the mtable and mstack elements. The required attributes src and alt on mglyph , and actiontype on maction , cannot be set on mstyle.
As a presentation element, mstyle directly accepts the mathcolor and mathbackground attributes. Thus, the mathbackground specifies the color to fill the bounding box of the mstyle element itself; it does not specify the default background color. This is an incompatible change from MathML 2, but we feel it is more useful and intuitive.