Udostępnij za pośrednictwem


Integrands, Summands, and Math Function Arguments

The Microsoft OfficeMath object model (OMML) dedicates explicit arguments for integrands, summands and other N-aryands, as well as for math functions such as trigonometric functions and subscript/superscript bases. Having such arguments aids in calculating the correct math spacing and reveals the math content more precisely. However, other math models, such as LaTeX, Presentation MathML and Nemeth math braille, do not have these arguments. This post gives best practice to identify N-aryands and math-function arguments in those formats. It also gives heuristics for choosing reasonable arguments in the absence of such best practice. Similar heuristics are used to choose the bases of subscript and superscript objects for UnicodeMath.

Format N-aryand Math function arg Sub/sup base
OMML explicit explicit explicit
Presentation MathML no no explicit
Content MathML explicit explicit explicit
[La]TeX no no no
UnicodeMath explicit or implied explicit or implied explicit or implied
MathType/Equation Editor explicit no no
Nemeth math braille no no no

 

It’s clear that a math function argument or an N-aryand should include the first entity that follows the base object. For example, for sin 𝑥, 𝑥 is the argument. Or for the summation (in Nemeth math braille ⠐⠨⠠⠎⠩⠝⠀⠨⠅⠀⠴⠣⠠⠝⠻⠁⠰⠝⠐)

𝑎𝑛 is the summand. But what about the integral (⠮⠰⠴⠘⠠⠿⠐⠑⠘⠤⠭⠘⠘⠆⠐⠙⠭)

If you only include the exponential (⠑⠘⠤⠭⠘⠘⠆⠐), you omit the 𝑑𝑥.

Delimiting the N-aryand in MathML and LaTeX

Ideally the N- aryand is delimited explicitly. Presentation MathML has the <mrow> entity which can contain multiple MathML entities. A natural way to represent a math function argument or an N-aryand is to put them inside <mrow>…</mrow> as in (omitting mml: prefix and xmlns field)

 <math>
   <msubsup>
      <mo stretchy="false">∫</mo>
      <mn>0</mn>
      <mo>∞</mo>
   </msubsup>
   <mrow>
      <msup>
         <mi>e</mi>
         <mrow>
            <mo>−</mo>
            <msup>
               <mi>x</mi>
               <mn>2</mn>
            </msup>
         </mrow>
      </msup>
      <mi>d</mi>
      <mi>x</mi>
   </mrow>
</math>

In [La]TeX, enclose the N-aryand in {…} as in \int_0^\infty{e^{-x^2}dx}. Notice how much more concise [La]TeX is. Delimiting N-aryands in these ways constitutes best practice. It’s also best practice to delimit math function arguments these ways in MathML and LaTeX.

Recognizing the N-aryand

When the N-aryand isn’t delimited explicitly by notation such as <mrow>…</mrow>, the first math object following the N- ary operator (with limits) should be part of the integrand. If this object is a delimiter object, such as {…} (\{…\} in TeX), a compound N-aryand is well defined. But if it’s a concatenation of math objects as in the integral (⠮⠰⠴⠘⠠⠿⠐⠑⠘⠤⠭⠘⠘⠆⠐⠙⠭)it’s more than just the first object. It’s tempting to choose the concatenation of objects up to a binary operator of precedence of addition or to the end of the expression, whichever comes first. Such concatenation gives the correct result in this case. UnicodeMath has the concept of an argument that consists of such concatenations. This would also work for Nemeth math braille, which has no way of delimiting N-aryands or function arguments explicitly.

UnicodeMath N-aryands

UnicodeMath attempts to look like a math notation as closely as a linear format can. But when an expression becomes too ambiguous, UnicodeMath encloses the expression in lenticular brackets 〖…〗(see Sec. 3.4 of that reference). As such, the integral above is written as ∫_0^∞▒〖e^(-x^2 ) dx〗in UnicodeMath. Here ▒ is the “glue” operator that connects the N-aryand to its large N-ary operator. But clearly UnicodeMath could use its definition of an argument to get the correct integrand in this case. I didn't code this refinement up for Office applications because the input method automatically puts the insertion point into the integrand as soon as a space builds up the integral operator. The same approach is used for entering function arguments. This makes it easy to type sin x+y, where x+y is the argument of the sine. To get out of the N-aryand or function argument, the user types an arrow key or clicks a mouse button. In the absence of the glue operator, it does seem like a good idea for UnicodeMath to capture a concatenation of objects for a N-aryand as it does for arguments of fractions, subscripts, etc. This works in the latest versions of Office 365, so you can build up ∫_0^∞ 𝑒^−𝑥^2 𝑑𝑥 into the integral above. Note that two spaces follow the 2: one to build up x^2 and the other to build up the exponential.