Last two days,I encountereda technical problem. When I extracted MathML from GIF image generated by MathType, there were always junk characters in the MathML text.
I had discussed this problem with my colleague, he told me to replace the MathML text with image.But I thought it was not a perfect solution. Then I tried to get help on the Web. As usual, I searched something in Google. I found an answer in similar question on stackOverFlow :"convert MathML to MathType in MS Word". Fortunately, Bob Mathew who is the developer for MathType answered the question.
Right away, I submitted a question as follows:
How can I convert MathType equation into MathML format?
I want to convert MathType equation saved as GIF format for MathML. Firstly, I opened these GIF files and saved them within MathType 6.7. As a result, MathML text is inserted into the end of GIF files. However, when I extracted MathML text from these GIF files using Perl script, I found some garbled characters in the MathML text as following text:
<mn>xxx</mn>
In the above line, a garbled character is inserted before 'mn' label. Is this MathType 's BUG? How can I work around this problem? I have uploaded my test GIF files. URL is:http://ubuntuone.com/p/1352/
MathML text is embedded into a GIF file as an Application Extension Record, which consists of a 14-byte header (Application Extension Descriptor), followed by the MTEF data. The header contains:
Byte Introducer = 0x21;
Byte ExtensionLabel = 0xFF;
Byte BlockSize = 0x0B;
Byte ApplicationId[8] = "MathType";
Byte AuthenticationCode[3] = "003";
The data follows this header and is written as a series of blocks each containing 255 bytes or less. Each block starts with a single byte count followed by the data. The end is marked as a block with length 0.
The header is unique enough that the easiest way to extract the data might be to scan the file for the 14-byte header, then expect the MathML data blocks to follow. Properly decoding the GIF records isn't that hard either, but obviously requires you read the GIF specification.
It's a wonderful experience for me. The process for the problem-solvingdemonstratesthe power ofsocial networking which link me to the suitable solver for the problem, and cloud computing through which I uploaded related information into cloud. Meanwhile, it showsthe importance of English that make me have the ability to find answer inabroader space across the wall.