# \renewcommand for \forall to add a parameter

Hi I'm trying to redefine the \forall command so that it accepts an argument instead of using the regular juxtaposition.

What it looks like at the moment is

\renewcommand{\forall}[1]{\forall{(#1)}\;}


which doesn't work on

\forall{(u,v) \in V \times V}


producing the error message:

! TeX capacity exceeded, sorry [input stack size=5000].

\forall #1-&gt;\forall (
#1)\;


However the following works fine albeit would require to substitute every occurrence of \forall in the document:

\newcommand{\all}[1]{\forall{(#1)}\;}


Is there an intrinsic recursiveness in that redefinition?

-

Your definition is a recursion. Do

\documentclass{article}

\let\ForAll\forall
\renewcommand\forall[1]{\ForAll{(#1)}\;}
\begin{document}

$\forall{(u,v) \in V \times V}$

\end{document}

-
Plus, plesae consider writing the for all part as words instead, it makes the text much more readable than having symbols all over the place. – daleif Dec 17 '13 at 12:58
Great, thanks a lot! – user42869 Dec 17 '13 at 13:04

I wouldn't change the semantics of a standard command. It's probably better to define \Forall:

\newcommand{\Forall}[1]{\forall{(#1)}\;}


rather than redefining \forall.

Just for fun, a “\let free” solution of your problem, should you decide to disobey:

\documentclass{article}

\edef\forall#1{\mathchar\number\forall{(#1)}\noexpand\;}

\begin{document}

$\forall{(u,v) \in V \times V}$

\end{document}


A bit more difficult with \renewcommand, but doable:

\expandafter\renewcommand\expandafter\forall\expandafter[\expandafter1\expandafter]%
\expandafter{\expandafter\mathchar\number\forall{(#1)}\;}


or

\begingroup\edef\x{\endgroup
\unexpanded{\renewcommand\forall[1]}{\mathchar\number\forall{(##1)}\noexpand\;}%
}\x

-
show off.......;-) – daleif Dec 17 '13 at 13:46