ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* overarc
@ 2009-03-05  5:22 David Arnold
  2009-03-05 13:39 ` overarc Aditya Mahajan
  2009-03-05 18:36 ` overarc Hans Hagen
  0 siblings, 2 replies; 4+ messages in thread
From: David Arnold @ 2009-03-05  5:22 UTC (permalink / raw)
  To: Context Mailing List List

All,

How can I place an overarc over some text, such as in \overarc{AB}?

D.
___________________________________________________________________________________
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
___________________________________________________________________________________


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

* Re: overarc
  2009-03-05  5:22 overarc David Arnold
@ 2009-03-05 13:39 ` Aditya Mahajan
  2009-03-05 14:09   ` overarc Thomas A. Schmitz
  2009-03-05 18:36 ` overarc Hans Hagen
  1 sibling, 1 reply; 4+ messages in thread
From: Aditya Mahajan @ 2009-03-05 13:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, 4 Mar 2009, David Arnold wrote:

> All,
>
> How can I place an overarc over some text, such as in \overarc{AB}?

Currently, there is no such feature. Are you looking at the functionality 
of the arcs package of latex? If so, it will be easy to add it to ConTeXt. 
The main trouble is that the glyph for \overarc is missing from the fonts. 
Arcs.sty takes the glyphs for \frown and \smile, and scales them 
appropriately. An ugly solution, but it looks ok if you are just placing 
it over one or two letters.

I cannot translate the code to ConTeXt right now, so am posting it here 
incase someone wants to give it a shot.

\newcommand{\overarc}[2][1]{\over@under@arc{#1}{#2}\z@}
\newcommand{\underarc}[2][1]{\over@under@arc{#1}{#2}\@ne}
\newcommand{\over@under@arc}[3]{%
   \leavevmode
   \hbox {%
     \setbox\z@ = \hbox {#2}%
     \ifdim \ht\z@ = \z@ %      arc over/under space
       \ifdim \dp\z@ = \z@
         \ht\z@ = 1ex\relax
       \fi
     \fi
     \dimen@ = #1\wd\z@
     \begingroup
     \let \rs@size@warning = \@gobbletwo
     \relsize{-10}%
     \wd\@ne = \z@
     \@whiledim \wd\@ne < .95\dimen@ \do {%
     %AM: This loops keeps on increasing the fontsize
     %by 1 until the width of the glyph increases the width of
     %of box zero.
       \ifx \@currsize \Huge
         \dimen@ = \z@
       \else
         $%AM: Really? Load the font for each font size!
         \skip@ = \f@baselineskip
         \fontencoding{OML}\fontfamily{cmm}\fontseries{m}%
         \fontshape{it}\fontsize{\ssf@size}{\skip@}\selectfont
         \global \setbox\@ne = \hbox {%
            \hss\symbol{"5\ifnum #3=\z@ F\else E\fi}\hss}%
         \ifdim \wd\@ne < \dimen@
           \fontsize{\sf@size}{\skip@}\selectfont
           \global \setbox\@ne = \hbox {%
              \hss\symbol{"5\ifnum #3=\z@ F\else E\fi}\hss}%
           \ifdim \wd\@ne < \dimen@
             \fontsize{\tf@size}{\skip@}\selectfont
             \global \setbox\@ne = \hbox {%
               \hss\symbol{"5\ifnum #3=\z@ F\else E\fi}\hss}%
           \fi
         \fi
         $%AM: Normally one sets mathsurround to zero. Why is that not done 
here?
       \fi
       \ifdim \wd\@ne < \dimen@
         \relsize{+1}%
       \fi
       \global \dimen@i = \fontdimen5\the\font
     }%
     \endgroup
     \ifnum #3 = \z@
       \dimen@ii = 1.067\ht\z@
       \global \divide \dimen@i by \tw@
       \global \advance \dimen@i by -\ht\@ne
       \advance \dimen@ii by .6\dimen@i
     \else
       \dimen@ii = -1.05\ht\@ne
       \advance \dimen@ii by -.75pt
       \ifdim \dp\z@ > \z@
         \advance \dimen@ii by -\dp\z@
       \fi
     \fi
     \copy\z@
     \dimen@ = \wd\z@
     \advance \dimen@ by \wd\@ne
     \kern -.5\dimen@
     \raisebox {\dimen@ii}[\z@][\z@]{\copy\@ne}%
     \dimen@ = \wd\z@
     \advance \dimen@ by -\wd\@ne
     \dimen@ = .5\dimen@
     \kern \dimen@
   }%
}


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
___________________________________________________________________________________


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

* Re: overarc
  2009-03-05 13:39 ` overarc Aditya Mahajan
@ 2009-03-05 14:09   ` Thomas A. Schmitz
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas A. Schmitz @ 2009-03-05 14:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Mar 5, 2009, at 2:39 PM, Aditya Mahajan wrote:

> Currently, there is no such feature. Are you looking at the  
> functionality of the arcs package of latex? If so, it will be easy  
> to add it to ConTeXt. The main trouble is that the glyph for  
> \overarc is missing from the fonts. Arcs.sty takes the glyphs for  
> \frown and \smile, and scales them appropriately. An ugly solution,  
> but it looks ok if you are just placing it over one or two letters.

I had a similar wish a while ago and hacked something with a  
MPpositiongraphic. It is certainly not very elegant, but IMHO better  
than the LaTeX code you posted (scaling a glyph like that will look  
ugly when you want to span more than just two letters). Wolfgang  
Schuster supplied the neat trick with the counter. It is quite fast  
when run with mkiv, but I suspect would be slow with mkii (and leave  
quite a few .mp files behind). Maybe this can help:

\newcount\arcnumber

\startMPpositiongraphic{placeoverarc}
      StartPage ;
      begingroup ;
      initialize_box(\MPpos{\MPvar{self}}) ;
      numeric c ; c = ExHeight/6 ;
      z1 = llxy ;
      z2 = lrxy ;
      z7 = 1/2[z1,z2] ;
      z4 = ((x1 + 2*c), (y1 + 2*c)) ;
      z5 = (x7, (y7 + 4*c)) ;
      z6 = ((x2 - 2*c), (y2 + 2*c)) ;
      path syn ; syn := z4 .. z5 .. z6 ;
      pickup pencircle scaled (0.75*c) ;
      draw syn ;
      anchor_box(\MPanchor{\MPvar{self}}) ;
      endgroup ;
      save c ;
      StopPage ;
\stopMPpositiongraphic%

\define[1]\overarc
{\advance\arcnumber\plusone%
  \setMPpositiongraphic{POS-\number\arcnumber}{placeoverarc}%
  \hpos{POS-\number\arcnumber}{#1}}

Maybe that can be the starting point for some better code...

Thomas

___________________________________________________________________________________
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
___________________________________________________________________________________


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

* Re: overarc
  2009-03-05  5:22 overarc David Arnold
  2009-03-05 13:39 ` overarc Aditya Mahajan
@ 2009-03-05 18:36 ` Hans Hagen
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2009-03-05 18:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users

David Arnold wrote:
> All,
> 
> How can I place an overarc over some text, such as in \overarc{AB}?

well, this does not show how it should look -)

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
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________


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

end of thread, other threads:[~2009-03-05 18:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-05  5:22 overarc David Arnold
2009-03-05 13:39 ` overarc Aditya Mahajan
2009-03-05 14:09   ` overarc Thomas A. Schmitz
2009-03-05 18:36 ` overarc Hans Hagen

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).