From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/38520 Path: news.gmane.org!not-for-mail From: "Zhichu Chen" Newsgroups: gmane.comp.tex.context Subject: Re: Weird behavior about metafun Date: Wed, 9 Jan 2008 09:20:01 +0800 Message-ID: <769ba7780801081720i33f84e2iaabfe7d5a19ab3f0@mail.gmail.com> References: <769ba7780801061845u371877a2m265f07559e988746@mail.gmail.com> <769ba7780801080645v38743267td723dca613bc4cb6@mail.gmail.com> <4783AD18.7060502@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1112583234==" X-Trace: ger.gmane.org 1199844113 8283 80.91.229.12 (9 Jan 2008 02:01:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 9 Jan 2008 02:01:53 +0000 (UTC) To: "mailing list for ConTeXt users" Original-X-From: ntg-context-bounces@ntg.nl Wed Jan 09 03:02:10 2008 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1JCQGg-0005O2-AQ for gctc-ntg-context-518@m.gmane.org; Wed, 09 Jan 2008 03:02:10 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id C8A791FBF9; Wed, 9 Jan 2008 03:01:16 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 20674-05-10; Wed, 9 Jan 2008 03:00:23 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 1D1471FA4C; Wed, 9 Jan 2008 03:00:19 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 15F3C1FBC9 for ; Wed, 9 Jan 2008 02:59:21 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 30579-01 for ; Wed, 9 Jan 2008 02:58:13 +0100 (CET) Original-Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.183]) by ronja.ntg.nl (Postfix) with ESMTP id 6854E1FB8C for ; Wed, 9 Jan 2008 02:20:23 +0100 (CET) Original-Received: by wa-out-1112.google.com with SMTP id m16so100250waf.14 for ; Tue, 08 Jan 2008 17:20:02 -0800 (PST) Original-Received: by 10.114.174.2 with SMTP id w2mr138935wae.17.1199841601655; Tue, 08 Jan 2008 17:20:01 -0800 (PST) Original-Received: by 10.114.126.10 with HTTP; Tue, 8 Jan 2008 17:20:01 -0800 (PST) In-Reply-To: <4783AD18.7060502@wxs.nl> X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:38520 Archived-At: --===============1112583234== Content-Type: multipart/alternative; boundary="----=_Part_9735_20486687.1199841601647" ------=_Part_9735_20486687.1199841601647 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Pretty cool! I knew ConTeXt can do it and thank you Hans for teaching me so much. Hi Arthur, I'm suffering a network problem so sometimes mails may no be delivered correctly. But ignore my test file and get Hans' one. On Jan 9, 2008 1:04 AM, Hans Hagen wrote: > Zhichu Chen wrote: > > Hi, > > > > On Jan 7, 2008 11:52 PM, Aditya Mahajan wrote: > > > >> > >> Something like this: > >> http://www.fauskes.net/media/pgftikzexamples/PDF/todo-notes.pdf > >> > >> It will be nice to have a ConTeXt module that can do this. > > > > > > I've made a test file which is somewhat like what it shows, but I > > still have many problems so it's far from perfect. > > stacking is already present > > > > \setupcolors [state=start] > \definecolor [marginback] [darkcyan] > > \startMPpositiongraphic{mypos:underline} > initialize_box(\MPpos{\MPvar{self}}) ; > path p ; p := (llxy--lrxy) shifted (0,dxy) ; > pickup pencircle scaled 1pt ; > draw p withcolor .75red ; > anchor_box(\MPanchor{\MPvar{self}}) ; > \stopMPpositiongraphic > > \startMPpositiongraphic{mypos:ulcorner} > initialize_box(\MPpos{\MPvar{self}}) ; > path p ; p := llxy--ulxy--urxy ; > pickup pencircle scaled 1pt ; > draw p withcolor .75red ; > anchor_box(\MPanchor{\MPvar{self}}) ; > \stopMPpositiongraphic > > \startMPpositiongraphic{mypos:torightmargin} > path pa, pb, pab ; numeric na, nb ; pair bxya, lxyb ; > initialize_box(\MPpos{\MPvar{from}}) ; > na := nxy ; pa := (llxy--lrxy) shifted (0,dxy) ; bxya := (center pa) > - (0 , \the\baselineskip/4) ; > initialize_box(\MPpos{\MPvar{to}}) ; > nb := nxy ; lxyb := .5[llxy , ulxy] - (\the\rightmargindistance/2 , > 0) ; pb := llxy--ulxy ; > if na=nb : > pab := center pa -- bxya -- (xpart lxyb , ypart bxya) -- lxyb -- > center pb; > pickup pencircle scaled 1pt ; > draw pab withcolor transparent(1,.5,.625yellow) ; > anchor_box(\MPanchor{\MPvar{from}}) ; > fi ; > \stopMPpositiongraphic > > \defineoverlay [margingraphics] [\positionoverlay{margingraphics}] > > \setupbackgrounds > [page] > [background=margingraphics] > > \starttext > > \setupinmargin[stack=yes] > > \defineframedtext > [marginframe] > [background=color, > % backgroundcolor=marginback, > offset=.25ex, > frame=off, > width=\the\rightmarginwidth, > foregroundstyle=\bfx] > > \def\marginstuff#1#2% > {\doglobal\increment\currentmarginstuff > \startpositionoverlay{margingraphics}% > % can be drawn in one graphic which is more efficient > \setMPpositiongraphic{mstuff:t\currentmarginstuff}{mypos:underline}% > \setMPpositiongraphic{mstuff:m\currentmarginstuff}{mypos:ulcorner}% > > > \expanded{\setMPpositiongraphic{mstuff:t\currentmarginstuff}{mypos:torightmargin}{to=mstuff:m\currentmarginstuff}}% > \stoppositionoverlay > > > \hpos{mstuff:t\currentmarginstuff}{#1}\inright{\hpos{mstuff:m\currentmarginstuff}{\marginframe{#2}}}} > > First we have defined an \marginstuff {overlay} > {Just a test in a margin that could be multiple lines.}. > This overlay can be attached to some overlay layer, like, in our > case, the page. We define four small circles. These are drawn > as soon as the page overlay is typeset. Because they are located > in the background, they don't cover the text, while the lines do. > The previous paragraph was typeset by saying: > > First we have defined an \marginstuff {overlay} > {Just a test in a margin that could be multiple lines.}. > First we have defined an \marginstuff {overlay} > {Just a test in a margin that could be multiple lines.}. > This overlay can be attached to some overlay layer, like, in our > case, the page. We define four small circles. These are drawn > as soon as the page overlay is typeset. Because they are located > in the background, they don't cover the text, while the lines do. > The previous paragraph was typeset by saying: > > First we have defined an \marginstuff {overlay} > {Just a test in a margin that could be multiple lines.}. > First we have defined an \marginstuff {overlay} > {Just a test in a margin that could be multiple lines.}. > This overlay can be attached to some overlay layer, like, in our > case, the page. We define four small circles. These are drawn > as soon as the page overlay is typeset. Because they are located > in the background, they don't cover the text, while the lines do. > > The previous paragraph was typeset by saying: > First we have defined an \marginstuff {overlay} > {Just a test in a margin that could be multiple lines.}. > First we have defined an \marginstuff {overlay} > {Just a test in a margin that could be multiple lines.}. > This overlay can be attached to some overlay layer, like, in our > case, the page. We define four small circles. These are drawn > as soon as the page overlay is typeset. Because they are located > in the background, they don't cover the text, while the lines do. > The previous paragraph was typeset by saying: > > \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 > ----------------------------------------------------------------- > > ___________________________________________________________________________________ > 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 > > ___________________________________________________________________________________ > -- Best Regards Chen ---------------------------------------------------------------- Zhi-chu Chen | Shanghai Synchrotron Radiation Facility No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China tel: 086 21 5955 3405 | zhichu.chen.googlepages.com | www.sinap.ac.cn ---------------------------------------------------------------- ------=_Part_9735_20486687.1199841601647 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Pretty cool! I knew ConTeXt can do it and thank you Hans
for teaching me so much.

Hi Arthur, I'm suffering a network problem so sometimes
mails may no be delivered correctly. But ignore my test
file and get Hans' one.

On Jan 9, 2008 1:04 AM, Hans Hagen <pragma@wxs.nl> wrote:
Zhichu Chen wrote:
> Hi,
>
> On Jan 7, 2008 11:52 PM, Aditya Mahajan <adityam@umich.edu> wrote:
>
>>
>> Something like this:
>> http://www.fauskes.net/media/pgftikzexamples/PDF/todo-notes.pdf
>>
>> It will be nice to have a ConTeXt module that can do this.
>
>
> I've made a test file which is somewhat like what it shows, but I
> still have many problems so it's far from perfect.

stacking is already present



\setupcolors   [state=start]
\definecolor   [marginback] [darkcyan]

\startMPpositiongraphic{mypos:underline}
  initialize_box(\MPpos{\MPvar{self}}) ;
  path p ; p := (llxy--lrxy) shifted (0,dxy) ;
  pickup pencircle scaled 1pt ;
  draw p withcolor .75red ;
  anchor_box(\MPanchor{\MPvar{self}}) ;
\stopMPpositiongraphic

\startMPpositiongraphic{mypos:ulcorner}
  initialize_box(\MPpos{\MPvar{self}}) ;
  path p ; p := llxy--ulxy--urxy ;
  pickup pencircle scaled 1pt ;
  draw p withcolor .75red ;
  anchor_box(\MPanchor{\MPvar{self}}) ;
\stopMPpositiongraphic

\startMPpositiongraphic{mypos:torightmargin}
  path pa, pb, pab ; numeric na, nb ; pair bxya, lxyb ;
  initialize_box(\MPpos{\MPvar{from}}) ;
  na := nxy ; pa := (llxy--lrxy) shifted (0,dxy) ; bxya := (center pa)
- (0 , \the\baselineskip/4) ;
  initialize_box(\MPpos{\MPvar{to}}) ;
  nb := nxy ; lxyb := .5[llxy , ulxy] - (\the\rightmargindistance/2 ,
0) ; pb := llxy--ulxy ;
  if na=nb :
    pab := center pa -- bxya -- (xpart lxyb , ypart bxya) -- lxyb --
center pb;
    pickup pencircle scaled 1pt ;
    draw pab withcolor transparent(1,.5,.625yellow) ;
    anchor_box(\MPanchor{\MPvar{from}}) ;
  fi ;
\stopMPpositiongraphic

\defineoverlay [margingraphics] [\positionoverlay{margingraphics}]

\setupbackgrounds
  [page]
  [background=margingraphics]

\starttext

\setupinmargin[stack=yes]

\defineframedtext
    [marginframe]
    [background=color,
%      backgroundcolor=marginback,
     offset=.25ex,
     frame=off,
     width=\the\rightmarginwidth,
     foregroundstyle=\bfx]

\def\marginstuff#1#2%
  {\doglobal\increment\currentmarginstuff
   \startpositionoverlay{margingraphics}%
      % can be drawn in one graphic which is more efficient
      \setMPpositiongraphic{mstuff:t\currentmarginstuff}{mypos:underline}%
      \setMPpositiongraphic{mstuff:m\currentmarginstuff}{mypos:ulcorner}%

\expanded{\setMPpositiongraphic{mstuff:t\currentmarginstuff}{mypos:torightmargin}{to=mstuff:m\currentmarginstuff}}%
   \stoppositionoverlay

\hpos{mstuff:t\currentmarginstuff}{#1}\inright{\hpos{mstuff:m\currentmarginstuff}{\marginframe{#2}}}}

First we have defined an \marginstuff {overlay}
{Just a test in a margin that could be multiple lines.}.
This overlay can be attached to some overlay layer, like, in our
case, the page. We define four small circles. These are drawn
as soon as the page overlay is typeset. Because they are located
in the background, they don't cover the text, while the lines do.
The previous paragraph was typeset by saying:

First we have defined an \marginstuff {overlay}
{Just a test in a margin that could be multiple lines.}.
First we have defined an \marginstuff {overlay}
{Just a test in a margin that could be multiple lines.}.
This overlay can be attached to some overlay layer, like, in our
case, the page. We define four small circles. These are drawn
as soon as the page overlay is typeset. Because they are located
in the background, they don't cover the text, while the lines do.
The previous paragraph was typeset by saying:

First we have defined an \marginstuff {overlay}
{Just a test in a margin that could be multiple lines.}.
First we have defined an \marginstuff {overlay}
{Just a test in a margin that could be multiple lines.}.
This overlay can be attached to some overlay layer, like, in our
case, the page. We define four small circles. These are drawn
as soon as the page overlay is typeset. Because they are located
in the background, they don't cover the text, while the lines do.

The previous paragraph was typeset by saying:
First we have defined an \marginstuff {overlay}
{Just a test in a margin that could be multiple lines.}.
First we have defined an \marginstuff {overlay}
{Just a test in a margin that could be multiple lines.}.
This overlay can be attached to some overlay layer, like, in our
case, the page. We define four small circles. These are drawn
as soon as the page overlay is typeset. Because they are located
in the background, they don't cover the text, while the lines do.
The previous paragraph was typeset by saying:

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



--
Best Regards
Chen
----------------------------------------------------------------

         Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
        No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
            tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
                                              | www.sinap.ac.cn
---------------------------------------------------------------- ------=_Part_9735_20486687.1199841601647-- --===============1112583234== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============1112583234==--