Math in Office
User, developer, and accessibility info on math editing/display in Microsoft Office and Windows. New features and specifications of the RichEdit editor. Getting OfficeMath onto web apps
Latest posts
It’s been so fine!
TL;DR I’m 51₁₆ long past the usual retirement age. So, after more than 30 years working with super talented, fun people at the best software company in the world, I’m retiring from Microsoft 😊. Stephen Chua now owns Math in Office. It all started in 1988 when I had a summer job getting Microsoft’s CodeView debugger running in protected mode up out of the MS-DOS 640 KB address space. My SST debugger could load and run real-mode DOS programs in protected mode with access to all the memory on Intel 286 and 386 CPUs. It could also execute backwards, quite handy for debugging. CodeView was cool, but Windows 2.1 see...
Math Dictation
You can dictate faster than you can write or type it, so math dictation can be handy for anyone working with math, notably on mobile devices. It can also make math more accessible. Math speech is similar to UnicodeMath, which you can use to enter equations into Word, PowerPoint, and other apps. Accordingly, we translate English math speech as recorded via Office dictation into UnicodeMath and build it up into OfficeMath. Currently we can dictate equations in English from algebra, trigonometry, and calculus into OneNote and PowerPoint. Examples of math dictation and the resulting OfficeMath are If you know ...
ITextDocument2 SetProperty and GetProperty
These methods allow programmers to set and get document properties for RichEdit controls. There is some documentation on the web, but more detail can be helpful and new properties have been added. This post describes the current set of properties except for the math properties, which are described in the post Default Document Math Properties.
Displaying Math in WordPress
The Microsoft devblogs are hosted by WordPress. Until recently, we haven’t been able to display equations using traditional math typography in our blogs except in images. Now we can embed LaTeX math which is a lot more accessible. One syntax for this is [ℒ]…[/ℒ], where the “…” has the desired LaTeX and the ℒ is the literal string “latex” (I can’t use the string “latex” itself since it would be interpreted as part of a LaTeX delimiter). Another syntax is "$ latex ...$" except leave out the space I added following the $ to prevent it from turning into LaTeX. On web pages viewed in FireFox and Safari as well as in t...
Math Speech Strings and Localization
This post describes how OfficeMath speech is localized into multiple (~18) languages. The facility doesn’t handle all Unicode math symbols or all math notations. But it handles the most common symbols and notations. There are two tables that need to be translated into the supported languages: a Unicode math symbol speech table and a math function table. Unicode Math Symbol Speech Table To localize the speech for Unicode characters, perform a binary search by character code in the math symbol speech table for the desired language. The table for English follows. Notably missing are speech strings for U+002D ‘–‘, ...
Using RichEdit for Text Processing
Suppose you’re writing a program that needs to process rich text. You could write your own functions. Alternatively, you could have RichEdit do the processing. For example, you might want to search for mathematical expressions in an RTF or HTML file or convert text in one math format to another format. Or change the kind of list numbering. Or recognize URLs, telephone numbers, etc. These manipulations don’t need a display. This post describes how to create a RichEdit instance to do the processing. Load the RichEdit dll The first thing is to load the RichEdit dll. You can use the system \windows\system32\msftedi...
Default Math Properties
Quite a few math properties have document default values. These default values are used if you don’t override them, which you can do usually by invoking a math context-menu option or programmatically by calling the ITextDocument2::SetProperty or ITextDocument2::SetMathProperties methods. Most properties pertain to “displayed” math zones, that is, math zones that begin either at the start of the document or a hard/shift Enter (CR/VT) and end at the following hard/shift Enter. The options determine math indents and characteristics such as whether integral limits are positioned below and above the integral or as sub...
RichEdit Hyperlinks
RichEdit has two kinds of hyperlinks: automatic hyperlinks (autoURLs) and friendly-name hyperlinks. As its name suggests, the autoURL is automatically recognized by RichEdit as a hyperlink and is displayed as a URL. A friendly name hyperlink has a name, which is displayed, and a hidden instruction part that contains the URL. This post describes these hyperlinks and explains how to manipulate them programmatically. The descriptions include some features that have been added recently. Automatic URLs The first autoURLs appeared in RichEdit 2.0, which shipped with Office 97, and have the usual web form, such as, ht...
Setting and Getting Text in Various Formats
You can get and set text from/into RichEdit in a variety of formats including RTF, HTML, MathML, OMML, UnicodeMath, Nemeth Braille, and speech. This post documents RichEdit options for a general way to access text using ITextRange2::SetText2(options, bstr) and ITextRange2::GetText2(options, pbstr). As such, this post is for programmers. All options work in the current Microsoft Office RichEdit (riched20.dll in an Office subdirectory) and many work in the Windows RichEdit (msftedit.dll). The options are defined in the following table in which s/g stands for SetText2/GetText2, respectively. Mutually exclusive op...