From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/67586 Path: news.gmane.org!not-for-mail From: Peter Rolf Newsgroups: gmane.comp.tex.context Subject: Re: Position of MetaPost graphics Date: Sun, 03 Apr 2011 17:33:24 +0200 Message-ID: <4D989344.3080202@gmx.net> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050304000306000002050101" X-Trace: dough.gmane.org 1301844831 25885 80.91.229.12 (3 Apr 2011 15:33:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 3 Apr 2011 15:33:51 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Apr 03 17:33:47 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6PJD-0002Jn-At for gctc-ntg-context-518@m.gmane.org; Sun, 03 Apr 2011 17:33:47 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 2CEBCCAB84; Sun, 3 Apr 2011 17:33:46 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id YifADVRyXK8N; Sun, 3 Apr 2011 17:33:40 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 93125CAB7E; Sun, 3 Apr 2011 17:33:40 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id DB2AFCAB7E for ; Sun, 3 Apr 2011 17:33:38 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id xl7fxoil92zj for ; Sun, 3 Apr 2011 17:33:33 +0200 (CEST) Original-Received: from filter1-nij.mf.surf.net (filter1-nij.mf.surf.net [195.169.124.152]) by balder.ntg.nl (Postfix) with ESMTP id E4545CAB65 for ; Sun, 3 Apr 2011 17:33:33 +0200 (CEST) Original-Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.23]) by filter1-nij.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with SMTP id p33FXWV2004645 for ; Sun, 3 Apr 2011 17:33:33 +0200 Original-Received: (qmail invoked by alias); 03 Apr 2011 15:33:31 -0000 Original-Received: from ip-109-91-201-224.unitymediagroup.de (EHLO [192.168.178.3]) [109.91.201.224] by mail.gmx.net (mp061) with SMTP; 03 Apr 2011 17:33:31 +0200 X-Authenticated: #24293357 X-Provags-ID: V01U2FsdGVkX1+uB55d5l+u+3DwecV/UaBxycJLVYtqT6BBrgtmpW Qe0936rkYoitNY User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Mnenhy/0.8.3 Thunderbird/3.1.9 In-Reply-To: X-Enigmail-Version: 1.1.1 X-Y-GMX-Trusted: 0 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=213.165.64.23; country=DE; latitude=51.0000; longitude=9.0000; http://maps.google.com/maps?q=51.0000,9.0000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 07Er3xwNP - 55859c742893 - 20110403 X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.152 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 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 Xref: news.gmane.org gmane.comp.tex.context:67586 Archived-At: This is a multi-part message in MIME format. --------------050304000306000002050101 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Am 01.04.2011 11:39, schrieb Tim Steenvoorden: > Dear list, > > I'm trying to make some fancy chapter headers. With MetaPost I drew a > wave, which I'd like to place in the margin. I've read details.pdf and > metafun.pdf, but I don't manage to get the positioning right. The wave > should begin where the bottomframe ends and move on to the page > border. Also, the graphic is placed in the page background layer, but > nevertheless the text after the the graphic is shifted down. > > \startuniqueMPgraphic{wave} > 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; > pickup pencircle scaled 1pt; > draw wave xscaled (OverlayWidth/width) yscaled (OverlayHeight/(2*width)); > \stopuniqueMPgraphic > > \definelayer[decorations][position=yes,option=test,location=r] > \setupbackgrounds[page][background=decorations] > \defineoverlay[wave][\uniqueMPgraphic{wave}] > > \starttext > > {\ss\bfc A chapter title} > \blank[small] > \framed[frame=off,bottomframe=on,width=broad,rulethickness=1pt] > {\ss\bfx \date \hfill Author Name} > \setlayer[decorations]{\framed[background=wave,frame=off,width=\cutspace,height=2\lineheight]{}} > > \input knuth > > \stoptext > > What am I doing wrong? Is it a better idea to draw the bottomframe in > MetaPost too? How do I take care of positioning in that case? Absolute > positioning is not an option, because the length of the chapterheads > can be two lines. It should also work on other paper sizes (A5 in > particular). > Don't ask me. I have no experience with layers in combination with 'position=yes'. Anyhow, IMO it's much easier to draw all in one graphic than try to attach the MP graphic with the frame(d) border. Also: I have no idea how to do it :-) I attached a working example, but it's more a starting point than a final solution. Best wishes, Peter > Kind regards, > Tim Steenvoorden > ___________________________________________________________________________________ > 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 : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ___________________________________________________________________________________ > --------------050304000306000002050101 Content-Type: text/x-tex; name="position.tex" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="position.tex" %\setuppapersize[A5][A5] \startuniqueMPgraphic{wave}{wl} numeric periods, width; path wave; periods := 3 + 1/4; width := periods * 2*pi; wl := \MPvar{wl}; ll := OverlayWidth-wl; wave := (origin for x=0 step 0.1 until width: .. (x,x*sin(x)) endfor) xscaled -1; % mirror (no shift correction needed) pickup pencircle scaled 1pt; draw reverse(wave xscaled (wl/width) yscaled (OverlayHeight/2width))--(ll,0); \stopuniqueMPgraphic \definelayer[decorations][position=yes,option=test,location=r,dx=-\cutspace] \setupbackgrounds[page][background=decorations] \defineoverlay[wave][\uniqueMPgraphic{wave}{wl=\cutspace}] \starttext \showframe[text] {\ss\bfc A chapter title} \blank[small] \framed[frame=off,width=broad] {\ss\bfx \date \hfill Author Name}% \setlayer[decorations]{\framed[background=wave,frame=off,width=\dimexpr\cutspace+\makeupwidth,height=2\lineheight,offset=overlay]{}} \input knuth \stoptext --------------050304000306000002050101 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --------------050304000306000002050101--