Changes

Jump to navigation Jump to search
359 bytes removed ,  14:11, 25 April 2012
Smaller example
Define a layer that takes the whole page
<texcode>
\definelayer [mybg] % name of the layer [x=0mm, y=0mm, % from upper left corner of paper width=\paperwidth, height=\paperheight] % let the layer cover the full paper
</texcode>
Now you can put something in that layer:
<texcode>
\setlayer [mybg] % name of the layer [hoffset=1cm, voffset=1cm] % placement (from upper left corner of the layer) {\framed[frame=on, width=3cm, height=2cm]{LAYER}} % the actual contents of the layer
</texcode>
Now you can test the whole thing:
<texcode>
\definelayer [mybg] % name of the layer [x=0mm, y=0mm, % from upper left corner of paper width=\paperwidth, height=\paperheight] % let the layer cover the full paper
\setupbackgrounds[page][background=mybg]
\setlayer [mybg] % name of the layer [hoffset=1cm, voffset=1cm] % placement (from upper left corner of the layer) {\framed[frame=on, width=3cm, height=2cm]{LAYER}} % the actual contents of the layer
* preset : a named location, see below
There are some "presets" for paper egde edge placement:
<texcode>
% These four are defined by ConTeXt!
This is due to <cmd>setlayer</cmd> using <cmd>hbox</cmd> internally. You can work around the problem using <cmd>setlayerframed</cmd>:
<texcodecontext source=yes>\setuppapersize[A6] \definelayer[AddressBg][ x=20mm,y=30mm, width=65mm,height=30mm, state=start] % size is ignored!\setupbackgrounds[paper][ setups=ALayer, background=AddressBg, state=start]
\starttext
 
\strut
\startsetups ALayer
  \setlayerframedsetlayer[AddressBg] % Change this to \setlayerframed to get it to work [width=65mm,height=30mm, frame=off, hoffset=0mm,voffset=0mm, align=right]% { PRAGMA Advanced Document Engineering\crlf Mr. Hans Hagen (the wizard who wrote it all, \CONTEXT\ and everything else, with the help of his little elves)\crlf Ridderstraat 27\crlf 8061GH Hasselt\crlf THE NETHERLANDS
\stopsetups
 
\page
 
\stoptext
</texcodecontext>
x=.25\layerwidth,
y=.25\layerheight]
{\green HERE}
\setlayerframed
x=.15\layerwidth,
y=.35\layerheight]
{\red THERE}
\stopsetups
\externalfigure[cow][background={foreground,figure},width=4cm,height=8cm] \startsetups figure \setlayerframed [figure] [preset=righttop, x=.25\layerwidth, y=.25\layerheight] {MORE} \setlayerframed [figure] [preset=middle, foregroundcolor=green] {EVEN MORE} \stopsetups \externalfigure[cow][background={foreground,figure},width=14cm,height=2cm] \defineexternalfigure[whatever][background={foreground,figure}] \startsetups figure \setlayerframed [figure] [preset=righttop, x=.25\layerwidth, y=.25\layerheight] {\red MORE} \setlayerframed [figure] [preset=middle, foregroundcolor=green] {EVEN MORE} \stopsetups \externalfigure[cow][whatever][width=14cm,height=4cm3cm]
\stoptext
</texcode>
 ==LinksSee Also ==
* Some applications in the [[manual:details.pdf|Details]] manual

Navigation menu