29.11.2012 Views

MetaFun - Pragma ADE

MetaFun - Pragma ADE

MetaFun - Pragma ADE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

148<br />

background overlay a text, graphic, hyperlink or widget<br />

position overlay a series of macros triggered by positions<br />

background layer a box that can hold boxes with offsets<br />

The last kind of layer can be used in other situations as well, but in most cases it will be hooked<br />

into a background overlay.<br />

\definelayer[MyLayer][option=test]<br />

\setupbackgrounds[text][leftmargin][background=MyLayer]<br />

\setlayer[MyLayer][x=.5cm,y=5cm]<br />

{\rotate{\framed{This goes to the background}}}<br />

In this case the framed text will be placed in the background of the (current) page with the given<br />

offset to the topleft corner. Instead of a fixed position, you can inherit the current position using<br />

the position directive. Say that we have a layer called YourLayer which we put in the background<br />

of the text area.<br />

\definelayer[YourLayer]<br />

\setupbackgrounds[text][text][background=YourLayer]<br />

We can now move some framed text to this layer using \setlayer with the directive position set<br />

to yes.<br />

here: \setlayer[YourLayer][position=yes]{\inframed{Here}}<br />

here: Here<br />

You can influence the placement by explicitly providing an offset (hoffset and/or voffset), a<br />

position (x and/or y) or a location directive (location). Normally you will use the offsets for the<br />

layer as a whole and the positions for individual contributions. The next example demonstrates<br />

the use of a location directive.<br />

here: \setlayer[YourLayer][position=yes,location=c]{\inframed{Here}}<br />

Here<br />

here:<br />

Many layers can be in use at the same time. In the next example we put something in the page<br />

layer. By default, we turn on position tracking, which visualizes the bounding box of the content<br />

and shows the reference point.<br />

\definelayer[BackLayer][position=yes]<br />

\setupbackgrounds[page][background=BackLayer]<br />

Next we define an overlay that we can put behind for instance framed texts. We use METAPOST to<br />

draw Shape.<br />

\defineoverlay[Shape] [BackLayer] [\uniqueMPgraphic{Shape}]<br />

\startuniqueMPgraphic{Shape}<br />

path p ; p := fullcircle xyscaled(OverlayWidth,OverlayHeight) ;<br />

Positional graphics More layers<br />

This goes to the background

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!