10

The TeXbook says that fractions are Inner atoms. But if so, they don't seem to have thin spaces on either side when Inner atoms have them. For instance, in

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\[
a\frac{b}{c}d
\qquad 
a{\frac{b}{c}}d
\qquad 
a\mathinner{\frac{b}{c}}d
\]
\end{document}

I see more space around the third fraction (which I've explictly made an Inner atom) than around the first fraction, and I see the same amount of space around the second fraction (which I've explicitly made an Ord atom) and around the first fraction. What's going on?

If I used ordinary LaTeX 2e without amsmath or any other packages, or if I did this in plain TeX with {b\over c}, would I get a different result?

2
  • 4
    That's a lie in the TeXbook, as a couple of \showlists make apparent.
    – egreg
    Nov 9, 2013 at 23:18
  • but the TeXbook also says that mathinner fractions will be treated with additional space.
    – doed
    Nov 10, 2013 at 1:50

2 Answers 2

8

Let's try a simple situation:

\showboxdepth=1000 \showboxbreadth=1000
$
x{a\over b}x
{a\overwithdelims()b}x
\mathinner{a\over b}x
\showlists$

\bye

The output in the log file is

### math mode entered at line 2
\mathord
.\fam1 x
\mathord
.\fraction, thickness = default
.\\mathord
.\.\fam1 a
./\mathord
./.\fam1 b
\mathord
.\fam1 x
\mathord
.\fraction, thickness = default, left-delimiter "28300, right-delimiter "29301
.\\mathord
.\.\fam1 a
./\mathord
./.\fam1 b
\mathord
.\fam1 x
\mathinner
.\fraction, thickness = default
.\\mathord
.\.\fam1 a
./\mathord
./.\fam1 b
\mathord
.\fam1 x
### horizontal mode entered at line 2
\hbox(0.0+0.0)x20.0
spacefactor 1000
### vertical mode entered at line 0
prevdepth ignored

It's pretty much evident that a fraction is turned into a \mathord atom unless it's in the argument of \mathinner.

A simpler

$a\over b\showlists$

produces

### math mode entered at line 2
\mathord
.\fam1 b
this will be denominator of:
\fraction, thickness = default
\\mathord
\.\fam1 a
### horizontal mode entered at line 2
\hbox(0.0+0.0)x20.0
spacefactor 1000
### vertical mode entered at line 0
prevdepth ignored

It's true that the TeXbook explicitly tells that fractions are considered as Inner atoms; in tex.web module 761 the case switch for the second pass over a math list has

fraction​​*noad* : begin *t* ← *inner*​noad ; sfraction​*noad*​size ;
    end

which should mean what's intended in the TeXbook. On the other hand, it's clear that the fractions are considered as Ord atoms.

This seems to be however the intended meaning. Here's an excerpt from texbook.tex (corresponding to page 60); in the output no thin space is set before the fractions.

3510 just after a new magnification has taken effect. This adjusts the line width
3511 so that the material on each page will be $6{1\over2}$ inches wide when it
3512 is finally printed, regardless of the magnification factor.
3513 There will be an inch of margin at both left and right,
3514 assuming that the paper is $8{1\over2}$ inches wide.

enter image description here

2
  • So \frac should not be prefixed by \mathinner?
    – Eli4ph
    Jul 17, 2019 at 8:38
  • 1
    @Eli4ph If you prefer doing it, do.
    – egreg
    Jul 17, 2019 at 9:45
4

This was one of the changes in the 2021 tune-up: to document that fractions are (except for the simplest case when no groups are involved) treated as Ord atoms, not Inner. It was reported by Sophie Alpert. A small related change to tex.web is listed at https://tug.org/texmfbug/tuneup21bugs.html#C956 ...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .