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

RichEdit Stories
Nov 7, 2021
0
1

RichEdit Stories

Murray Sargent
Murray Sargent

Word and RichEdit have stories, but you won’t find their story’s definition in a dictionary. Their story is an object that stores rich text in computer memory. Rich text consists of Unicode plain text, associated character and paragraph formatting, and embedded objects such as images. Such a story can contain the narrative of a traditional story, but more generally it can contain any arbitrary set of Unicode characters. A RichEdit control is created with a built-in story called the “main story”. Other stories may be created by the client or by RichEdit for special purposes. For example, when you select some text ...

RichEdit Place Holder
Oct 20, 2021
6
1

RichEdit Place Holder

Murray Sargent
Murray Sargent

Sometimes you need a text box that cues the user to type something in, such as, “Start a conversation”. As soon as the user types something, the cue text vanishes, and the user sees what the user typed. If the user deletes all the text, the cue text reappears. Such a text box is called a place-holder control. The Microsoft 365 RichEdit has such a control. This post explains how to include it in your application. Send two messages to set up a place-holder control: 1) EM_SETTEXTEX‎ to set the place-holder text, and 2) EM_SETEDITSTYLEEX‎ to enable the place-holder functionality. For setting the text, write someth...

LineServices
Sep 30, 2021
2
1

LineServices

Murray Sargent
Murray Sargent

One of the key technologies behind the high-quality display of mathematical text in OfficeMath applications like Word, PowerPoint, and OneNote is a special component called LineServices along with its sibling Page/TableServices (PTS). In addition to handling math display, various versions of LineServices are responsible for line layout in Word, PowerPoint, Publisher, OneNote, RichEdit, WordPad, and the Windows 10 Calculator. LineServices was developed by one of the most amazing teams at Microsoft. Because LineServices is used by components like RichEdit and the XAML text edit controls, it’s indirectly available t...

Unicode Math Braille Sequences
Aug 15, 2021
0
2

Unicode Math Braille Sequences

Murray Sargent
Murray Sargent

Cascadia Code Font
Aug 14, 2021
1
0

Cascadia Code Font

Murray Sargent
Murray Sargent

For many years, I’ve wanted to use real mathematical notation in computer programs for code that is mathematical in nature. The document UnicodeMath discusses this in some detail in Section 6. Using UnicodeMath in Programming Languages. Over the years, some advances beyond ASCII (invented in the 1960’s!) have been made. For example, you can use Unicode math alphabetics as variable names in the C++ compilers for the major platforms. In math documents, the index for a summation is often a math-italic letter such as 𝑖, 𝑗, 𝑘, 𝑙, 𝑚 or 𝑛. You can use these math-italic characters in your C++ programs! In fact, an 𝑛 (U+1...

RichEdit Font Binding
Jul 25, 2021
6
1

RichEdit Font Binding

Murray Sargent
Murray Sargent

Suppose a user pastes some plain text into a document. In principle, the text can contain any Unicode character. That includes virtually all characters used in the current languages of the world along with many ancient scripts and a plethora of symbols, mathematical and otherwise, that don’t belong to any language. The question arises as to what font(s) to use for the pasted characters. In general, the same font cannot be used for all characters, since TrueType glyph indices are 16-bit numbers thereby limiting fonts to 65536 glyphs. Meanwhile Unicode has over 140,000 named characters. Furthermore, even if a font ...

Switching from LaTeX to UnicodeMath Input Mode
Jun 4, 2021
0
1

Switching from LaTeX to UnicodeMath Input Mode

Murray Sargent
Murray Sargent

Here’s a bit of a puzzle. When the user enters “a/b” in LaTeX mode and formats it with the Enter key, the ‘/’ is marked as “nobuildup”. If the user then switches to UnicodeMath input mode and enters a space after the linear fraction containing the ‘/’, the fraction won’t build up, by design. If you delete the / and reenter it, it’ll build up as usual in UnicodeMath mode. A problem is that the user cannot easily detect that the ‘/’ has the nobuildup attribute since the math ribbon doesn’t display that attribute. One might conclude that when switching from LaTeX to UnicodeMath input mode, Word should remove the ...

RichEdit HTML Support
May 30, 2021
0
2

RichEdit HTML Support

Murray Sargent
Murray Sargent

RichEdit has had limited HTML support for many years, but it wasn’t general enough to document publicly. A recent RichEdit client (to be described in a future post) needs better support, so we have been improving it. For example, we have added HTML copy/paste, images, and math (of course!) to the Microsoft Office riched20.dll. Ideally RichEdit HTML should be able to represent any property that RichEdit RTF can represent. That still wouldn’t make RichEdit a general HTML editor replete with forms and JavaScript functionality. But it would add good interoperability with Office apps, Teams, and the web, all of which ...

Cool Windows Math Hot Key
Apr 29, 2021
2
1

Cool Windows Math Hot Key

Murray Sargent
Murray Sargent

The Windows key is used in a bunch of useful hot keys. Probably my favorite is Windows+Shift+s, which lets you copy any rectangular area on your screen(s) to the clipboard. I use this hot key a lot in describing application UI and other objects on the screen such as those in this post. I also use Windows+x y to see system info such as the name of the computer. Another cool Windows hot key is “Windows+.” or “Windows+;”. Using Windows+Shift+s, I get the image You can see related character displays by clicking on the characters in the bottom row. You can scroll these displays to see more characters. Clicking o...