Fence/delimiter stored inside in a macro

I'm wondering, say I have this definition

\newcommand\restrictedTo{\vert\sb}


to be used as $f \restrictedTo A$.

This works fine, but

$f \big \restrictedTo A$


fails, whereas

$\left. f \right \restrictedTo A$


work just fine.

Any suggestions for a better definition for \restrictedTo?

Edit: here is a full MWE:

\documentclass[a4paper]{article}
\newcommand\restrictedTo{\vert\sb}
\begin{document}
$f \big\restrictedTo A$
\end{document}

-

David has already explained, that \big takes an argument, what breaks the original definition after \big. An alternative for redefining \big (and \Big, …) is to give \restrictedTo an optional argument:

\documentclass[a4paper]{article}
\newcommand*\restrictedTo[1][]{#1\vert\sb}
\begin{document}
$f \restrictedTo A, f \restrictedTo[\big] A, f \restrictedTo[\Big] A$
\end{document}


If you only want to have a lower position of A, then you would not need \big and the definition and usage can be simplified:

\documentclass[a4paper]{article}
\newcommand*\restrictedTo{{{}\vert}\sb}

\begin{document}
$f \vert_A, f \restrictedTo A, f \big\vert_A$
\end{document}


-
That was what I did, just hoped there was a better solution – daleif Sep 19 '12 at 12:39

\right is a TeX primitive which expands tokens ahead of itself until it finds a non-expandable delimiter.

\big is a normal macro command that reads the next token as #1

\def\big#1{{\hbox{$\left#1\vbox to8.5\p@{}\right.\n@space$}}}


so you could go

\expandafter\big \restrictedTo


But that isn't really very convenient.

It is probably safe in practice (although could break some things) to go

\let\oldbig\big
\def\big{\expandafter\oldbig}


then your initial example would work.

-