2

edit

I need the HORIZONTAL WIDTH

Vertical is easy -- it's just xi8

background

I am trying to understand how TeX computes the width of the fraction line in { top \over b }

what I have tried so far

I have looked at Appendix G Illuminated https://www.tug.org/TUGboat/tb27-1/tb86jackowski.pdf

I have also looked at rules 15-15e on pages 444/445 of the TeX book: http://www.ctex.org/documents/shredder/src/texbook.pdf

the problem I run into

The rules basically state:

render the top part in correct size render the bot part in correct size

create line of HEIGHT theta (but does not specify WIDTH)

put in some spacing to avoid collisions

However, what I can't find is: given a font-size, as well as the bounding boxes of the top;/bot boxes, how do I calculate the WIDTH of the fraction line?

Thanks!

  • The horizontal or vertical width? – egreg Sep 11 '17 at 17:15
  • I need the horizontal width. Vertical is just xi8 / theta, as documented in rule 15d. – user47368 Sep 11 '17 at 17:22
3

The width is just the maximum width of numerator and denominator:

$$
\vrule height 7pt
\mkern 6mu
\vrule height 7pt
\over
\vrule height 7pt
\mkern 12mu
\vrule height 7pt
$$
\bye

I used \vrule so there is no sidebearing.

enter image description here

Without going into the details, the width of a fraction is a bit more than the width of the fraction line. This guarantees that in constructions such as

{a\over b}\over{a\over b}

the width of the main fraction line is more than the width of the secondary ones.

\def\testnum{
  \vrule height 7pt
  \mkern 6mu
  \vrule height 7pt
}
\def\testden{
  \vrule height 7pt
  \mkern 12mu
  \vrule height 7pt
}

\setbox0=\hbox{$\displaystyle{\testnum\over\testden}$}

\showthe\wd0

\setbox0=\hbox{$\textstyle\testden$}

\showthe\wd0

\bye

This shows

> 9.86649pt.
l.14 \showthe\wd0

? 
> 7.46649pt.
l.18 \showthe\wd0

? 
  • I must be misunderstanding something else then. Why is it that when I do : $ \frac {\frac{abc}{abc}} {\frac{abc}{abc}} $ that the middle line is LONGER than both the top and the bottom lines ? – user47368 Sep 11 '17 at 17:28
  • @user47368 No, it's just that the top and bottom fractions are considered Inner atoms and some space around them is added. – egreg Sep 11 '17 at 17:30
  • I guess this is now a separate question -- if you don't mind, can you point me at which rules specify inner atom spacing? – user47368 Sep 11 '17 at 17:33
  • Lol, found details at tex.stackexchange.com/questions/144159/… -- another answer by you. – user47368 Sep 11 '17 at 17:34
  • 1
    Your example {a\over b}\over{c\over d} is no surprising. The rule 15e says that: finally the fraction-box is enclosed by delimiters. If \over primitive is used, then null delimiters are here, i.e. \nulldelimiterspaces. So, the sub-fraction {a\over b} is enclosed by \nulldelimiterspaces and {c\over d} is enclosed too. After this, the main fraction is constructed: its width is wider by 2x\nulldelimiterspace than the width of internal fractions. – wipet Sep 11 '17 at 18:58
1

Appendix B of TeXbook, rule 15d: ...Finally construct a vbox ... consisting of box x followed by a kern followed by an hrule of height theta followed by box z.

Because hrule in vbox gets the width of maximum width of boxes in it, the resulting width has maximum of width of boxes x and z. Moreover, boxes x and z have the same width at this moment equal to maximum of width of numerator and denominator, see rule 15a.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.