# Formal term for LaTeX shorthand

It is possible in LaTeX to write expressions like \frac12, which should be equivalent to expressions like \frac{1}{2}. Is there a formal term for the first form of notation?

• Welcome to TeX.SX! The form \frac12 works because the argument to an undelimited TeX macro (like \frac) is either a single token (1 is a single token, for example) or, a group of tokens delimited by {...}, in which case the outer braces are removed. That's why both forms are equivalent. However there isn't a special name to one of them... – Phelype Oleinik Aug 1 '19 at 2:12
• Braces for macro arguments in TeX work similar to braces for statements in languages like C or JavaScript: they just group several of them to a single unit. While always using braces is generally considered a good coding style in LaTeX, as it improves readability, from the compiler's perspective the braces in \frac{1}{2} are just "more work to do", because it's unnecessary to group a single token. – siracusa Aug 1 '19 at 3:01
• @siracusa I am not agree at all. I remember that a time ago David Carlisle said to me that if removing braces there is a chance to break math in multiple lines. That's why the use of braces is always a good practise. – manooooh Aug 1 '19 at 4:07
• @manooooh that is a different thing. ${ 1 = 0 }$ the braces act essentially like an implicit \hbox and prevent linebreaking and space stretching, but braces used as macro argument delimiters are a different thing entirely. – David Carlisle Aug 1 '19 at 7:00
• @manooooh none at all to latex, at the tex layer it is impossible to detect if a single token macro argument is used with braces. But to human readers, syntax checkers and highlighters and latex to - whatever convertors, it is far better to stick to the documented syntax. – David Carlisle Aug 1 '19 at 8:23

No.

This is just part of the normal way TeX absorbs non-delimited macro arguments. If you define

\def\foo#1{Something using #1 (or not).}


or equivalently

\newcommand\foo[1]{Something using #1 (or not).}


when \foo is expanded, it absorbs the next token or balanced group in the input stream as its argument (which is available as #1 in the definition). Assuming normal category codes

• a token is a single character (except \, {, }, % or a space or newline (since those are ignored)) or a command sequence (something starting with \),
• a balanced group starts with { and ends with the first } that does not belong to a different group (that started later). The braces are stripped from the group upon absorption (that is, #1 does not contain them).


It is good practice to choose the version that is clearest, which usually means using a group. Personally, I explicitly omit the group in cases where I have to input a single token, like \newcommand\foo.

It might be worth adding that distinguishing between single-token arguments and arguments in braces is more explicit in LaTeX3/expl3. By convention, every expl3 macro name should end in : followed by a sequence of letters, called argument specifiers, each reflecting the type of the corresponding argument.

Beside many others we have

• n for braced-group or single-token arguments, and
• N for single-token arguments only, usually macro/function names or variable names.

Those specifiers still don't change the way (La)TeX processes the individual arguments, but it gives a hint to the user about how the arguments are used inside the macro.

For example, the l3tl package provides two functions \tl_if_empty:nTF and \tl_if_empty:NTF. While both functions check if a token list is empty and execute code conditionally, the former is expected to be called with a braced group of tokens, where the latter expects a token list variable that is first expanded before the test is performed on its contents.