As I understand it, \mathpalette takes two arguments; the first must be a macro A that itself takes two arguments. A will be passed as #1 commands to reproduce the math enviroment at the location where \mathpalette was invoked; and A will be passed as #2 the second argument passed to the invocation of \mathpalette. For instance:
\newcommand\A[2]{\hbox{$\m@th#1(#2)$}}
...
$$\mathpalette\A2$$
Will display a (2) in the same math environment as 2 inhabited on the last line. (Here, that is a displaystyle environment.)
So far, so good. My problem is that I want to work with a macro like A that needs additional parameters. My strategy for solving this was to keep A as a 2-argument macro (making \mathpalette happy) but to have A invoke a further macro, but only partially supplying the arguments it wants. The rest of the arguments should be read from the position in the stream following the invocation of \mathpalette. For example:
\newcommand\A[2]{\B#1#2}
\newcommand\B[3]{\hbox{$\m@th#1(#2,#3)$}}
...
$$\mathpalette\A23$$
\mathpalette will invoke A with the current math environment settings in #1 and with 2 in #2. A should then pass those arguments on to B, and B should read 3 as its third argument, yielding the output (2,3).
But this doesn't compile. It gives the error:
! Argument of \B has an extra }.
I can get it to compile but sticking \expandafter or \relax at the end of the definition of \A, but I don't fully understand what I'm doing, and none of my monkeying around is getting this to deliver the desired output of (2,3).

\mathpalette, but doesn't address what I'm trying to do: find a workaround to using it with macros that take more than 2 arguments. – dubiousjim Aug 02 '14 at 03:47\mathchoicedirectly. – Leo Liu Aug 02 '14 at 05:37