I wanted to play with delimiter sizing without using the \delimiterfactor
, -shortfall
, etc. and made the following:
\newdimen\bigdim \bigdim = 1.9743ex
\newdimen\Bigdim \Bigdim = 2.671ex
\newdimen\biggdim \biggdim = 3.3678ex
\newdimen\Biggdim \Biggdim = 4.0646ex
\def\fence#1#2#3{
\setbox0\hbox{$\displaystyle #3$}
\ifdim\ht0 < .9\bigdim #1\box0 #2\else
\ifdim\ht0 < .9\Bigdim \bigl#1\box0\bigr#2\else
\ifdim\ht0 < .9\biggdim \Bigl#1\box0\Bigr#2\else
\ifdim\ht0 < .9\Biggdim \biggl#1\box0\biggr#2\else
\ifdim\ht0 < .9\Biggdim \Biggl#1\box0\Biggr#2\else
\left#1\box0\right#2
\fi\fi\fi\fi\fi}
\def\args(#1){\fence(){#1}}
$$
\args(bar\args(baz))
$$
\bye
(before you push that comment-button, I know there should be \mathsurround=0pt
and such in there, I just wanted to keep this simple) but this results in an error saying the argument of \args
has an extra }
.
I thought it would have something to do with macro argument delimiters, so made a quick test:
\def\foo(#1){(#1)}
\foo(bar\foo(baz))
\bye
but that seemed to work just fine. Now I don't know what else could be the issue. Note that if there isn't an \args
inside of \args
, it works.