共用方式為


Converting Equations from MathType to Word 2007's Equation Format

MathType users may want to convert their equations to Word 2007's native equation format. This can be done by exporting the equations in MathML and then pasting them into Word 2007. There are some problems and useful tricks that Dadi Gudmundsson (www.sensoranalytics.com) describes as follows:

Migration Procedure

Reason for migration
After testing the equation capability in Word 2007 I was immediately sold. There are some things that need to be smoothed out, but the bottomline is that my overall productivity of documenting and maintaining mathematical content was greatly improved. See also my posting on:

https://blogs.msdn.com/microsoft_office_word/archive/2007/01/30/word-2007-in-a-store-near-you.aspx#1566433

1. Convert Mathtype to Mathml
I kept my Word 2003 installation to have easy access to the Mathtype capability I had installed there. Using the Convert equations selection in the Mathtype pull-down menu I converted all 700 equations to "Mathtype 2.0 (no namespace)".
The document went from 60 to about 800 pages (this is temporary).

2. Edit Mathml notation
Through trial and error I discovered that it is apparently necessary to edit some Mathml notation for the equation capability of Word 2007. So, using Word 2003 or 2007, the following Find and Replace operations were done:

a. Find "<" and replace with "<mml:"     (this will affect any "<" marks in the text that are not inside equations. Easy to find later.
b. Find "<mml:/" and replace with "</mml:"
c. Find "<mml:math" and replace with "<mml:math xmlns:mml="https://www.w3.org/1998/Math/MathML "
d. Be careful to not allow Word to change the quotation marks in the above text to "smart quotes" (Smart quotes have a more professional look and also slant to the appropriate sides). The equation capability needs the quotation mark to be the standard plain quotation mark shown above. To stop Word 2007 from doing this go into the dialog for the "AutoCorrect" feature, and in the "AutoFormat As You Type" tab, uncheck the "Straight quotes with smart quotes" selection.

3. Macro for equation conversion
Open the document in Word 2007 and convert it to become a Word 2007 document (can't do the following in compatibility mode). Start recording a macro and do the following for the first equation:

a. Open the Find feature, turn on wildcard & ignore whitespace selections, enter "?mml:math*/mml:math?" into the Find field and push Find. The first block of Mathml code should now be highlighted.
b. Push Ctrl+X to cut the selected text.
c. Push Alt+= to insert an equation.
d. Select paste special and paste as unformatted text (in majority of cases the mathml code in question will now appear as a human readable equation).

Stop recording the macro, close the Find feature dialog.

4. Fix an error in the Macro recording
For some reason the macro capability in Word does not remember the "paste special" selection we made while recording the macro. This a known issue. To fix it see the following link:

https://www.latext.com/pm/comments/M1107_0_1_0_C/

5. Assign the macro to a button or keystroke combination.
See Word help on how to do this.

6. Use the button to convert equations.
I chose to convert one equation at a time to make sure everything came out as expected. Using the side-by-side view, I referred to an untouched version of the original document (opened in compatibility mode). So I sat there and repeatedly pushed my new macro button and majority of the time the Mathml code would be translated into equations. I could confirm with a quick glance in the side-by-side view that the translations were successful.

Comments:
a. Some accent marks came out a bit weird, but no reason to edit them per se.
c. Some accent marks were almost invisible although they had entry fields created for them in the Word 2007 equations. I would manually fix those. After some trial and error I became quite proficient in editing equations in Word 2007.
b. Out of the approx. 700 equations, 10 Mathml translations did not translate. I re-did those manually.
c. If an equation was originally in a bulleted list, the Mathml code would now be in a long bulleted list. I would select the whole block of Mathml code, make it un-bulleted, move the cursor in front of the Mathml code, and then push the macro button.
d. This proceduce caused paragraphs to be broken into parts when the original MathType equations were in-line (inside paragraphs of text). This required some deletion of whitespace to re-assemble the paragraphs.
e. This took about 2 hours, but my team is now able to be much more productive. Here I am also measuring the productivity impact on my business when errors are made in documentation of mathematical formulations. These will make it into software products and cause all kinds of issues, worries, and possibly financial harm. These are errors that are frequently made when people are editing cryptic Latex source code, or when using the MathType capability with Word. In the latter case it is most often due to the equations they are working with on the screen being rendered worse than the surrounding text and/or the user has to focus on entering equations very carefullly as not to trigger software issues that arise when 100s of equations are present.

I hope this helps other users who want to do the same migration. I did my best to check this for errors, and ask that those who spot errors or know of simpler methods please write about it.
Thanks

Dadi Gudmundsson

Comments

  • Anonymous
    September 07, 2007
    Thanks for all the detailed info - the new Eq editor seems to be a major step up. One thing I can't seem to find online is how to convert good old MS Equation 3.0 style equations into the new format. Is this possible somehow without using MathType? -pgk

  • Anonymous
    September 12, 2007
    I guess posting in a seven month old post doesn't bode well for my chances.. Are these comments still being read? -pgk

  • Anonymous
    July 17, 2008
    I received the following message when trying to print in MicroSoft Word.....   "Only one math type command can be executed at a time.  Please try again later." What does this mean?

  • Anonymous
    February 03, 2009
    The link to the instructions for fixing the "paste special" macro problem appears to be broken.  Any chance of inserting the actual instructions?

  • Anonymous
    April 03, 2009
    The comment has been removed

  • Anonymous
    May 08, 2009
    Does anyone know how to insert an under tilde (like a tensor symbol) in the Word 2007 Equation Editor?

  • Anonymous
    February 16, 2010
    The comment has been removed

  • Anonymous
    February 16, 2010
    To insert an under tilde, type the base character, e.g., z, followed by 330 <alt+x><space>. The number 330 is the Unicode character code for an under tilde combining mark, <alt+x> converts the number into that character and the <space> builds up the accent object. In Word 2007, the under tilde is too far to the right, since under accents weren't supported well. In Word 2007 the placement is centered under the base, which looks better. Unfortunately the under tilde doesn't stretch for multicharacter bases the way the over tilde and other over accents do. That feature could be added if there's need for it. Sorry about not responding to earlier comments. I didn't know about them since I didn't have email notifications enabled. RE the old Word EQ format, I don't know of a way to translate them into the new equation format.

  • Anonymous
    November 20, 2010
    The link to the instructions for fixing the "paste special" macro problem appears to be broken.  Any chance of inserting the actual instructions or some other link?

  • Anonymous
    August 23, 2011
    I tried the above for Word 2010 and the latest MathType without success. However there is a commercial software add-on which you can try like 10 times for free which can convert all mathtype equations to Word 2010 equations for you, its called GrindEQ. I had to first use MathType to convert my old style Word equations to MathType equations and then use GrindEQ to convert to Word 2010 equations. For a 150 page document containing hundreds of equations this took hours and I let it run over night :) but it did work in the end.

  • Anonymous
    October 12, 2015
    It is very helpful. It works with office 2013 too. There is a quote missing at end of following sentence. c. Find "<mml:math" and replace with "<mml:math xmlns:mml="www.w3.org/.../MathML " "