On Thu, 29 Jun 2006, Hans Hagen wrote:

> Aditya Mahajan wrote:
>>
>> I am simply trying to copy from amsmath definition.
>>
>
> better think context -)
>
> \unprotect
>
> \def\mtharrfactor{1}
> \def\mtharrextra {0}
>
> \def\domthxarr#1#2#3#4#5#6#7#8%
>  {\begingroup
>   \def\mtharrfactor{1}%
>   \def\mtharrextra {0}%
>   \processaction[#1] % will be sped up
>     [  \v!none=>\def\mtharrfactor{0},
>       \v!small=>\def\mtharrextra{10},
>      \v!medium=>\def\mtharrextra{15},
>         \v!big=>\def\mtharrextra{20},
>      \v!normal=>,
>     \v!default=>,
>     \v!unknown=>\doifnumberelse{#1}{\def\mtharrextra{#1}}\donothing]%
>   \mathsurround\zeropoint
>   \muskip0=#4mu \muskip0=\mtharrfactor\muskip0 \advance\muskip0 \mtharrextra 
> mu
>   \muskip2=#5mu \muskip2=\mtharrfactor\muskip2 \advance\muskip2 \mtharrextra 
> mu
>   \setbox0\hbox{$\scriptstyle
>                  \if#20\else\mkern#2mu\fi
>                  \mkern\muskip0\relax
>                  #8\relax
>                  \mkern\muskip2\relax
>                  \if#30\else\mkern#3mu\fi
>                 $}%
>   \setbox4\hbox{#6}%
>   \dimen0\wd0
>   \ifdim\wd4>\dimen0 \dimen0\wd4 \fi
>   \setbox2\hbox{$\scriptstyle
>                  \if#20\else\mkern#2mu\fi
>                  \mkern\muskip0\relax
>                  #7\relax
>                  \mkern\muskip2\relax
>                  \if#30\else\mkern#3mu\fi
>                 $}%
>   \ifdim\wd2>\dimen0 \dimen0\wd2 \fi
>   \setbox4\hbox to \dimen0{#6}%
>   \mathrel{\mathop{%
>     \hbox to \dimen0{\hss\copy4\hss}}%
>     \limits^{\box0}_{\box2}}
>   \endgroup}
>
> % ams:
>
> \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}}
>
> \def\dodoxrightarrow#2#3{\mathrel{{\domthxarr{}0359\rightarrowfill{#1}{#2}}}}
> \def\dodoxleftarrow #2#3{\mathrel{{\domthxarr{}3095\leftarrowfill {#1}{#2}}}}
>
> % context:
>
> \def\xrightarrow  {\dosingleempty\doxrightarrow}
> \def\xleftarrow   {\dosingleempty\doxleftarrow}
>
> \def\doxrightarrow[#1]{\dotriplegroupempty\dodoxrightarrow{#1}}
> \def\doxleftarrow [#1]{\dotriplegroupempty\dodoxleftarrow {#1}}
>
> \def\dodoxrightarrow#1#2#3{\mathrel{{\domthxarr{#1}0359\rightarrowfill{#2}{#3}}}}
> \def\dodoxleftarrow #1#2#3{\mathrel{{\domthxarr{#1}3095\leftarrowfill 
> {#2}{#3}}}}
>
> \starttext
>
> \startformula \xrightarrow{}{stuff on top}\stopformula
> \startformula \xrightarrow{stuff below}{}\stopformula
> \startformula \xrightarrow{stuff below}{stuff on top}\stopformula
>
> \startformula \xleftarrow [none]{stuff below}{stuff on top}\stopformula
> \startformula \xleftarrow [small]{stuff below}{stuff on top}\stopformula
> \startformula \xleftarrow [medium]{stuff below}{stuff on top}\stopformula
> \startformula \xleftarrow [big]{stuff below}{stuff on top}\stopformula
>
> \stoptext


This definitely looks better. Can there be a setting for 
\setuparrowextension (or something) so that the default can be 
changed.


On Thu, 29 Jun 2006, Taco Hoekwater wrote:

> Perhaps it syntax should be identical to amsmath: no brackets
> and two required arguments.

But that is not the amsmath syntax. It has

\xrightarrow[below]{top} where the first argument is optional.

> It is what is expected anyway.
>
>  \def\xrightarrow#1#2{\mathrel
>      {{\domthxarr0359\rightarrowfill{#1}{#2}}}}
>

I agree that this makes more sense.


> I assume amsmath has a few others as well, for double arrows and such.
> Can you post those defs as well? Then we can move the whole definition
> into math-ext.tex for the new release
>

On Thu, 29 Jun 2006, Hans Hagen wrote:

> hm, this is not the context way, two equal kind of contents and then one
> of them in [], maybe

I agree. To me,

\xrightarrow[setting]{below}{top}

makes most sense. It is not same as ams syntax, but that does not 
matter too much. Maybe there can be a switch to enable ams type of 
syntax, but that will make things too messy, I guess.


>
> \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?

I did not see any difference when I tested it. I do not know why that 
is there.


On Thu, 29 Jun 2006, Taco Hoekwater wrote:

> I assume amsmath has a few others as well, for double arrows and 
> such. Can you post those defs as well? Then we can move the whole 
> definition into math-ext.tex for the new release

These are the only ones defined in amsmath. However extarrows.sty 
defines the following

   \xlongequal (===)

   \xLongleftarrow (<===)

(Perhaps a better name is \xLeftarrow and we can have 
\xLeftarrow[medium] )


   \xLongrightarrow (===>)

(Perhaps a better name is \xRightarrow?)


   \xLongleftrightarrow (<=====>)

(again, \xLeftrightarrow[medium] )

   \xLeftrightarrow ( <===> )


   \xlongleftrightarrow (<------->)

(again \xleftrightarrow[medium] )

   \xleftrightarrow (<---->)

   \xlongleftarrow
   \xlongrightarrow

(These two are there with \xrightarrow[medium])

The definitions in extarrows are

[EMAIL PROTECTED]
[EMAIL PROTECTED]@[EMAIL PROTECTED]@arrow}

\newcommand{\xlongequal}[2][]{%
        [EMAIL PROTECTED] [EMAIL PROTECTED]

[EMAIL PROTECTED]
   [EMAIL PROTECTED]
\newcommand{\xLongleftrightarrow}[2][]{%
        [EMAIL PROTECTED] [EMAIL PROTECTED]

[EMAIL PROTECTED]
   [EMAIL PROTECTED]
\newcommand{\xlongleftrightarrow}[2][]{%
        [EMAIL PROTECTED] [EMAIL PROTECTED]

[EMAIL PROTECTED]@\Leftarrow\Relbar\Rightarrow}
\newcommand{\xLeftrightarrow}[2][]{%
        [EMAIL PROTECTED] [EMAIL PROTECTED]

[EMAIL PROTECTED]@\leftarrow\relbar\rightarrow}
\newcommand{\xleftrightarrow}[2][]{%
        [EMAIL PROTECTED] [EMAIL PROTECTED]

[EMAIL PROTECTED]@\Longleftarrow\Relbar\Relbar}
\newcommand{\xLongleftarrow}[2][]{%
        [EMAIL PROTECTED] [EMAIL PROTECTED]

[EMAIL PROTECTED]@\Relbar\Relbar\Longrightarrow}
\newcommand{\xLongrightarrow}[2][]{%
        [EMAIL PROTECTED] [EMAIL PROTECTED]

[EMAIL PROTECTED]@\longleftarrow\relbar\relbar}
\newcommand{\xlongleftarrow}[2][]{%
        [EMAIL PROTECTED] [EMAIL PROTECTED]

[EMAIL PROTECTED]@\relbar\relbar\longrightarrow}
\newcommand{\xlongrightarrow}[2][]{%
        [EMAIL PROTECTED] [EMAIL PROTECTED]


I do not think that change is syntax is that big a deal, as long as it 
is documented (I will do that). Otherwise we will still be using latex 
syntax here :)

Aditya




_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to