[Tex/LaTex] What’s behind \over


Typically a TeX command have arguments coming after it. But the command \over, which is used to produce fractions, can access the token before it. How exactly is it implemented and can I define a custom command like that?

Best Answer

It's a TeX primitive so no you can't define commands like it. It's also a pain in the neck and the cause of many of the problems in math mode, as it means that you can not be sure when you first encounter any math mode token what style things will end up in, hence the need for \mathchoice and various other horrors. If the primitive had had normal prefix syntax like LaTeX's \frac it wouldn't have been necessary.

Related Question