nico wrote:
> Hello,
>
> For those who know, I'm trying to have the DocBook callout mechanism with  
> context. Basically, there are some numbers in lines of verbatim text, and  
> below the verbatim text the numbers are used to explain the portion of the  
> text (kind of footnote). Typically the numbers are rendered white in black  
> circle. I could use the Dingbats numbers, but it is limited to 10, so that  
> I emulated them with the following code to be able to go up to 99.
>
> The questions I have:
> - Is it the right way to do it in context (do I really need metafont?  
> Simpler, smarter method?)
> - What should I do to make them as anchors, so that it can be  
> cross-referenced (I mean, one can click on a hot spot that jump to the  
> number in the verbatim text).
>
> Thanks for any hint,
>
> \newdimen \cowidth
>
> % Maximum size of the circle fits for number 99
> \def\evalwidth%
>    {\bgroup%
>     \setbox0\hbox{\small\bf{\ss 99}}%
>     \global\cowidth=1.2\wd0%
>     \egroup}
>
> % Background black circle
> \startuniqueMPgraphic{CoCircle}
>    fill fullcircle scaled \overlaywidth withcolor black ;
> \stopuniqueMPgraphic
>
> \defineoverlay[cocircle][\uniqueMPgraphic{CoCircle}]
>
> % Display the black circled number
> \def\conum#1%
>    {\evalwidth%
>     \framed[background=cocircle,strut=no,frame=off,
>             width=\the\cowidth,height=\the\cowidth,offset=overlay]
>             {\color[white]{\small\bf{\ss #1}}}}
>
> \starttext
>
> \dorecurse{99}{\conum{\recurselevel}, }
>
> \stoptext
>   
\setupcolors[state=start]

\startuniqueMPgraphic{CoCircle}
   fill fullcircle xysized (OverlayWidth,OverlayHeight) withcolor OverlayColor ;
\stopuniqueMPgraphic

\defineoverlay[cocircle][\uniqueMPgraphic{CoCircle}]

\definecolor[CoBackgroundColor] [red]
\definecolor[CoForegroundColor] [white]

\def\conum#1%
   {\setbox\scratchbox\hbox
      {\small\ss\bf
       \setbox\scratchbox\hbox{99}%
       \hbox to 1.2\wd\scratchbox{\hss#1\hss}}%
    \framed
      [background=cocircle,
       offset=overlay,
       frame=off,
       width=\the\wd\scratchbox,
       height=\the\wd\scratchbox,
       backgroundcolor=CoBackgroundColor,
       foregroundcolor=CoForegroundColor]
      {\box\scratchbox}}


\starttext
    \dontleavehmode \dorecurse{99}{\conum{\recurselevel}, }
\stoptext

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

_______________________________________________
ntg-context mailing list
[email protected]
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to