Changes

Jump to navigation Jump to search
1,149 bytes removed ,  13:47, 25 April 2012
Roll back bad edit
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:
<context source=yestexcode>\setuppapersizedefinelayer [A10,portraitmybg]% name of the layer [A9x=0mm, y=0mm,landscape] % A10 from upper left corner of paper width=\paperwidth, height= 2.6x3.7cm -- compact example\setuparranging[2SIDEpaperheight] % show both pages\showframe % So we can see let the layer cover the pagesfull paper
\definelayersetupbackgrounds[mybgpage] % name of the layer [xbackground=0mm, y=0mm, % from upper left corner of paper width=\paperwidth, height=\paperheight, % let the layer cover the full paper state=continuemybg] % on all pages but the first one
\setupbackgroundssetlayer [pagemybg] % name of the layer [hoffset=1cm, voffset=1cm] % placement (from upper left corner of the layer) {\framed[backgroundframe=on, width=3cm, height=mybg2cm]{LAYER}} % the actual contents of the layer
\setlayer[mybg] % name of the layer
[hoffset=0.3cm, voffset=0.7cm] % placement (from upper left corner of the layer)
{\framed[frame=on, width=2cm, height=2cm]{LAYER}} % the actual contents of the layer
\starttext
\dorecurse{2}{\page[empty]} % for testing, to get 2 pages, 2nd 1st with layer, 1st 2nd without
\stoptext
 </contexttexcode>
You may experience cases where the defined size of your layer is ignored and you can’t get linebreaking or multiple lines at all.
This is due to <cmd>setlayer</cmd> using <cmd>hbox</cmd> internally. You can work around the problem using <cmd>setlayerframed</cmd>:
This does not work:<context source=yestexcode>\showframe \definelayer[AddressBg][ x=0mm20mm, y=0mm30mm, width=65mm, height=30mm, state=start] % size is ignored!\setupbackgrounds[paper][ setups=ALayer, background=AddressBg, state=start]
\starttext
\strut
\startsetups ALayer
\setlayer[AddressBg] % setlayer does not work here
[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
8061 GH Hasselt\crlf
THE NETHERLANDS
}
\stopsetups
</context>
<context source=yes>\definelayersetlayerframed[AddressBg][ xwidth=65mm,height=0mm30mm, yframe=0mmoff, widthhoffset=65mm0mm, heightvoffset=30mm0mm, statealign=startright] % size is ignored!{PRAGMA Advanced Document Engineering\setupbackgrounds[paper][crlf setups=ALayerMr. Hans Hagen (the wizard who wrote it all, \CONTEXT\ and everything else,with the help of his little elves)\crlfRidderstraat 27\crlf background=AddressBg,8061GH Hasselt\crlfTHE NETHERLANDS state=start]}
\startsetups ALayer
\setlayerframed[AddressBg] % setlayerframed does not work here
[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
8061 GH Hasselt\crlf
THE NETHERLANDS
}
\stopsetups
 
\page
\stoptext
</contexttexcode>
<context source="yes">
\setupexternalfigures[location={local,default}]
% (necessary for the Wiki's ConTeXt wiki conTeXt live processor)
\definelayer [figure][width=\overlaywidth,height=\overlayheight]

Navigation menu