ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Tim Steenvoorden <tim.steenvoorden@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Position of MetaPost graphics
Date: Wed, 6 Apr 2011 16:04:24 +0200	[thread overview]
Message-ID: <BANLkTikPuJ=sS-uhXDiqQeH=TMSvVpjiFQ@mail.gmail.com> (raw)
In-Reply-To: <E64D980C-3E7F-4E57-B8F4-E1294AB1C790@googlemail.com>

Thanks for your tips Wolfgang! I switched to a solution as on the
wiki, using overlays and frames in place of layers. After setting the
boudingboxes right it works! I have to increase the \objectoffset
though, because otherwise the graphic is chopped of:

\setuppapersize[A5][A5]
\setuppagenumbering[alternative=doublesided]

\def\objectoffset{\cutspace}

\startMPinclusions
numeric CutSpace, wavePeriods, waveWidth;
path unitwave;
CutSpace    := \the\cutspace;
wavePeriods := 3 + 1/4;
waveSize    := wavePeriods * 2*pi;
unitwave    := (origin for x=0 step 0.1 until waveSize:
                 .. (x,x*sin(x))
               endfor) scaled (1/waveSize);
\stopMPinclusions

\startuniqueMPgraphic{rightwave}
pickup pencircle scaled 1pt;
draw origin -- (OverlayWidth,0) -- unitwave xscaled CutSpace yscaled
(LineHeight/2) shifted (OverlayWidth,0);
setbounds currentpicture to boundingbox OverlayBox;
\stopuniqueMPgraphic

\startuniqueMPgraphic{leftwave}
pickup pencircle scaled 1pt;
draw reverse unitwave xscaled (-1*CutSpace) yscaled (LineHeight/2) --
(OverlayWidth,0);
setbounds currentpicture to boundingbox OverlayBox;
\stopuniqueMPgraphic

\defineoverlay[rightwave]
  [\uniqueMPgraphic{rightwave}]
\defineoverlay[leftwave]
  [\uniqueMPgraphic{leftwave}]

\setuphead[chapter]
  [style=\ss\bfc,
   page=yes,
   after={\PlaceDecoration\blank[big]}]

\define\PlaceDecoration
  {\framed
     [width=broad,
      frame=off,
      offset=0pt,
      background=\doifoddpageelse{rightwave}{leftwave}]
     {\ss\bfx \date \hfill Author Name}}

\starttext

\chapter{A very long chapter title on two or more lines}

\input knuth

\chapter{A very long chapter title on two or more lines}

\input knuth

\stoptext

The \startchapter[] solution on the wiki is very neat, but it doesn't
work with MKII. Get errors with MKIV to... (Using TeXLive 2010) But
I'll use \setvariables.

Thanks for all your help!
Tim


2011/4/4 Wolfgang Schuster <schuster.wolfgang@googlemail.com>:
> 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_chapter_title
>
> Wolfgang
___________________________________________________________________________________
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:[~2011-04-06 14:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-01  9:39 Tim Steenvoorden
2011-04-03 15:33 ` Peter Rolf
2011-04-03 16:42 ` Aditya Mahajan
     [not found] ` <4D9859C6.9040200@wxs.nl>
2011-04-03 23:22   ` Tim Steenvoorden
2011-04-04  7:33     ` Wolfgang Schuster
2011-04-06 14:04       ` Tim Steenvoorden [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='BANLkTikPuJ=sS-uhXDiqQeH=TMSvVpjiFQ@mail.gmail.com' \
    --to=tim.steenvoorden@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).