[Tex/LaTex] Is it wrong to use \frac1{}


When typing math in (La)TeX, I often omit the braces surrounding the first argument to the \frac macro, at least when it's 1, writing things like \frac1{1+x^2}. I initially came by that use while reading a document written by someone else, and thought it was a different macro (which one might define as \newcommand{\frac1}[1]{\frac{1}{#1}}.

Although I now understand the way \frac1 works, I still wonder : is this an acceptable use, or is it generally frowned upon?

Best Answer

Short answer to your question: No, at least not in principle.

Longer answer: Here's the actual definition of the LaTeX command \frac:


What this shows is that LaTeX's \frac command is a (very well-designed) wrapper around TeX's \over command. By the syntax rules of TeX, if the "arguments" of the \frac command are not enclosed in curly braces, TeX will happily treat the first nonblank item/character it encounters after \frac as #1 and the second item as #2. Hence, \frac12 is (to TeX's parser) the same as \frac{1}{2}, and \frac xy -- note the space between the c and the x -- is the same as \frac{x}{y}.

That said, I suspect that if you get into a habit of leaving off the braces whenever the numerator and denominator both consist of a single letter or digit, you'll soon have forgotten that you're employing a shorthand method. Sooner or later, then, you'll write something like \frac 1 12 and start wondering why it's not being rendered as \frac{1}{12}...

Addendum: You mention toying with the idea of creating the one-argument macro


Unfortunately, this isn't going to fly because TeX doesn't let you mix letters and digits in the name of a macro (unless you resort to a \cs... \endcs detour). However, why even bother creating such a one-argument version of the \frac macro? Note that \frac1{<denominator>} is a perfectly valid LaTeX expression: the 1 that follows \frac in \frac1 will be interpreted by TeX as the #1 part of the two-argument macro -- which is exactly what you want, correct?

Related Question