ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] A math question
@ 2002-10-18 21:51 Giuseppe Bilotta
  2002-10-18 21:59 ` Giuseppe Bilotta
  0 siblings, 1 reply; 2+ messages in thread
From: Giuseppe Bilotta @ 2002-10-18 21:51 UTC (permalink / raw)


Hello,

does ConTeXt provide extensible arrows with super and subscript?
An extensible arrow is something like \leftarrow, \rightarrow,
\Leftarrow, \Rightarrow, except that it accepts super/subscripts
which gets typeset over or under the arrow body, which extends to
accomdate the length of the super and subscripts (with a minimum
guaranteed legth).

-- 
Giuseppe "Oblomov" Bilotta

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [NTG-context] A math question
  2002-10-18 21:51 [NTG-context] A math question Giuseppe Bilotta
@ 2002-10-18 21:59 ` Giuseppe Bilotta
  0 siblings, 0 replies; 2+ messages in thread
From: Giuseppe Bilotta @ 2002-10-18 21:59 UTC (permalink / raw)
  Cc: ntg-context


Friday, October 18, 2002 Giuseppe Bilotta wrote:

GB> Hello,

GB> does ConTeXt provide extensible arrows with super and subscript?
GB> An extensible arrow is something like \leftarrow, \rightarrow,
GB> \Leftarrow, \Rightarrow, except that it accepts super/subscripts
GB> which gets typeset over or under the arrow body, which extends to
GB> accomdate the length of the super and subscripts (with a minimum
GB> guaranteed legth).

Sorry for following up to my own post, but I found a couple of
definitions in nath.sty (Nath is a wonderful LaTeX package) which
might be pertinent:

GB> %
GB> %  E x p a n d a b l e   h o r i z o n t a l  a r r o w s
GB> %
GB> 
GB> \def\longrightarrow@#1#2{\mathrel{\mathopen-\axis@@
GB>  \axis@{#1}{#2}
GB>  \axis@@\mathclose\rightarrow}}
GB> 
GB> \def\longleftarrow@#1#2{\mathrel{\mathopen\leftarrow\axis@@
GB>  \axis@{#1}{#2}
GB>  \axis@@\mathclose-}}
GB> 
GB> \def\longleftrightarrow@#1#2{\mathrel{\mathopen\leftarrow\axis@@
GB>  \axis@{#1}{#2}
GB>  \axis@@\mathclose\rightarrow}}
GB> 
GB> \pdef\to{\def\afterparse@{
GB>  \longrightarrow@{\ifsp@\sp@toks@\fi}{\ifsb@\sb@toks@\fi}\next}
GB>  \sb@false\sp@false
GB>  \def\next@comm{\afterassignment\parse@next\let\next=}
GB>  \next@comm}
GB> 
GB> \pdef\ot{\def\afterparse@{
GB>  \longleftarrow@{\ifsp@\sp@toks@\fi}{\ifsb@\sb@toks@\fi}\next}
GB>  \sb@false\sp@false
GB>  \def\next@comm{\afterassignment\parse@next\let\next=} 
GB>  \next@comm}
GB> 
GB> \pdef\otto{\def\afterparse@{
GB>  \longleftrightarrow@{\ifsp@\sp@toks@\fi}{\ifsb@\sb@toks@\fi}\next}
GB>  \sb@false\sp@false
GB>  \def\next@comm{\afterassignment\parse@next\let\next=} 
GB>  \next@comm}
GB> 
GB> \pdef\mapsto{\mathrel{\mapstochar}\mathclose{}\mathopen{}\to}
GB> 
GB> \def\sp@toks@{\edef\@tempa{\noexpand\inline{\the\sp@toks}}\@tempa}
GB> \def\sb@toks@{\edef\@tempa{\noexpand\inline{\the\sb@toks}}\@tempa}
GB> 
GB> \def\axis@#1#2{\setbox0\scriptstylehbox@{\protectinline@true #1}
GB>  \er@wd=\wd0
GB>  \setbox\@tempboxa\scriptstylehbox@{\protectinline@true #2}
GB>  \ifdim\wd\@tempboxa>\er@wd \er@wd=\wd\@tempboxa\fi
GB>  \@tempdima=\ht\@tempboxa
GB>  \advance\@tempdima\dp\@tempboxa
GB>  \advance\@tempdima-.42\mex
GB>  \vtop{\offinterlineskip
GB>  \hbox{\vbox{\hbox to\er@wd{\hss\box0\hss}%
GB>  \vskip -.26\mex
GB>  \hbox to\er@wd{\axis@@@\hfill}}}
GB>  \vskip -.26\mex
GB>  \hbox to\er@wd{\hss\box\@tempboxa\hss}}
GB>  }
GB> 
GB> \def\axis@@{\mkern-6mu
GB>  \axis@@@\mskip 3mu plus \arrow@expandability mu
GB>  \mkern-6mu}
GB> 
GB> \def\axis@@@{%
GB>  \cleaders\hbox{\o@math\mkern-3mu \icurrstyle@\mathord- \mkern-3mu\o@math}}
GB> 
GB> \def\arrow@expandability{1.2}
GB>  
GB> \def\longrightarrowfill{\axis@@@\hfill\mskip-6mu\rightarrow}
GB> \def\longleftarrowfill{\leftarrow\mskip-6mu\axis@@@\hfill}
GB> \def\longleftrightarrowfill{\leftarrow\mskip-6mu
GB>  \axis@@@\hfill\mskip-6mu\rightarrow}

It is my understanding that this shouldn't be too hard to port to
contest: \o@math is simply the "original" TeX $, the afterparse@,
\ifsp@, \ifsb@ do a lookahead to see if superscripts and
subscripts are used, and in case use them.

Would it be hard to port this to ConTeXt?

-- 
Giuseppe "Oblomov" Bilotta

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-10-18 21:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-18 21:51 [NTG-context] A math question Giuseppe Bilotta
2002-10-18 21:59 ` Giuseppe Bilotta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).