From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Tikz backgrounds (was Re: Highlight current chapter in list)
Date: Thu, 8 Nov 2012 19:43:11 -0500 (EST) [thread overview]
Message-ID: <alpine.LNX.2.02.1211081935240.25974@ybpnyubfg.ybpnyqbznva> (raw)
In-Reply-To: <509C2F3D.8070909@wxs.nl>
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
___________________________________________________________________________________
next prev parent reply other threads:[~2012-11-09 0:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-07 23:29 Highlight current chapter in list Marco Patzer
2012-11-08 8:44 ` Wolfgang Schuster
2012-11-08 10:06 ` Marco Patzer
2012-11-08 11:06 ` Hans Hagen
2012-11-08 11:15 ` Hans Hagen
2012-11-08 11:42 ` Marco Patzer
2012-11-08 17:32 ` Marco Patzer
2012-11-08 18:18 ` Hans Hagen
2012-11-09 16:53 ` Sietse Brouwer
2012-11-09 17:03 ` Hans Hagen
2012-11-08 21:37 ` Marco Patzer
2012-11-08 21:45 ` Marco Patzer
2012-11-08 21:48 ` Wolfgang Schuster
2012-11-08 22:16 ` Hans Hagen
2012-11-09 0:43 ` Aditya Mahajan [this message]
2012-11-09 9:17 ` Tikz backgrounds (was Re: Highlight current chapter in list) Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.2.02.1211081935240.25974@ybpnyubfg.ybpnyqbznva \
--to=adityam@umich.edu \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).