[dev-context] \rm in pmod, bmod, etc

Taco Hoekwater taco at elvenkind.com
Sat Feb 3 09:19:38 CET 2007


Aditya Mahajan wrote:
> 
> Another one: Nath defines \stackrel and \underset. I think that these 
> should go to the core
> 
> \def\stackrel#1#2{\mathrel{\mathop{#2}\limits^{#1}}}
> 
> See the note below:
> 
> \def\overset#1#2{\mathrel{\mathop{#2}\limits^{#1}}}
> \def\underset#1#2{\mathrel{\mathop{#2}\limits_{#1}}}
> 
> amsmath.sty goes into a lot of pains to define overset and underset, 
> basically to decide whether to use mathrel or mathbin in the above. Do 
> we need such an elaborate definition? This is amsmath's definition:

Yes, I believe that is wise. Spacing around ords and bins and rels is
different, and \overset and \underset should not influence that spacing.

The \binrel@ macro is ugly, but the most efficient and robust way
of testing this is through trial typesetting. \binrel@ changes
the definition of \binrel@@ to be one of \mathbin, \mathrel, or
\relax, as needed.

So, better to put the ams definition in the core. Assuming I didn't
make any typos, it should look like this:

\def\binrel@#1%
   {\begingroup
    \setbox0=\hbox
       {\thinmuskip 0mu
        \medmuskip -1mu
        \thickmuskip -1mu
        \setbox2=\hbox{$#1\mathsurround0pt$}%
        \kern -wd2
        ${}#1{}\mathsurround0pt$}%
    \edef\@tempa
      {\endgroup
       \let\noexpand\binrel@@
       \ifdim\wd0<0pt
         \mathbin
       \else \ifdim\wd0>\z@
          \mathrel
       \else
          \relax
       \fi\fi }%
    \@tempa  }


Best, taco

> 
> \def\binrel@#1{\begingroup
>    \setboxz at h{\thinmuskip0mu
>      \medmuskip\m at ne mu\thickmuskip\@ne mu
>      \setbox\tw@\hbox{$#1\m at th$}\kern-\wd\tw@
>      ${}#1{}\m at th$}%
>    \edef\@tempa{\endgroup\let\noexpand\binrel@@
>      \ifdim\wdz@<\z@ \mathbin
>      \else\ifdim\wdz@>\z@ \mathrel
>      \else \relax\fi\fi}%
>    \@tempa
> }
> 
> \newcommand{\overset}[2]{\binrel@{#2}%
>    \binrel@@{\mathop{\kern\z@#2}\limits^{#1}}}
> \newcommand{\underset}[2]{\binrel@{#2}%
>    \binrel@@{\mathop{\kern\z@#2}\limits_{#1}}}
> 
> 
> Aditya
> 
> 
> 
> _______________________________________________
> dev-context mailing list
> dev-context at ntg.nl
> http://www.ntg.nl/mailman/listinfo/dev-context



More information about the dev-context mailing list