How can extract MathML from GIF image generated by MathType

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/


Then I @ Bob in StackOverFlow. About an hour later,Afwings answered my question and asked me to upload the full block of MathML. Maybe Afwings is nickname for Bob Mathew(Afwings is Bob indeed! 11/07/08). Then I uploaded related MathML text and GIF image. Eventually, Afwings gave me the perfect answer, as below:


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.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值