# Why does MS Word's algorithm for vertical positioning of super- and subscripts not conform to TeX's ?

Microsoft Office has, since 2007, used a formula layout algorithm based on the algorithm Knuth described in appendix G of the TeXbook. But there's an apparent divergence in the final output from the description. The algorithm that MSOffice uses is allegedly based on that as described in the Open Type Math Table. Precise details of this can be found in the paper Open Type Illuminated by Ulrik Vieth (obtainable from the Netherlands' TUG at http://www.ntg.nl/maps/38/03.pdf).

For a screen resolution of 96dpi and a font size of 11pt, the algorithm says to shift the superscript baseline relative to the original baseline by 5 pixels, and the subscript by 3 pixels (up and down, respectively). (For a more precise description of what the algorithm says in this case, please see http://i.stack.imgur.com/ckGL5.png.)

The figure below contains a blown up view of various renderings, with Word's view on the left, the algorithmic reconstruction in the middle, and TeX's rendering on the right:

The three horizontal lines are not from the figures, but are added to highlight the difference and parallelisms between them.

As can be seen in the image, the result obtained for the formula $a^y_y$ following the algorithm described above is different from the result obtained from MS Word. As can also be seen, the algorithm conforms to TeX's implementation fairly well (given the inaccuracies inherent in producing these diagrams, "fairly well" could mean "precisely" here).

Is there another algorithm at work here? Has Knuth's algorithm been superseded? Or is it simply that when placing the superscript y then MSWord chooses to place the bottom of the y at the superscript baseline instead of the baseline of the y?

-
Sorry, I find your question rather confusing. Are you here to discuss the paper you cite, or do you have a specific problem we can help you to solve? In the former case, this may not be the appropriate place. In the latter, please supply an minimum example of your TeX code and describe why you believe the results are incorrect. We may then be able to help you better. – Brent.Longborough Jun 11 '11 at 21:36
I'm just trying to understand how the algorithm for positioning subscripts and superscripts work for a single character according to the Open Type Math Tables from MS. From what I've read so far, this algorithm should be pretty close to the one used by Tex, as you can see in page 45 of Bogusław Jackowski's paper, which can be found at www.ntg.nl/maps/34/09. – bellochio Jun 11 '11 at 22:48
This question seem not to be about TeX and is therefore off-topic. Typesetting algorithms in general or for MS Word in particular are not on-topic. Could you please clarify it further, otherwise it will be closed. – Martin Scharrer Jun 12 '11 at 6:01
Looks to me like you should file a bug report at microsoft instead. – Taco Hoekwater Jun 12 '11 at 7:15
@Martin I posted this question because I need some help and I thought that could be of some interest of some of the users on this forum. If you think the question should be closed, please feel free to do it. – bellochio Jun 12 '11 at 13:26

The question ends with:

Or is it simply that when placing the superscript y then MSWord chooses to place the bottom of the y at the superscript baseline instead of the baseline of the y?

I think this analysis spot on.

The Open Type Math Table documented algorithm is identical to TeX's algorithm in this case. There are a few other mathematical constructs where there are indeed differences, but both algorithms are identical in the case of script placement. This can also be seen in the included image, where Alt and TeX indeed appear identical (within rounding limits).

So, what we have here is MS Word not following the suggested behaviour as published in the Open Type Math Table documentation (also by Microsoft), and therefore I conclude this is a bug in MS Word and as such should be reported to Microsoft (by someone who actually cares, i.e. not me).

-
Surely if the suspicion is that Word uses the bottom of the y instead of the baseline, this would be very easy to check: simply repeat the comparison using a superscript without a descender, such as $a_y^x$. I don't have a recent version of word to test this. – Lev Bishop Jun 18 '11 at 0:54

I cannot answer the question but maybe this rules out one of the possibilities:

This is a rendering of Word 2007, as y and x are one the same baseline the bottom of y is not the decisive element. A comparable TeX rendering shows that the exponents are typeset quite a bit lower than in the Word 2007 case as shown in the image in the question.

-