ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: ntg-context@ntg.nl
Subject: Re: overleftrightarrow
Date: Thu, 19 Jul 2007 11:42:52 -0400	[thread overview]
Message-ID: <20070719114252.m0ioefpin4gocg84@web.mail.umich.edu> (raw)
In-Reply-To: <alpine.WNT.0.999.0707190246430.1308@nqvgln>

Quoting Aditya Mahajan <adityam@umich.edu>:

> On Sat, 30 Jun 2007, Mojca Miklavec wrote:

>> Consider
>> \def\myvec#1{\overrightharpoonup{#1}}
>> $(\myvec{\imath},\myvec{\jmath},\myvec{k})$ or $\myvec{\nabla}$,
>> $\myvec{\sigma}$, $\myvec{r}$, ...
>> The base size on top of i, j, k, ... is just too long and the harpoon
>> is also slightly too big.
>
> A realy realy ugly solution (if you do not want extensible arrows).

Here is a slightly better solution; I have tested it only for harpoons, 
and there are no configuration options for other "accents". But it 
works for both short and long objects.

\def\definemathfancyarrow
  {\dotripleargument\dodefinemathfancyarrow}

\def\dodefinemathfancyarrow[#1][#2][#3]% arrow short long
  {\setvalue{#1}{\dohandlemathfancyarrow[#2][#3]}}

\def\dohandlemathfancyarrow[#1][#2]%
  {\mathpalette{\dodohandlemathfancyarrow{#1}{#2}}}

%TODO: The clip operation should be configurable, whether you want to clip
%right or clip left.

\unexpanded\def\dodohandlemathfancyarrow#1#2#3#4% short long style text
  {\setbox0\hbox{$\m@th#3#4$}%
   \setbox2\hbox{$\m@th#1#3$}%
   \vbox{\ialign{##\crcr
   \ifdim\wd0<\wd2
     \mirror{\clip[width=\wd0]{\mirror{$\m@th#1#3$}}}%
   \else
     #2#3%
   \fi\crcr
   \noalign{\kern-\onepoint\nointerlineskip}%
   $\m@th\hfil#3#4\hfil$\crcr}}}

\definemathfancyarrow  [fancyoverrightharpoonup]
                       [\rightharpoonup]
                       [\rightharpoonupfill]


\let\myvec\fancyoverrightharpoonup

\starttext
$\myvec{\imath} \myvec{\jmath} \myvec{ABCD}$
\stoptext

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  reply	other threads:[~2007-07-19 15:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-29  0:50 \overleftrightarrow Jesse Alama
2007-06-29  3:31 ` \overleftrightarrow Aditya Mahajan
2007-06-30  8:47   ` \overleftrightarrow Mojca Miklavec
2007-07-01 16:29     ` \overleftrightarrow Hans Hagen
2007-07-19  7:01     ` \overleftrightarrow Aditya Mahajan
2007-07-19 15:42       ` Aditya Mahajan [this message]
2007-07-11 18:33   ` \overleftrightarrow Jesse Alama
2007-07-11 18:42     ` \overleftrightarrow Aditya Mahajan
2007-07-11 18:57       ` \overleftrightarrow Jesse Alama

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=20070719114252.m0ioefpin4gocg84@web.mail.umich.edu \
    --to=adityam@umich.edu \
    --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).