2

LaTeX defines \frac as

\DeclareRobustCommand\frac[2]{{\begingroup#1\endgroup\over#2}}

i.e. the fraction is created using \over surrounded by a brace group to contain its effect. The TeXbook states on page 155

There’s also an eighth classification, \mathinner, which is not normally used for individual symbols; fractions and \left...\right constructions are treated as “inner” subformulas, which means that they will be surrounded by additional space in certain circumstances.

This leads me to expect that the result of \frac{1}{2} would be a \mathinner atom. However, the following MWE shows that it's not.

\documentclass{article}

\begin{document}

(\frac{1}{2} (3 + 4 + 5))

(\mathord\frac{1}{2} (3 + 4 + 5))

(\mathinner\frac{1}{2} (3 + 4 + 5))

\end{document}

MWE output

So it seems that the brace group inserted by \frac does not create a \mathinner atom but rather a \mathord one, like any other subformula.

  • Seeing as \over needs to be enclosed in a brace group to limit its effect, when does a fraction ever create an "inner" subformula? What are the "certain circumstances" the TeXbook refers to?
  • Is there any harm in prepending \mathinner to the definition of \frac, making it actually produce \mathinner atoms?
schtandard
  • 14,892
  • 1
    first bullet point a good question I thought perhaps \overwithdelims might work more like \left\right but I couldn't make an example, and I got lost reading the web code, it does use a inner_noad at one point (fraction_noad: begin t:=inner_noad; s:=fraction_noad_size;) but after that I got lost following the logic. For the second bullet point https://tex.stackexchange.com/a/173740/1090 – David Carlisle Nov 14 '20 at 11:23
  • 1
    Related/duplicate: https://tex.stackexchange.com/q/144159/4427 – egreg Nov 14 '20 at 11:39
  • there's a package that turns \fracs into \mathinner: https://www.ctan.org/pkg/mathfixs – Daniel Diniz Nov 22 '22 at 23:59

0 Answers0