Difference between revisions of "Command/setupbackgrounds"

From Wiki
Jump to navigation Jump to search
m (Text replace - "== Help from ConTeXt-Forum ==" to "== Help from ConTeXt-Mailinglist/Forum ==")
m (→‎Description: another typo)
 
(9 intermediate revisions by 5 users not shown)
Line 4: Line 4:
 
}}
 
}}
  
 +
== [[Help:Reference|Syntax]] (autogenerated) ==
 +
<syntax>setupbackgrounds</syntax>
 
== [[Help:Reference|Syntax]] ==
 
== [[Help:Reference|Syntax]] ==
 
<table cellspacing="4" cellpadding="2" class="cmd">
 
<table cellspacing="4" cellpadding="2" class="cmd">
Line 27: Line 29:
 
</table>
 
</table>
  
 +
== Description ==
 +
{{cmd|setupbackgrounds}} is used to draw frames or backgrounds that cover specific areas of the page, under the text layer.
  
== Description ==
+
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.
  
 +
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.
  
== Comment ==
+
Backgrounds are essential for working with [[Layers]]. You enable your defined layers like <code>\setupbackgrounds[page][background=mylayer]</code>.
  
The first parameter sets the main layout area, the second one specifies the linked subarea(s) of the prior. Not all main areas have such subareas.
+
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>.
  
Note that backgrounds may not be rendered correctly if [[cmd:showframe|\showframe]] is used.
+
== Example ==
  
== Example ==
+
<context source=yes>
 +
\setuppapersize[A10]
 +
\showframe
 +
 
 +
% \setupbackgrounds should be placed *after* \showframe,
  
'''[text]''' has several linked subareas.
+
\setupbackgrounds[footer] [background=color, backgroundcolor=blue]
<texcode>
+
\setupbackgrounds[footer] [leftmargin] [background=color, backgroundcolor=red]
\setupbackgrounds[text] [background=color,backgroundcolor=lightgray]
 
\setupbackgrounds[text] [leftmargin] [background=color,backgroundcolor=red]
 
</texcode>
 
  
sets a light gray background for the text area and a red background for the left margin area.
+
\setupbackgrounds[text] [background=color, backgroundcolor=lightgray]
 +
\setupbackgrounds[text] [rightmargin] [background=color, backgroundcolor=yellow]
  
 +
I paint modern
 +
</context>
  
 
== See also ==
 
== See also ==
<!-- something like [[cmd:goto|\goto]] -->
+
* [[Layers]]
 +
* {{cmd|setupframed}}, which is the mechanism used by \setupbackgrounds.
  
 
== Help from ConTeXt-Mailinglist/Forum ==
 
== Help from ConTeXt-Mailinglist/Forum ==
Line 55: Line 65:
 
{{Forum|{{SUBPAGENAME}}}}
 
{{Forum|{{SUBPAGENAME}}}}
  
[[Category:Backgrounds|setupbackgrounds]]
+
[[Category:Command/Backgrounds|setupbackgrounds]]

Latest revision as of 12:47, 19 January 2020

\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.

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: