ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Weird behavior about metafun
@ 2008-01-07  2:45 Zhichu Chen
  2008-01-07 11:50 ` Zhichu Chen
  2008-01-07 15:52 ` Aditya Mahajan
  0 siblings, 2 replies; 11+ messages in thread
From: Zhichu Chen @ 2008-01-07  2:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1366 bytes --]

Hi Hans and Wolfgang,

I'm just trying to make some illustrations about the Chinese typesetting
features. So I choose the way which is described in Chapter 5 of the metafun
manual. And I wanna draw a line from the text I wanna comment on to the
marginal notes which my comments lay on.

To highlight them, I drew an underline below the contexts which is to be
commented
and put a square around the comments. Everything is under control except
I put \fpos and \tpos around the comments, the framed box is not exactly
what
I want. It seems that metafun still thought it's in the main text so it drew
the bounding
around the body.

I found the mpos:par was defined in core-pgr.tex and it used show_par or
draw_par which
are defined in mp-core.mp. I don't think it's a good way to define another
MPpositiongraphic
called like mpos:marginpar to match my case. Do you think it's possible to
change
some of the core codes to make metafun recognize where she is.


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

[-- Attachment #1.2: Type: text/html, Size: 1788 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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] 11+ messages in thread

* Re: Weird behavior about metafun
  2008-01-07  2:45 Weird behavior about metafun Zhichu Chen
@ 2008-01-07 11:50 ` Zhichu Chen
  2008-01-07 13:41   ` Hans Hagen
  2008-01-07 15:52 ` Aditya Mahajan
  1 sibling, 1 reply; 11+ messages in thread
From: Zhichu Chen @ 2008-01-07 11:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2193 bytes --]

Oh, by the way, if I put \fpos at the beginning of a paragraph,
it adds an extra blank line. I have to force it to the
horizontal mode like:
\leavevmode\fpos{A-1} . . . \tpos{A-1}
So is it safe to change the definition of \fpos to add
\leavevmode at the beginning of the macro?


On Jan 7, 2008 10:45 AM, Zhichu Chen <zhichu.chen@gmail.com> wrote:

> Hi Hans and Wolfgang,
>
> I'm just trying to make some illustrations about the Chinese typesetting
> features. So I choose the way which is described in Chapter 5 of the
> metafun
> manual. And I wanna draw a line from the text I wanna comment on to the
> marginal notes which my comments lay on.
>
> To highlight them, I drew an underline below the contexts which is to be
> commented
> and put a square around the comments. Everything is under control except
> I put \fpos and \tpos around the comments, the framed box is not exactly
> what
> I want. It seems that metafun still thought it's in the main text so it
> drew the bounding
> around the body.
>
> I found the mpos:par was defined in core-pgr.tex and it used show_par or
> draw_par which
> are defined in mp-core.mp. I don't think it's a good way to define another
> MPpositiongraphic
> called like mpos:marginpar to match my case. Do you think it's possible to
> change
> some of the core codes to make metafun recognize where she is.
>
>
> --
> 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
> ----------------------------------------------------------------




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

[-- Attachment #1.2: Type: text/html, Size: 3179 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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] 11+ messages in thread

* Re: Weird behavior about metafun
  2008-01-07 11:50 ` Zhichu Chen
@ 2008-01-07 13:41   ` Hans Hagen
  2008-01-07 15:15     ` Zhichu Chen
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2008-01-07 13:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Zhichu Chen wrote:
> Oh, by the way, if I put \fpos at the beginning of a paragraph,
> it adds an extra blank line. I have to force it to the
> horizontal mode like:
> \leavevmode\fpos{A-1} . . . \tpos{A-1}

\dontleavehmode \fpos ...

> So is it safe to change the definition of \fpos to add
> \leavevmode at the beginning of the macro?

no, that could happen in the macro that uses \fpos, not in \fpos itself

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] 11+ messages in thread

* Re: Weird behavior about metafun
  2008-01-07 13:41   ` Hans Hagen
@ 2008-01-07 15:15     ` Zhichu Chen
  0 siblings, 0 replies; 11+ messages in thread
From: Zhichu Chen @ 2008-01-07 15:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1893 bytes --]

On Jan 7, 2008 9:41 PM, Hans Hagen <pragma@wxs.nl> wrote:

> Zhichu Chen wrote:
> > Oh, by the way, if I put \fpos at the beginning of a paragraph,
> > it adds an extra blank line. I have to force it to the
> > horizontal mode like:
> > \leavevmode\fpos{A-1} . . . \tpos{A-1}
>
> \dontleavehmode \fpos ...
>
> > So is it safe to change the definition of \fpos to add
> > \leavevmode at the beginning of the macro?
>
> no, that could happen in the macro that uses \fpos, not in \fpos itself

Cool, then I'll define my own macro to do that.

Thanks.

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



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

[-- Attachment #1.2: Type: text/html, Size: 3477 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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] 11+ messages in thread

* Re: Weird behavior about metafun
  2008-01-07  2:45 Weird behavior about metafun Zhichu Chen
  2008-01-07 11:50 ` Zhichu Chen
@ 2008-01-07 15:52 ` Aditya Mahajan
  2008-01-08  1:43   ` Zhichu Chen
  2008-01-08 14:45   ` Zhichu Chen
  1 sibling, 2 replies; 11+ messages in thread
From: Aditya Mahajan @ 2008-01-07 15:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, 7 Jan 2008, Zhichu Chen wrote:

> Hi Hans and Wolfgang,
>
> I'm just trying to make some illustrations about the Chinese typesetting
> features. So I choose the way which is described in Chapter 5 of the metafun
> manual. And I wanna draw a line from the text I wanna comment on to the
> marginal notes which my comments lay on.

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.

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] 11+ messages in thread

* Re: Weird behavior about metafun
  2008-01-07 15:52 ` Aditya Mahajan
@ 2008-01-08  1:43   ` Zhichu Chen
  2008-01-08 14:45   ` Zhichu Chen
  1 sibling, 0 replies; 11+ messages in thread
From: Zhichu Chen @ 2008-01-08  1:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1729 bytes --]

On Jan 7, 2008 11:52 PM, Aditya Mahajan <adityam@umich.edu> wrote:

> On Mon, 7 Jan 2008, Zhichu Chen wrote:
>
> > Hi Hans and Wolfgang,
> >
> > I'm just trying to make some illustrations about the Chinese typesetting
> > features. So I choose the way which is described in Chapter 5 of the
> metafun
> > manual. And I wanna draw a line from the text I wanna comment on to the
> > marginal notes which my comments lay on.
>
> Something like this:
> http://www.fauskes.net/media/pgftikzexamples/PDF/todo-notes.pdf


Yes! That's what I'm trying to do. I think there's a chance
to implement that with few modifications on the existing
core-pgr.tex and mp-core.mp.


> <http://www.fauskes.net/media/pgftikzexamples/PDF/todo-notes.pdf>
>
> It will be nice to have a ConTeXt module that can do this.
>
> 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
>
> ___________________________________________________________________________________
>



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

[-- Attachment #1.2: Type: text/html, Size: 3150 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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] 11+ messages in thread

* Re: Weird behavior about metafun
  2008-01-07 15:52 ` Aditya Mahajan
  2008-01-08  1:43   ` Zhichu Chen
@ 2008-01-08 14:45   ` Zhichu Chen
  2008-01-08 15:00     ` Arthur Reutenauer
  2008-01-08 17:04     ` Hans Hagen
  1 sibling, 2 replies; 11+ messages in thread
From: Zhichu Chen @ 2008-01-08 14:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1286 bytes --]

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.



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



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

[-- Attachment #1.2: Type: text/html, Size: 2609 bytes --]

[-- Attachment #2: FancyMarginTest.tex --]
[-- Type: application/x-tex, Size: 2828 bytes --]

[-- Attachment #3: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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] 11+ messages in thread

* Re: Weird behavior about metafun
  2008-01-08 14:45   ` Zhichu Chen
@ 2008-01-08 15:00     ` Arthur Reutenauer
  2008-01-08 17:04     ` Hans Hagen
  1 sibling, 0 replies; 11+ messages in thread
From: Arthur Reutenauer @ 2008-01-08 15:00 UTC (permalink / raw)
  To: Mailing list for ConTeXt users

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

  Could you still make the test file available?

	Arthur
___________________________________________________________________________________
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] 11+ messages in thread

* Re: Weird behavior about metafun
  2008-01-08 14:45   ` Zhichu Chen
  2008-01-08 15:00     ` Arthur Reutenauer
@ 2008-01-08 17:04     ` Hans Hagen
  2008-01-09  1:20       ` Zhichu Chen
  2008-01-09 12:01       ` Wolfgang Schuster
  1 sibling, 2 replies; 11+ messages in thread
From: Hans Hagen @ 2008-01-08 17:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


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

* Re: Weird behavior about metafun
  2008-01-08 17:04     ` Hans Hagen
@ 2008-01-09  1:20       ` Zhichu Chen
  2008-01-09 12:01       ` Wolfgang Schuster
  1 sibling, 0 replies; 11+ messages in thread
From: Zhichu Chen @ 2008-01-09  1:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 6335 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 8514 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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] 11+ messages in thread

* Re: Weird behavior about metafun
  2008-01-08 17:04     ` Hans Hagen
  2008-01-09  1:20       ` Zhichu Chen
@ 2008-01-09 12:01       ` Wolfgang Schuster
  1 sibling, 0 replies; 11+ messages in thread
From: Wolfgang Schuster @ 2008-01-09 12:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Jan 8, 2008 6:04 PM, 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

Hi Hans,

could you wrap this into a macro to define different commands
for marginstuff, could be usefull to write margintexts for more
users in different colors etc.

For example:

\definecomment[chen][color=blue,frame=on|off,...]
\definecomment[hans][color=red,frame=on|off,...]

\starttext

The previous paragraph was typeset by saying:
First we have defined an \chen {overlay}
{Just a test in a margin that could be multiple lines.}.
First we have defined an \hans {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.

\stoptext

Wolfgang
___________________________________________________________________________________
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] 11+ messages in thread

end of thread, other threads:[~2008-01-09 12:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-07  2:45 Weird behavior about metafun Zhichu Chen
2008-01-07 11:50 ` Zhichu Chen
2008-01-07 13:41   ` Hans Hagen
2008-01-07 15:15     ` Zhichu Chen
2008-01-07 15:52 ` Aditya Mahajan
2008-01-08  1:43   ` Zhichu Chen
2008-01-08 14:45   ` Zhichu Chen
2008-01-08 15:00     ` Arthur Reutenauer
2008-01-08 17:04     ` Hans Hagen
2008-01-09  1:20       ` Zhichu Chen
2008-01-09 12:01       ` Wolfgang Schuster

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