ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Darksair <chris.corsair@gmail.com>
To: ntg-context@ntg.nl
Subject: Re: Text background that spans the width of the page
Date: Wed, 7 May 2014 15:36:17 -0400	[thread overview]
Message-ID: <20140507193617.GA40364@Fity.local> (raw)
In-Reply-To: <5369381C.6080904@wxs.nl>

Hi Hans,

On Tue, May 06, 2014 at 09:29:32PM +0200, Hans Hagen wrote:
> On 5/2/2014 5:59 PM, Darksair wrote:
> >Hi all,
> >
> >I would like to have a colored horizontal stripe as background for one
> >line of text.  Sort of like what textbackground does, but I want it to
> >span the whole \paperwidth, instead of just \textwidth.  At the end of
> >the day, I would use it to style for example my section heads, or to
> >highlight one specific \item.  What’s the best way to do it?
> 
> you can use textbackgrounds and plug in some mp code that extends into the
> margins ... it depends a bit on what 'line' means here
> 
>     \startuniqueMPgraphic{whatever}
>         fill OverlayBox
>             leftenlarged BackSpace
>             rightenlarged CutSpace
>             withcolor OverlayColor ;
>         setbounds currentpicture to OverlayBox
>             enlarged max(BackSpace,CutSpace) ;
>     \stopuniqueMPgraphic
> 
>     \defineoverlay[whatever][\uniqueMPgraphic{whatever}]
> 
>     \framed
>       [background=whatever,
>        backgroundcolor=green,
>        frame=off,
>        width=\textwidth]
>       {test}%

Thank you for this interesting solution!  I didn’t know one could do
that with Metapost.  This does exactly what I want.

-- 
Darksair
http://darksair.org/
http://twitter.com/#!/MetroWind | http://about.me/darksair
http://www.last.fm/user/Darksair
___________________________________________________________________________________
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
___________________________________________________________________________________

      reply	other threads:[~2014-05-07 19:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-02 15:59 Darksair
2014-05-06 19:29 ` Hans Hagen
2014-05-07 19:36   ` Darksair [this message]

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=20140507193617.GA40364@Fity.local \
    --to=chris.corsair@gmail.com \
    --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).