Difference between revisions of "Command/showframe"

From Wiki
Jump to navigation Jump to search
(Created page with "Documentation for \showframe")
 
 
Line 23: Line 23:
 
   </cd:command>
 
   </cd:command>
 
</cd:variants>
 
</cd:variants>
<cd:description>Draw a rectangle around, e.g, the right margin area's footer. If no arguments are specified, all text areas are outlined; if one argument is specified, it must specify one or more of the horizontal components; if both arguments are specified, any vertical part(s) of interest can be specified, too.  
+
<cd:description>Draw a rectangle around, e.g, the right margin area's footer. If no arguments are specified, all text areas are outlined; if one argument is specified, it must specify one or more of the horizontal components; if both arguments are specified, any vertical part(s) of interest can be specified, too.
  
 
In every case a green rectangle is drawn around the page edge. To change the color of that rectangle, use e.g. {{cmd|definepalet|2=[layout][page=blue]}}.
 
In every case a green rectangle is drawn around the page edge. To change the color of that rectangle, use e.g. {{cmd|definepalet|2=[layout][page=blue]}}.
  
If you define a background eg. in a layer and want to preserve its output, you have to put the  <tt>\showframe</tt> command before those {{cmd|setupbackgrounds}} commands in your document, because <tt>\showframe</tt> is merely a wrapper around several calls to {{cmd|setupbackgrounds}} so it may alter your layer's background.</cd:description>
+
If you define a background eg. in a layer and want to preserve its output, you have to put the  <tt>\showframe</tt> command before those {{cmd|setupbackgrounds}} commands in your document, because <tt>\showframe</tt> is merely a wrapper around several calls to {{cmd|setupbackgrounds}} so it may alter your layer's background.
 +
 
 +
The table below shows what the horizontal and vertical components of {{cmd|showframe}} highlight. The table's rows and columns ought to be transposed, really - currently the [header] is in the leftmost column, instead of the topmost row - but the table wouldn't fit that way round.
 +
 
 +
The examples all use the same page design:
 +
<texcode>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuppapersize[A11]
 +
 
 +
\setuplayout[
 +
    backspace=6mm,
 +
    width=6mm,
 +
    marginleft=2mm,
 +
    marginright=2mm,
 +
    leftedge=2mm,
 +
    rightedge=2mm]
 +
</texcode>
 +
 
 +
{| class=wikitable
 +
! (one argument) !! [header] !! [text] !! [footer]
 +
|-
 +
| [leftedge]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[leftedge]
 +
\starttext asdf \stoptext
 +
</context>
 +
| [header][leftedge]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuppapersize[A11]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\showframe[header][leftedge]
 +
\starttext asdf \stoptext
 +
</context>
 +
| [text][leftedge]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[text][leftedge]
 +
\starttext asdf \stoptext
 +
</context>
 +
| [footer][leftedge]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[footer][leftedge]
 +
\starttext asdf \stoptext
 +
</context>
 +
|-
 +
| [leftmargin]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[leftmargin]
 +
\starttext asdf \stoptext
 +
</context>
 +
| [header][leftmargin]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[header][leftmargin]
 +
\starttext asdf \stoptext
 +
</context>
 +
| [text][leftmargin]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[text][leftmargin]
 +
\starttext asdf \stoptext
 +
</context>
 +
| [footer][leftmargin]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[footer][leftmargin]
 +
\starttext asdf \stoptext
 +
</context>
 +
|-
 +
| [text]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[text]
 +
\starttext asdf \stoptext
 +
</context>
 +
| [header][text]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[header][text]
 +
\starttext asdf \stoptext
 +
</context>
 +
| [text][text]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[text][text]
 +
\starttext asdf \stoptext
 +
</context>
 +
| [footer][text]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[footer][text]
 +
\starttext asdf \stoptext
 +
</context>
 +
|-
 +
| [rightmargin]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[rightmargin]
 +
\starttext asdf \stoptext
 +
</context>
 +
| [header][rightmargin]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[header][rightmargin]
 +
\starttext asdf \stoptext
 +
</context>
 +
| [text][rightmargin]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[text][rightmargin]
 +
\starttext asdf \stoptext
 +
</context>
 +
| [footer][rightmargin]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[footer][rightmargin]
 +
\starttext asdf \stoptext
 +
</context>
 +
|-
 +
| [rightedge]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[rightedge]
 +
\starttext asdf \stoptext
 +
</context>
 +
| [header][rightedge]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\setuppapersize[A11]
 +
\showframe[header][rightedge]
 +
\starttext asdf \stoptext
 +
</context>
 +
| [text][rightedge]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuppapersize[A11]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\showframe[text][rightedge]
 +
\starttext asdf \stoptext
 +
</context>
 +
| [footer][rightedge]
 +
<context>
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuppapersize[A11]
 +
\setuplayout[
 +
    backspace=6mm, width=6mm, marginleft=2mm, marginright=2mm, leftedge=2mm, rightedge=2mm]
 +
\showframe[footer][rightedge]
 +
\starttext asdf \stoptext
 +
</context>
 +
|-
 +
|}
 +
</cd:description>
 
<cd:examples><cd:example title="Framing all areas"><context source="yes">
 
<cd:examples><cd:example title="Framing all areas"><context source="yes">
 
\definepapersize[A11][height=26mm, width=18mm]
 
\definepapersize[A11][height=26mm, width=18mm]
Line 34: Line 241:
 
     % paperwidth - width - backspace
 
     % paperwidth - width - backspace
 
     %    = 6mm outer space
 
     %    = 6mm outer space
 +
    top=2mm, bottom=2mm,
 
     backspace=6mm,  width=6mm,
 
     backspace=6mm,  width=6mm,
     marginleft=2mm, marginright=2mm,  
+
     marginleft=2mm, marginright=2mm,
 
     leftedge=2mm,  rightedge=2mm]
 
     leftedge=2mm,  rightedge=2mm]
 
\showframe
 
\showframe
Line 49: Line 257:
 
     %    = 6mm outer space
 
     %    = 6mm outer space
 
     backspace=6mm,  width=6mm,
 
     backspace=6mm,  width=6mm,
     marginleft=2mm, marginright=2mm,  
+
     marginleft=2mm, marginright=2mm,
 
     leftedge=2mm,  rightedge=2mm]
 
     leftedge=2mm,  rightedge=2mm]
 
\showframe[]
 
\showframe[]
Line 56: Line 264:
 
\stoptext
 
\stoptext
 
</context>
 
</context>
</cd:example></cd:examples>
+
</cd:example><cd:example title="Framing part of the page"><context source="yes">
 +
\definepapersize[A11][height=26mm, width=18mm]
 +
\setuppapersize[A11]
 +
\setuplayout[
 +
    backspace=6mm,  width=6mm,
 +
    marginleft=2mm, marginright=2mm,
 +
    leftedge=2mm,  rightedge=2mm]
 +
\showframe[header, footer][leftmargin, rightmargin]
 +
\starttext
 +
asdf
 +
\stoptext
 +
</context></cd:example></cd:examples>
 
<cd:notes></cd:notes>
 
<cd:notes></cd:notes>
 
<cd:seealso>
 
<cd:seealso>

Latest revision as of 14:22, 29 November 2021


\showframe

Summary

The command \showframe shows a frame around page areas

Settings

\showframe[...,...][...,...]
[...,...]top header text footer bottom
[...,...]leftedge leftmargin text rightmargin rightedge

Description

Draw a rectangle around, e.g, the right margin area's footer. If no arguments are specified, all text areas are outlined; if one argument is specified, it must specify one or more of the horizontal components; if both arguments are specified, any vertical part(s) of interest can be specified, too.

In every case a green rectangle is drawn around the page edge. To change the color of that rectangle, use e.g. \definepalet[layout][page=blue].

If you define a background eg. in a layer and want to preserve its output, you have to put the \showframe command before those \setupbackgrounds commands in your document, because \showframe is merely a wrapper around several calls to \setupbackgrounds so it may alter your layer's background.

The table below shows what the horizontal and vertical components of \showframe highlight. The table's rows and columns ought to be transposed, really - currently the [header] is in the leftmost column, instead of the topmost row - but the table wouldn't fit that way round.

The examples all use the same page design:

\definepapersize[A11][height=26mm, width=18mm]
\setuppapersize[A11]

\setuplayout[
    backspace=6mm,
    width=6mm,
    marginleft=2mm,
    marginright=2mm,
    leftedge=2mm,
    rightedge=2mm]
(one argument) [header] [text] [footer]
[leftedge]

[header][leftedge]

[text][leftedge]

[footer][leftedge]

[leftmargin]

[header][leftmargin]

[text][leftmargin]

[footer][leftmargin]

[text]

[header][text]

[text][text]

[footer][text]

[rightmargin]

[header][rightmargin]

[text][rightmargin]

[footer][rightmargin]

[rightedge]

[header][rightedge]

[text][rightedge]

[footer][rightedge]

Examples

Framing all areas

\definepapersize[A11][height=26mm, width=18mm]
\setuppapersize[A11]
\setuplayout[
    % paperwidth - width - backspace
    %     = 6mm outer space
    top=2mm, bottom=2mm,
    backspace=6mm,  width=6mm,
    marginleft=2mm, marginright=2mm,
    leftedge=2mm,   rightedge=2mm]
\showframe
\starttext
asdf
\stoptext

Framing only the page

\definepapersize[A11][height=26mm, width=18mm]
\setuppapersize[A11]
\setuplayout[
    % paperwidth - width - backspace
    %     = 6mm outer space
    backspace=6mm,  width=6mm,
    marginleft=2mm, marginright=2mm,
    leftedge=2mm,   rightedge=2mm]
\showframe[]
\starttext
asdf
\stoptext

Framing part of the page

\definepapersize[A11][height=26mm, width=18mm]
\setuppapersize[A11]
\setuplayout[
    backspace=6mm,  width=6mm,
    marginleft=2mm, marginright=2mm,
    leftedge=2mm,   rightedge=2mm]
\showframe[header, footer][leftmargin, rightmargin]
\starttext
asdf
\stoptext

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: