What LaTeX macros cannot accept a group as an argument?
All TeX macros take brace groups around their arguments, which may be omitted if the argument is a single token, although in the case of delimited arguments that group may not be where you mean.
\def\foo#1#2{...}
then \foo12
, \foo 1 2
, \foo{1}{2}
, \foo{1} {2}
are all equivalent.
\def\foo(#1,#2){...}
then \foo(1,2)
, \foo({1},{2})
, \foo(1,{2})
, are all equivalent.
TeX primitives do not have optional braces in this way.
\hbox{a}
the braces are mandatory \hbox a
is a syntax error, however the brace can be implicit \hbox\bgroup a}
is OK.
\hskip 5pt
takes no braces, \hskip{5pt}
is a syntax error
\def\foo{zzz}
must have no brace around the token being defined,
Some commands documented as taking arguments do not, so for example \section
is a macro which takes no arguments it just looks ahead for *
or [
calling appropriate macros in each case, so
\section*[short]{l}
could be written as \section*[{short}] l
but not \section{*}[short]{l}
Some packages redefine ^
and _
to be macros and take arguments with optional brace groups as above, but the primitive behaviour is "interesting" as tex expands looking for possibly implicit braces so for example x^\mathrm x
is x^{\mathrm{x}}
and x^\frac12
is x^{\frac{1}{2}}
as the first level expansions of \mathrm
and \frac
provide the {}
group needed for the superscript.
This is not a complete answer but anything that uses \@ifnextchar
can cause problems. I borrowed \CheckMinus
from this answer.
\documentclass{article}
\makeatletter
\def\CheckMinus{\@ifnextchar-{got a minus}{no minus}}
\makeatother
\begin{document}
$\left(1\right)$ % works
%$\left{(}1\right{)}$ % doesn't work
\CheckMinus-
\CheckMinus{-}
\end{document}
Quite a few TeX "primitives" take arguments that must not be delimited in a group.
Text-mode and math-mode kerning commands:
\kern
and\mkern
, which take 1 argument each.a\kern1em a $a\mkern18mu a$
are both ok, but
a\kern{1em} a
and$a\mkern{18mu} a$
are not.The commands
\raise
and\lower
, which take 2 arguments each, the first of which must be a length variable and the second of which must be a (TeX) box.a\raise1ex\hbox{c}
is ok, but
a\raise{1ex}\hbox{c}
,a\raise1ex{\hbox{c}}
, anda\raise{1ex}{\hbox{c}}
are not.The LaTeX counterpart to
a\raise1ex\hbox{c}
is\raisebox{1ex}{c}
, which also takes two arguments. Clearly, with\raisebox
is allowed -- and, depending on the arguments, may in fact be required.