다음을 통해 공유


Math Autocomplete

Users of OfficeMath note that entering math symbols using a keyboard can be hard because they don't know the symbol keywords to type and/or the control words are long. To ease these problems, we create a math autocomplete listbox that displays the control words that match what the user types. The user can then use ↑↓ and Enter, mouse or touch to enter the desired symbols. For example, \in<Enter> inserts ∞. You might not know that the TeX control word for ∞ is \infty, rather than \infinity, but you don’t have to know this with the autocomplete listbox. This functionality has been shipping in the Office RichEdit in a sharable way for a while. It creates the autocomplete lists using the RichEdit internal math autocorrect table, so it doesn’t show entries added by the user to the Office math autocorrect dictionary.

An example using our handy test program reitp2.exe is

Here the most common entry is selected when the listbox is created so that you can insert it directly using the Enter key. This works well for control words for math operators and Greek letters.

In addition, Unicode contains many math alphabets as described in Section 2.2 of Unicode Technical Report #25, Unicode Support for Mathematics. It’s not practical to display all 52 control words for a given math alphabet. Instead, the listbox contains a single entry, such as “\scriptH  ℋ”when the user enters \sc. This aids discovery of the math-alphabetic control words. If a letter other than ℋ is desired, the user can type the whole control word, such as \scriptQ, whereupon the listbox entry becomes “\scriptQ 𝒬”. In addition to \scriptX, where X is any one of A..Z and a..z, there are \frakturX, \doubleX, \boldX, \ssX (sans serif X), and \ttX (monospace, “typewriter type”).

The math autocomplete feature strives to improve discoverability and input speed. Accordingly, to speed up entry of the math alphabetic symbols, the facility offers the abbreviated versions \bolX for \boldX, \scX for \scriptX, \douX for \doubleX, and \frakX for \frakturX, where X is any letter other than the corresponding letter in the full name. The abbreviated versions correspond to cases where the only partial match is a math alphabetic, which is a useful user cue to use an abbreviation. Math-bold and math-italic alphabets can also be accessed using the usual bold and italic hot keys and ribbon buttons. There are the additional math-alphabetic control words \ssbX (math sans-serif bold),\ssiX (math sans-serif italic), and \ssbiX (math sans-serif bold italic) that work but aren’t currently included in the math autocomplete feature. Here’s an example of the alphabets for the letter H.

\boldH 𝐇
\doubleHHH
\frakturH
\scriptH
\ssH 𝖧
\ssbH 𝗛
\ssiH 𝘏
\ssbiH 𝙃
\ttH 𝙷

 

There are no control words for math-italic characters since they are used by default if the italic button is active. This is usually the case for math typography. In chemical formulas, upright letters are usually used as in C₆H₁₂O₆ for glucose.

There are several math Greek alphabets: bold, italic, bold-italic, sans-serif bold, and sans-serif bold italic. But there aren’t any alphabet control words for these alphabets or for the bold, double-struct, sans-serif, sans-serif bold, and monospace digits. You can Alt+x them into Word or RichEdit if you know their Unicode code points (U+1D6A8..U+1D7FF). By default, lower-case Greek letters are math-italic in math zones and upper-case Greek letters appear upright. If you enter \th, the listbox includes the preselected entry "\theta  θ" and you can hit Enter to get 𝜃.

There are other math alphabets that need to be added to Unicode, such as “calligraphic”. For that alphabet we can use \calX. But currently \scriptX may display a calligraphic glyph as in the Cambria Math font or a fancy script glyph as in the STIX Math font. So \scriptX is ambiguous and we’ll need a new control word to specify fancy script unambiguously.