Aditya Mahajan wrote:
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}
ok, added in the following disguise: \def\preparebinrel#1% {\begingroup \setbox\scratchbox\hbox {\thinmuskip 0mu \medmuskip -1mu \thickmuskip -1mu \setbox\scratchbox\hbox{$#1\mathsurround\zeropoint$}% \kern-\wd\scratchbox ${}#1{}\mathsurround\zeropoint$}% \expanded {\endgroup \let\noexpand\currentbinrel \ifdim\wd\scratchbox<\zeropoint \mathbin \else\ifdim\wd\scratchbox>\zeropoint \mathrel \else \relax \fi\fi}} ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------