![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
Aditya Mahajan wrote:
The syntax can be made identical (even better) than that of amsmath.
\def\xrightarrow{\dosingleempty\doxrightarrow}
\def\xleftarrow {\dosingleempty\doxleftarrow}
\def\doxrightarrow[#1]{\dodoublegroupempty\dodoxrightarrow{#1}}
\def\doxleftarrow[#1]{\dodoublegroupempty\dodoxleftarrow{#1}}
\def\dodoxrightarrow#1#2{\mathrel {{\domthxarr0359\rightarrowfill{#1}{#2}}}}
\def\dodoxleftarrow#1#2{\mathrel {{\domthxarr3095\leftarrowfill{#1}{#2}}}}
\starttext $$ A \xrightarrow[]{stuff on top} B $$
$$ A \xrightarrow[stuff below]{} B $$
\startformula A \xleftarrow[stuff below]{stuff on top} B \stopformula
$$ A \xleftarrow B $$ $$ \rightarrow A \xrightarrow{stuff on top} B \leftarrow $$
$$ \rightarrow A \xleftarrow[stuff below] B \leftarrow $$
\stoptext
hm, this is not the context way, two equal kind of contents and then one of them in [], maybe \def\xrightarrow{\doifnextcharelse[\noxrightarrow\doxrightarrow} \def\xleftarrow {\doifnextcharelse[\noxleftarrow\doxleftarrow} \def\doxrightarrow{\dodoublegroupempty\dodoxrightarrow} \def\doxleftarrow {\dodoublegroupempty\dodoxleftarrow } \def\noxrightarrow[#1]{\dodoublegroupempty\dodoxrightarrow{#1}} \def\noxleftarrow [#1]{\dodoublegroupempty\dodoxleftarrow {#1}} which accepts \xrightarrow{x}{y} \xrightarrow{x} \xrightarrow{}{y} \xrightarrow[x]{y} etc, actyally, we should then also accept \xrightarrow[x][y] but more interesting is to use the optional arg for tuning purposes \if0#1\else\mkern#1mu\fi test, does a \mkern0mu hurt?
Will make copy paste a bit easier! Though these days I find myself writing more in context and soon will face the reverse problem. I will need to copy context math into latex (needed for final journal submission) and some of the math features are simply missing from latex :)
Hans ----------------------------------------------------------------- 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 -----------------------------------------------------------------