# What are the rules in typesetting mathematical fractions?

What are the rules for typesetting superscript, subscript and fractions (as in a/b but with an horizontal fraction bar)?

I am centring the subscript on the baseline, the superscript on the cap height and the fraction bar on the x height. Latex appears to be doing that as well.

What I haven't figured out is how to position the numerators and denominators relative to the fraction bar. I know the bounding box of the numerator and denominator, but how much spacing should there be with the fraction bar?

I can access all the regular metrics of the font (ascender, descender, leading, cap-height, x-height).

Edit: (based on appendix g) As far as I can tell, the distance between the fraction bar and the numerator/denominator box is three times the fraction bar thickness.

It seems to me that this would not produce a symmetrical output if the font descent value is different from the ascent value minus the cap height value. I mean the apparent distance between the fraction bar and the bottom of the numerator text, and, the distance between the fraction bar and the top of the denominator text.

Visually either the numerator or denominator would appear further away from the fraction bar even if both contain the same text.

• This is for a non-tex typesetter? The exact rules that TeX uses are explained in appendix G of the texbook – David Carlisle Jul 11 '14 at 20:49
• Yes, it's for my own (simple) typesetter. I assume you mean this appendix? – user965972 Jul 11 '14 at 20:53
• yes, although I hadn't seen that expanded version rules 15a-15e in the TeXbook original appendix. – David Carlisle Jul 11 '14 at 21:09
• Asymetry can be corrected by adding a \mathstrut to both numerator and denominator. – John Kormylo Jul 12 '14 at 20:39