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

Aditya Mahajan adityam at umich.edu
Mon Feb 19 16:51:07 CET 2007


On Sat, 3 Feb 2007, Taco Hoekwater wrote:

>
>
> It is cleaner when renamed a little:
>
> Taco Hoekwater wrote:
>> 
>> \def\binrel@#1%
>  \def\preparebinrel#1%
>>    {\begingroup
>>     \setbox0=\hbox
>>        {\thinmuskip 0mu
>>         \medmuskip -1mu
>>         \thickmuskip -1mu
>>         \setbox2=\hbox{$#1\mathsurround0pt$}%
>>         \kern -wd2
>>         ${}#1{}\mathsurround0pt$}%
>>     \edef\@tempa
>>       {\endgroup
>>        \let\noexpand\binrel@@
>         \let\noexpand\currentbinrel
>>        \ifdim\wd0<0pt
>>          \mathbin
>>        \else \ifdim\wd0>\z@
>>           \mathrel
>>        \else
>>           \relax
>>        \fi\fi }%
>>     \@tempa  }
>
> And:
>
> \unexpanded\def\overset#1#2%
>   {\preparebinrel{#2}%
>    \currentbinrel{\mathop{\kern\z@#2}\limits^{#1}}}
>

There was another request (although misguided) for overset in the 
mailing list today. I think that the following macros can go into the 
core: (Taco's version, with a typo corrected).

%D \macros{overset, underset}
%D
%D The macros \type{\overset} and \type{\underset} are provided by
%D \AMS\ packages in \LATEX. These macro allows you to place a symbol
%D above or below another symbol, irrespective of whether the other
%D symbol is a relation or something else, and without influencing the
%D spacing.  For most cases there is a better way to do such things
%D (declaring a math command with limop option, or using accents), but
%D occasionally these macros can be useful, for example
%D
%D \startbuffer
%D \startformula
%D \overset{*}{X} \underset{*}{X}
%D \stopformula
%D \stopbuffer
%D \typebuffer \getbuffer
%D
%D Use these macros sparingly. Remember, \TEX\ was designed for
%D mathematics, so there is usually a proper method for typesetting
%D common math notation.

%D These macros are a clearer version of \type{\binrel@} and
%D \type{\binrel@@} macros in \AMSTEX\ packages.

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

\unexpanded\def\overset#1#2%
     {\preparebinrel{#2}%
      \currentbinrel{\mathop{\kern\z@#2}\limits^{#1}}}

\unexpanded\def\underset#1#2%
     {\preparebinrel{#2}%
      \currentbinrel{\mathop{\kern\z@#2}\limits_{#1}}}


Aditya


More information about the dev-context mailing list