Using $1\over2$ instead of $\frac{1}{2}$ under amsmath
I see no advantage in using \over
instead of \frac
.
Moreover, $\frac{1}{2}$
and $1\over2$
are different. See the output of texdef -t latex frac
:
\frac:
macro:#1#2->{\begingroup #1\endgroup \over #2}
You can see two things: first an additional set of braces around the fraction and then a “semisimple group” around the numerator.
Let me explain the difference.
The semisimple group around the numerator avoids some glitches that can make assignments meant to hold in the numerator only also in the denominator.
The group around the fraction avoids problems in the syntax.
If you type $1+1\over2$
or $1+{1\over2}$
you get different results; with $\frac{1+1}{2}$
and $1+\frac{1}{2}$
you're sure about what gets where.
I'm not alone in thinking that this is one of the worst design decision made by Knuth about math typesetting; with the \over
syntax you can't predict the math style used in the two parts of the fraction.
The amsmath
package adds another layer, making \frac
robust, so it gets unchanged in moving arguments. It also adds the warning about the “foreign command”.
It prints the same: \frac
is defined in terms of \over
(or rather \@@over
which is the saved primitve) but you would feel better for doing the right thing if you use \frac
.