Standardmakeup background

From ConTeXt wiki
Revision as of 08:59, 24 June 2013 by Esteis (talk | contribs) (moved standardmakeup background to Standardmakeup background: Articles should start with a capital letter)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to place an image on a defined makeup or standardmakeup page.

First define the layer.

 \definelayer
     [MyLayer]
     [
         position=no,
         repeat=no,
         width=\paperwidth,
         height=\paperheight,
     ]

Then set the layer with \setlayer or \setlayerframed (depending on your needs).

 \setlayer
     [MyLayer]
     [x=0cm,y=3cm]
     {\externalfigure[figure.pdf]}

Define your custom makeup or the standardmakeup to use your defined layer as its background

Custom:

 \definemakeup
     [title]
     [
         doublesided=no,
         page=right,
         headerstade=empty,
         footerstate=empty,
         before=\setups{title:setups},
     ]
 
 \startsetups title:setups
     \setupbackgrounds[page][background=MyLayer]
 \stopsetups

Or standard:

 \definemakeup
     [standard]
     [
         doublesided=no,
         page=right,
         headerstade=empty,
         footerstate=empty,
         before=\setups{standard:setups},
     ]
 
 \startsetups standard:setups
     \setupbackgrounds[page][background=MyLayer]
 \stopsetups

Then in your document you can use it like this:

 \starttext
 
 \startfrontmatter
     \starttitlemakeup  % -- (or \startstandardmakeup)
         \title{Your Title Here}
     \stoptitlemakeup
 \stopfrontmatter
 
 \startbodymatter
     \chapter{Body of document}
     \input knuth
 \stopbodymatter
 
 \stoptext