Difference between revisions of "Command/setupbackgrounds"

From Wiki
Jump to navigation Jump to search
(6 intermediate revisions by the same user not shown)
Line 34: Line 34:
 
* The first parameter sets the main layout area;  
 
* The first parameter sets the main layout area;  
 
* the optional second one specifies the linked subarea(s) of the prior. Not all main areas have such subareas.
 
* the optional second one specifies the linked subarea(s) of the prior. Not all main areas have such subareas.
* the third parameter determines when the page background is recalculated. <tt>state=repeat</tt> ensures that the page background is always recalculated (useful if you want to use a variable that depends on the current page, such as its number with {{cmd|realpageno}}). <tt>state=stop</tt> and <tt>state=start</tt> stop and start recalculations.
+
* about the third parameter
 +
** the key <code>state</code> determines when the page background is recalculated.
 +
***<code>state=repeat</code> ensures that the page background is always recalculated (useful if you want to use a variable that depends on the current page, such as its number with {{cmd|realpageno}}).
 +
*** <code>state=start</code> recalculates the page background, and stops its automatic recalculation,
 +
*** <code>state=stop</code> doesn't recalculate the page background, and stops its automatic recalculation.
  
 
Because {{cmd|showframe}} and {{cmd|setupbackgrounds}} both draw frameboxes over parts of the page, the order in which they are invoked matters. In most cases, {{cmd|setupbackgrounds}} should come last.
 
Because {{cmd|showframe}} and {{cmd|setupbackgrounds}} both draw frameboxes over parts of the page, the order in which they are invoked matters. In most cases, {{cmd|setupbackgrounds}} should come last.
Line 40: Line 44:
 
Backgrounds are essential for working with [[Layers]]. You enable your defined layers like <code>\setupbackgrounds[page][background=mylayer]</code>.
 
Backgrounds are essential for working with [[Layers]]. You enable your defined layers like <code>\setupbackgrounds[page][background=mylayer]</code>.
  
The <tt>background</tt> key also takes a list, and if you include "foreground", you can also set something on top of your general content, e.g. <code>\setupbackgrounds[page][background={mybacklayer,foreground,mytoplayer}]</code>.
+
The <code>background</code> key also takes a list, and if you include "foreground", you can also set something on top of your general content, e.g. <code>\setupbackgrounds[page][background={mybacklayer,foreground,mytoplayer}]</code>.
  
 
== Example ==
 
== Example ==

Revision as of 12:03, 27 April 2024

\setupbackgrounds

Syntax (autogenerated)

\setupbackgrounds[...,...][...,...][...=...,...]
[...,...]top header text footer bottom
[...,...]leftedge leftmargin text rightmargin rightedge
...=...,...inherits from \setupframed


\setupbackgrounds[...,...][...=...,...]
[...,...]paper page leftpage rightpage text hidden
statestart stop
...=...,...inherits from \setupframed


Syntax

\setupbackgrounds[...][...,...,...][...,...=...,...]
[...] top header text footer bottom page paper leftpage rightpage
[...,...,...] leftedge leftmargin text rightmargin rightedge
state start stop repeat
[...,...=...,...] see \setupframed

Description

\setupbackgrounds is used to draw frames or backgrounds that cover specific areas of the page, under the text layer.

  • The first parameter sets the main layout area;
  • the optional second one specifies the linked subarea(s) of the prior. Not all main areas have such subareas.
  • about the third parameter
    • the key state determines when the page background is recalculated.
      • state=repeat ensures that the page background is always recalculated (useful if you want to use a variable that depends on the current page, such as its number with \realpageno).
      • state=start recalculates the page background, and stops its automatic recalculation,
      • state=stop doesn't recalculate the page background, and stops its automatic recalculation.

Because \showframe and \setupbackgrounds both draw frameboxes over parts of the page, the order in which they are invoked matters. In most cases, \setupbackgrounds should come last.

Backgrounds are essential for working with Layers. You enable your defined layers like \setupbackgrounds[page][background=mylayer].

The background key also takes a list, and if you include "foreground", you can also set something on top of your general content, e.g. \setupbackgrounds[page][background={mybacklayer,foreground,mytoplayer}].

Example

\setuppapersize[A10]
\showframe

% \setupbackgrounds should be placed *after* \showframe, 

\setupbackgrounds[footer]  [background=color, backgroundcolor=blue]
\setupbackgrounds[footer]  [leftmargin] [background=color, backgroundcolor=red]

\setupbackgrounds[text] [background=color, backgroundcolor=lightgray]
\setupbackgrounds[text] [rightmargin] [background=color, backgroundcolor=yellow]

I paint modern

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: