# Some UnicodeMath Enhancements

Murray Sargent

In the years since UnicodeMath 3.1 was published, some improvements have been made. The converter that converts UnicodeMath to OfficeMath also converts LaTeX and Nemeth math braille to OfficeMath. The converter needs ways to provide OfficeMath math-object arguments even when these arguments are not marked as such in the math format. The resulting infrastructure is available for converting all three formats to OfficeMath.

### n-aryands

With all three formats, the n-aryand, e.g., integrand or summand, may not be identified by surrounding delimiters. But OfficeMath and MathType have n-aryand arguments as described in the post Integrands, Summands, and Math Function Arguments. UnicodeMath has the binary operator U+2592 (▒) to treat the expression that follows the ▒ as the n-aryand (see Section 3.4 of UnicodeMath 3.1). In generalizing the conversion code for LaTeX and braille, it became clear that a space alone is adequate for starting n-aryands and we don’t need the ▒, which doesn’t look like mathematics. So, the converter now makes the first expression that follows the n-ary operator and limits into the n-aryand. For example, the integral

can be given by the UnicodeMath 1/2π ∫_0^2π ⅆθ/(a+b sin θ)=1/√(a^2-b^2) since the first expression that follows the ∫_0^2π is the fraction ⅆθ/(a+b sin θ). This works for many integrands. More complicated integrands are usually enclosed in brackets, braces, or parentheses.

### Matrix improvements

A “bare” matrix, that is, one with no enclosing brackets can be entered by typing the TeX control word \matrix. In addition, there are five matrix constructs with enclosing brackets that can be entered as summarized in the following table in which … stands for the matrix contents.

 LaTeX Char Code Form \matrix ■ U+25A0 … \bmatrix ⓢ U+24E2 […] \pmatrix ⒨ U+24A8 (…) \vmatrix ⒱ U+24B1 |…| \Bmatrix Ⓢ U+24C8 {…} \Vmatrix ⒩ U+24A9 ‖…‖

The UnicodeMath syntax for a parenthesized 2×2 matrix is \pmatrix(a&b@c&d), which builds up as

Sometimes you just want to enter a sample matrix quickly. If any of the six matrix control words are followed by a digit d, they insert a d × d identity matrix. For example, typing \pmatrix 3 enters

This is easier to type than \pmatrix(1&0&0@0&1&0@0&0&1), which displays the same identity matrix. Some of the matrix control words are missing in the default math autocorrect file. You can add them as described in the last section of this post.

## sin 𝑥²

This trigonometric expression is ambiguous: is it sin(𝑥²) or (sin 𝑥)²? Without the parentheses, the UnicodeMath for the former is “sin x^2” and for the latter is “sin x ^2”. In the latter, the space following the x builds up the sin x into a math function object and then the ^2 squares the object. But the results are very different formulas. The converter avoids the ambiguity by building up “sin x ^2” to be the same math function object as “sin^2 x”, that is, sin² 𝑥.

### Some LaTex in UnicodeMath mode

You can enter the common LaTeX expressions \frac{a}{b} and \binom{n}{m} in UnicodeMath input mode provided you have added math autocorrect entries to convert \frac to ⍁ (U+2341) and \binom to ⒝ (U+249D). To add math autocorrect entries, click on the lower-right box in the Equations/Conversions ribbon option to display the dialog box

Then click on the Math AutoCorrect… button to see and add math autocorrect entries. For example, to add \frac with U+2341, type as in the dialog box

And then enter Alt+x to convert the 2341 to ⍁. Probably when you type LaTeX in UnicodeMath input mode, a dialog ought to appear asking you if you’d like to switch to LaTeX input mode.