Am 04.04.2011 um 01:22 schrieb Tim Steenvoorden:
Thanks Peter! You are right it is easier to draw both the wave and the line in Metapost. And the dx=-\cutspace is just what I needed for left pages!
I striped the frames out of the code and placed just the graphics in the layer with a reuseMPgraphic. Also, I pulled out the definition of the wave into a MPinclusions. I have to do LoadPageState in each graphic though.
%\showframe \setuppapersize[A5][A5] \setuppagenumbering[alternative=doublesided]
\startMPinclusions numeric periods, width; path wave; periods := 3 + 1/4; width := periods * 2*pi; wave := origin for x=0 step 0.1 until width: .. (x,x*sin(x)) endfor; \stopMPinclusions
\startreusableMPgraphic{rightwave} LoadPageState; pickup pencircle scaled 1pt; draw origin -- (TextWidth,0) -- wave xscaled (CutSpace/width) yscaled (LineHeight/width) shifted (TextWidth,0); %setbounds currentpicture to unitsquare xscaled (TextWidth+CutSpace); \stopreusableMPgraphic
\startreusableMPgraphic{leftwave} LoadPageState; pickup pencircle scaled 1pt; draw reverse wave xscaled (-1*CutSpace/width) yscaled (LineHeight/width) -- (TextWidth,0); \stopreusableMPgraphic
\definelayer[decorations][position=yes,option=test] \setupbackgrounds[page][background=decorations]
\starttext
{\ss\bfc A chapter title} \blank[small] {\ss\bfx \date \hfill Author Name} \setlayer[decorations][location=r]{\reuseMPgraphic{rightwave}}
\input knuth
\page
{\ss\bfc A very long chapter title on two or more lines} \blank[small] {\ss\bfx \date \hfill Author Name} \setlayer[decorations][location=r,dx=-\cutspace]{\reuseMPgraphic{leftwave}}
\input knuth
\stoptext
Just one problem is left. The graphic occupies space in the text layer as if the location was set to rb. If you place it with the position=no option, it is properly placed in the background and it doesn't disturb the text. Is this a bug or a feature?
I tried to play a bit with the bounding boxes, but I think I don't understand them that well.
Your problem is that you use {\ss\bfc …} etc. to place the title rather than contexts \title command where you can define your own command. With such a command you can put all text in a frame with your graphic a background. - http://wiki.contextgarden.net/Generate_Authorlist_from_Head_Content - http://wiki.contextgarden.net/Titles#A_complex_graphical_element_under_the_c... Wolfgang