Equation support has received some strong positive feedback so far - thanks! Testing it has been a blast and it has been great to see that folks like it. I've been writing about some of the aspects of testing it, and today I want to give quick synopsis of copying and pasting "math" around.

To really see what's going on, you will need a utililty that lets you view what is on the system clipboard. Windows XP included a viewer named "clipbrd.exe" and it will get us pretty far along with what's happening under the hood. There are many free viewers out there as well which you may want to try. Lastly, if you are really curious, you can write your own utility for this.

First add an equation to a page and copy it to the clipboard. Then paste in Notepad, MSPaint and Word (if you have it).

When you paste into Notepad, you get plain old vanilla text. MSPaint gets an image and Word gets the same math equation in editable form as an equation. This is because when you copy an equation to the clipboard, several different variants get copied. Using clipbrd, you can see most of what is there. Go ahead and enter an equation:

a squared + b squared = 2 a b cosine C

Select it and copy. Now look at clipbrd. When you expand the View menu, you can see all the formats OneNote added:

clipbook viewer

The grayed out items are formats the old clipbrd.exe cannot display. Anyway, you can see the variety of formats. When you paste into Notepad, Notepad will take the Text format. MSPaint uses an image format (the bitmap) and other apps can choose whatever format they want. Word will use the MathML. Looking at the clipboard contents in a debugger to get the MathML (use the System.Clipboard object) that format looks like:

?<?xml version="1.0" encoding="UTF-16" standalone="no"?>

<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="block">

<mml:msup>

<mml:mi>a</mml:mi>

<mml:mn>2</mml:mn>

</mml:msup>

<mml:mo>+</mml:mo>

<mml:msup>

<mml:mi>b</mml:mi>

<mml:mn>2</mml:mn>

</mml:msup>

<mml:mo>=</mml:mo>

<mml:msup>

<mml:mi>c</mml:mi>

<mml:mn>2</mml:mn>

</mml:msup>

<mml:mo>+</mml:mo>

<mml:mn>2</mml:mn>

<mml:mi>a</mml:mi>

<mml:mi>b</mml:mi>

<mml:mi>c</mml:mi>

<mml:mi>o</mml:mi>

<mml:mi>s</mml:mi>

<mml:mfenced>

<mml:mi>C</mml:mi>

</mml:mfenced>

</mml:math>

So the testing here involved ensuring we populate the clipboard with the correct data for each of these formats, and verifications included making sure other applications could use the data we had populated (in other words, our data was in a valid format).

Questions, comments, concerns and criticisms always welcome,

John