[NTG-context] extentable arrows

Aditya Mahajan adityam at umich.edu
Thu Jun 29 01:07:29 CEST 2006


On Wed, 28 Jun 2006, Taco Hoekwater wrote:

> Aditya Mahajan wrote:
>> \xrightarrow{big superscipt}
>>
>> Any suggestions?
>
>
> Not completely identical, but similar.
>
> Cheers, Taco
>
>
> \def\domthxarr#1#2#3#4#5#6#7%
>   {\begingroup
>    \mathsurround\zeropoint
>    \setbox0\hbox{$\scriptstyle
>                   \if0#1\else\mkern#1mu\fi
>                   \mkern#3mu#7\mkern#4mu
>                   \if0#2\else\mkern#2mu\fi $}%
>    \setbox4\hbox{#5}%
>    \dimen0\wd0
>    \ifdim\wd4>\dimen0 \dimen0\wd4 \fi
>    \setbox2\hbox{$\scriptstyle
>                  \if0#1\else\mkern#1mu\fi
>                  \mkern#3mu#6\mkern#4mu
>                  \if0#2\else\mkern#2mu\fi $}%
>    \ifdim\wd2>\dimen0 \dimen0\wd2 \fi
>    \setbox4\hbox to \dimen0{#5}%
>    \mathord{\vcenter{{\offinterlineskip
>      \hbox to \dimen0{\hss\box0\hss}%
>      \kern .2ex
>      \hbox to \dimen0{\hss\copy4\hss}%
>      \kern .2ex
>      \hbox to \dimen0{\hss\box2\hss}}}}%
>    \endgroup}
>
> \def\xrightarrow{\dodoubleempty\doxrightarrow }
>
> \def\xleftarrow {\dodoubleempty\doxleftarrow }
>
> \def\doxrightarrow[#1][#2]{\mathrel
>   {{\domthxarr0359\rightarrowfill{#1}{#2}}}}
>
> \def\doxleftarrow[#1][#2]{\mathrel
>   {{\domthxarr3095\leftarrowfill{#1}{#2}}}}

Thanks Taco! However, the arrow is not centered when there is only 
subscript or superscript. Compare the height of arrows in the 
following.

$$
  \rightarrow A \xrightarrow[][stuff on top] B \leftarrow
$$


$$
  \rightarrow A \xleftarrow[stuff below][] B \leftarrow
$$

How about,

\def\domthxarr#1#2#3#4#5#6#7%
    {\begingroup
     \mathsurround\zeropoint
     \setbox0\hbox{$\scriptstyle
                    \if0#1\else\mkern#1mu\fi
                    \mkern#3mu#7\mkern#4mu
                    \if0#2\else\mkern#2mu\fi $}%
     \setbox4\hbox{#5}%
     \dimen0\wd0
     \ifdim\wd4>\dimen0 \dimen0\wd4 \fi
     \setbox2\hbox{$\scriptstyle
                   \if0#1\else\mkern#1mu\fi
                   \mkern#3mu#6\mkern#4mu
                   \if0#2\else\mkern#2mu\fi $}%
     \ifdim\wd2>\dimen0 \dimen0\wd2 \fi
     \setbox4\hbox to \dimen0{#5}%
     \mathrel{\mathop{%
       \hbox to \dimen0{\hss\copy4\hss}}%
       \limits^{\box0}_{\box2}}
%     \mathord{\vcenter{{\offinterlineskip
%       \hbox to \dimen0{\hss\box0\hss}%
%       \kern .2ex
%       \hbox to \dimen0{\hss\copy4\hss}%
%       \kern .2ex
%       \hbox to \dimen0{\hss\box2\hss}}}}%
     \endgroup}


I am simply trying to copy from amsmath definition.

Aditya


More information about the ntg-context mailing list