From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/79087 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Tikz backgrounds (was Re: Highlight current chapter in list) Date: Thu, 8 Nov 2012 19:43:11 -0500 (EST) Message-ID: References: <20121108002930.20b7f349@homerow> <5D6E4FB4-9C56-49FE-8592-ACBB3F278D77@gmail.com> <20121108223713.5b6da1d4@homerow> <3A73320B-F235-44E4-AD2A-5D806A4D5370@gmail.com> <509C2F3D.8070909@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1352421819 6393 80.91.229.3 (9 Nov 2012 00:43:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 9 Nov 2012 00:43:39 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Nov 09 01:43:49 2012 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TWchI-0006dW-3j for gctc-ntg-context-518@m.gmane.org; Fri, 09 Nov 2012 01:43:48 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id AFFC31020D; Fri, 9 Nov 2012 01:43:37 +0100 (CET) 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 kmOWNToM-aU0; Fri, 9 Nov 2012 01:43:35 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 8D447101F6; Fri, 9 Nov 2012 01:43:35 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 54917101F6 for ; Fri, 9 Nov 2012 01:43:33 +0100 (CET) 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 E9ZwtdtazvmK for ; Fri, 9 Nov 2012 01:43:31 +0100 (CET) Original-Received: from filter3-ams.mf.surf.net (filter3-ams.mf.surf.net [192.87.102.71]) by balder.ntg.nl (Postfix) with ESMTP id 7CE2A101EA for ; Fri, 9 Nov 2012 01:43:31 +0100 (CET) Original-Received: from hellskitchen.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.82]) by filter3-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id qA90hSxE005685 for ; Fri, 9 Nov 2012 01:43:30 +0100 Original-Received: FROM adi-netbook (bas3-montreal02-1096681419.dsl.bell.ca [65.94.7.203]) By hellskitchen.mr.itd.umich.edu ID 509C51AD.20C01.15454 ; Authuser adityam; 8 Nov 2012 19:43:25 EST In-Reply-To: <509C2F3D.8070909@wxs.nl> User-Agent: Alpine 2.02 (LNX 1266 2009-07-14) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=141.211.14.82; country=US; region=MI; city=Ann Arbor; postalcode=48109; latitude=42.2923; longitude=-83.7145; metrocode=505; areacode=734; http://maps.google.com/maps?q=42.2923,-83.7145&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 03IlcHsbK - e9b325d2b4ba - 20121109 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.71 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:79087 Archived-At: On Thu, 8 Nov 2012, Hans Hagen wrote: > (just to illustrate that an overlay can be used for anything) This prompted me to finish testing what I had been thinking about for a while. In most cases, metapost is sufficient for drawing backgrounds, but occasionally using tikz is nicer. For example, when tikz provides a solution that is not available in metapost (e.g., drawing "snake" paths), or extremely difficult to get right in metapost (drawing shadows). As Hans said, overlays can be used for anything, including tikz background. Here is a proof of concept implementation: \usemodule[tikz] \usetikzlibrary[decorations.pathmorphing] \def\TIKZdecorationoverlay {\starttikzpicture \expanded{\draw[\overlaylinecolor, line width=\overlaylinewidth, decorate, decoration={\framedparameter{decoration}}] (0,0)--(\overlaywidth,0) -- (\overlaywidth,\overlayheight) -- (0,\overlayheight) -- cycle;} \stoptikzpicture} \defineoverlay[decoration][\TIKZdecorationoverlay] \setupframed [decoration=snake] \starttext \framed[frame=off, rulethickness=3bp, background=decoration, backgroundoffset=3mm, framecolor=red, align=normal] {\input ward \endgraf} \blank[2*big] \externalfigure [cow] [frame=off, frameoffset=5pt, backgroundoffset=frame, background=decoration, decoration={coil, amplitude=4pt, segment length=5pt}] \stoptext 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________