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