ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Giuseppe Bilotta <gip.bilotta@iol.it>
Cc: ntg-context@ntg.nl
Subject: Re: [NTG-context] A math question
Date: Fri, 18 Oct 2002 23:59:46 +0200	[thread overview]
Message-ID: <16520379373.20021018235946@iol.it> (raw)
In-Reply-To: <14519861309.20021018235108@iol.it>


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


      reply	other threads:[~2002-10-18 21:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-18 21:51 Giuseppe Bilotta
2002-10-18 21:59 ` Giuseppe Bilotta [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16520379373.20021018235946@iol.it \
    --to=gip.bilotta@iol.it \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).