Difference between revisions of "Command/setuplayout"

From Wiki
Jump to navigation Jump to search
m (moved Reference/en/setuplayout to Command/setuplayout: Text replace - "Reference/en/" to "Command/")
(13 intermediate revisions by 5 users not shown)
Line 3: Line 3:
 
|attributes=
 
|attributes=
 
}}
 
}}
 +
 +
__TOC__
 +
 +
== [[Help:Reference|Syntax]] (autogenerated) ==
 +
<syntax>setuplayout</syntax>
  
 
== [[Help:Reference|Syntax]] ==
 
== [[Help:Reference|Syntax]] ==
Line 189: Line 194:
  
 
== Description ==  
 
== Description ==  
<pre>
 
Horizontal: (if singleside then outside is at right and inside is at left)
 
===========
 
width => width of text area
 
  middle: automatic calculation consider A) params
 
  fit: automatic calculation consider A)+B) params
 
  dimension: cutspace should be 0 and is calculated according to backspace
 
  
A) params: (\paperwidth=\backspace+\makeupwidth+\cutspace)
+
=== Horizontal ===
backspace => width of inner margin
 
cutspace => width of outer margin (if 0 then = backspace!)
 
  
B) params:
+
If the document is singlesided, then the 'outside' is the right side and the 'inside' is the left side.
leftmargin/rightmargin => width of leftmargin/rightmargin area
 
margin => width of outer margin
 
leftedge/rightedge => width of leftedge/rightedge area
 
*distance (like leftmargindistance) => space separates * area from the inner
 
  
horoffset => shift material towards outside (not tought width calculation)
+
The <code>width</code> parameter sets <code>\makeupwidth</code>, the width of the text area.
  
Vertical:
+
* <code>width=middle</code> solves the following equation to set the makeupwidth:
=========
+
  paperwidth = \backspace + \makeupwidth + \cutspace
 +
** <code>backspace</code> is the distance from the inside edge of the paper to the edge of the text area.
 +
**  <code>cutspace</code> is the width from the outside edge of the text area to the edge of the paper. If cutspace is set to 0, it is taken to be equal to the backspace.
  
Others:
+
* if <code>width=fit</code>, then the calculation is like for <code>width=middle</code>, but with the following additions:
=======
+
** <code>leftmargin/rightmargin</code> => width of leftmargin/rightmargin area
 +
** <code>margin</code> => width of outer margin
 +
** <code>leftedge/rightedge</code> => width of leftedge/rightedge area
 +
** <code>*distance</code> (like leftmargindistance) => space separates * area from the inner
 +
** <code>horoffset</code> is applied after the various width calculations to shift everything bodily to the outside.
  
</pre>
+
== Comment ==
== comment ==
 
  
 
What is needed is a picture of a page with each of these layout parameters indicated. (see [[Layout]])
 
What is needed is a picture of a page with each of these layout parameters indicated. (see [[Layout]])
  
 +
You can use the {{cmd|showframe}} macro to see the results of your layout.  Just put the command before the \starttext and lines will be drawn on your document showing the different areas.
  
You can use the [[cmd:showframe|\showframe]] macro to see the results of your layout.  Just put the command before the \starttext and lines will be drawn on your document showing the different areas.
+
== Grid Setups ==
  
=== Grid Setups ===
+
In MkIV, at least, a number of presets for the <code>grid</code> parameter were defined using {{cmd|definegridsnapping}}; they can be invoked by e.g. <code>\setuplayout[grid=normal]</code>. The presets are all combinations of the following options:
  
At least in MkIV "grid" takes some presets as parameter:
+
{| class=wikitable
 +
|-
 +
| <code>none</code>        || don't enlarge
 +
|-
 +
| <code>halfline</code>    || enlarge by halfline/halfline
 +
|-
 +
| <code>line</code>        || enlarge by line/line
 +
|-
 +
| <code>strut</code>        || enlarge by ht/dp (default)
 +
|-
 +
| <code>first</code>        || align to top line
 +
|-
 +
| <code>last</code>        || align to bottom line
 +
|-
 +
| <code>mindepth</code>    || round depth down
 +
|-
 +
| <code>maxdepth</code>    || round depth up
 +
|-
 +
| <code>minheight</code>    || round height down
 +
|-
 +
| <code>maxheight</code>    || round height up
 +
|-
 +
| <code>local</code>        || use local interline space
 +
|-
 +
| <code>shift:-3tp</code>  || vertical shift within box
 +
|-
 +
|}
  
<pre>
+
These are the presets and their definitions.  
% none            don't enlarge
 
% halfline        enlarge by halfline/halfline
 
% line            enlarge by line/line
 
% strut            enlarge by ht/dp (default)
 
% first            align to top line
 
% last            align to bottom line
 
% mindepth        round depth down
 
% maxdepth        round depth up
 
% minheight        round height down
 
% maxheight        round height up
 
% local            use local interline space
 
% shift:-3tp      vertical shift within box
 
 
 
\definegridsnapping[normal]  [maxheight,maxdepth,strut]
 
\definegridsnapping[standard] [maxheight,maxdepth,strut]
 
\definegridsnapping[yes]      [maxheight,maxdepth,strut]
 
 
 
\definegridsnapping[strict]  [\v!maxdepth:0.8,maxheight:0.8,strut]
 
\definegridsnapping[tolerant] [\v!maxdepth:1.2,maxheight:1.2,strut]
 
 
 
\definegridsnapping[top]      [minheight,maxdepth,strut]
 
\definegridsnapping[bottom]  [maxheight,mindepth,strut]
 
\definegridsnapping[both]    [minheight,mindepth,strut]
 
 
 
\definegridsnapping[broad]    [maxheight,maxdepth,strut,0.8]
 
\definegridsnapping[fit]      [maxheight,maxdepth,strut,1.2]
 
 
 
\definegridsnapping[first]    [first]
 
\definegridsnapping[last]    [last]
 
\definegridsnapping[high]    [minheight,maxdepth,none]
 
\definegridsnapping[low]      [maxheight,mindepth,none]
 
\definegridsnapping[line]    [line]
 
\definegridsnapping[strut]    [strut]
 
 
 
\definegridsnapping[max]      [maxdepth,maxheight,strut]
 
\definegridsnapping[min]      [mindepth,minheight,strut]
 
 
 
</pre>
 
  
 +
{| class=wikitable
 +
|-
 +
| \definegridsnapping[normal]  || [maxheight,maxdepth,strut]
 +
|-
 +
| \definegridsnapping[standard] || [maxheight,maxdepth,strut]
 +
|-
 +
| \definegridsnapping[yes]      || [maxheight,maxdepth,strut]
 +
|-
 +
|
 +
|-
 +
| \definegridsnapping[strict]  || [\v!maxdepth:0.8,maxheight:0.8,strut]
 +
|-
 +
| \definegridsnapping[tolerant] || [\v!maxdepth:1.2,maxheight:1.2,strut]
 +
|-
 +
|
 +
|-
 +
| \definegridsnapping[top]      || [minheight,maxdepth,strut]
 +
|-
 +
| \definegridsnapping[bottom]  || [maxheight,mindepth,strut]
 +
|-
 +
| \definegridsnapping[both]    || [minheight,mindepth,strut]
 +
|-
 +
|
 +
|-
 +
| \definegridsnapping[broad]    || [maxheight,maxdepth,strut,0.8]
 +
|-
 +
| \definegridsnapping[fit]      || [maxheight,maxdepth,strut,1.2]
 +
|-
 +
|
 +
|-
 +
| \definegridsnapping[first]    || [first]
 +
|-
 +
| \definegridsnapping[last]    || [last]
 +
|-
 +
| \definegridsnapping[high]    || [minheight,maxdepth,none]
 +
|-
 +
| \definegridsnapping[low]      || [maxheight,mindepth,none]
 +
|-
 +
| \definegridsnapping[line]    || [line]
 +
|-
 +
| \definegridsnapping[strut]    || [strut]
 +
|-
 +
|
 +
|-
 +
| \definegridsnapping[max]      || [maxdepth,maxheight,strut]
 +
|-
 +
| \definegridsnapping[min]      || [mindepth,minheight,strut]
 +
|-
 +
|}
 +
== Example ==
  
== Example ==
+
<context source=yes>
 +
\setuppapersize[A10]
  
<texcode>
 
 
%% This is an example for showing the effect of the vertical parameters
 
%% This is an example for showing the effect of the vertical parameters
 
%% top, topdistance, bottom, bottomdistance and topspace.
 
%% top, topdistance, bottom, bottomdistance and topspace.
 
%% Just play around with these parameters.
 
%% Just play around with these parameters.
 +
 +
\showframe
  
 
%% Show the top and the bottom with blue color:
 
%% Show the top and the bottom with blue color:
\setupcolors[state=start]
+
\setupbackgrounds[header, footer][background=color, backgroundcolor=blue]
\setupbackgrounds[top,bottom][background=color,backgroundcolor=blue]
 
  
\def\MyLength{50pt}
+
\def\MyLength{10pt}
  
 
\setuplayout[
 
\setuplayout[
  header=0pt,footer=0pt,headerdistance=0pt,footerdistance=0pt,
+
   top=\MyLength,  
   top=\MyLength,topdistance=\MyLength,
+
  topdistance=\MyLength,
   bottom=\MyLength,bottomdistance=\MyLength,
+
   bottom=\MyLength,  
 +
  bottomdistance=\MyLength,
 
   topspace=\dimexpr(\topheight + \topdistance),
 
   topspace=\dimexpr(\topheight + \topdistance),
 
   height=fit]
 
   height=fit]
  
 
\starttext
 
\starttext
\dorecurse{7}{\input tufte}
+
    \input thuan
\showsetups
 
 
\stoptext
 
\stoptext
 
+
</context>
</texcode>
 
 
 
  
 
== See also ==
 
== See also ==
[[Layout]]
+
* [[Layout]]
 +
* {{cmd|adaptlayout}} to locally adapt the page layout
 +
* {{cmd|setuppapersize}} to set the paper size
 +
* [[PaperSetup#Predefined_Paper_Sizes|Paper setup section]] for the predefined paper sizes and [[Paper sizes]] for theirs actuals dimensions in mm.
  
<!-- something like [[cmd:goto|\goto]] -->
+
== Help from ConTeXt-Mailinglist/Forum ==
 +
All issues with:
 +
{{Forum|{{SUBPAGENAME}}}}
  
[[Category:Commands|setuplayout]]
+
[[Category:Command/Layout|setuplayout]]
 +
[[Category:Layout]]

Revision as of 18:33, 18 July 2021

\setuplayout

Syntax (autogenerated)

\setuplayout[...][...=...,...]
[...]name
statestart stop normal repeat
margindimension
edgedimension
margindistancedimension
edgedistancedimension
leftedgedistancedimension
rightedgedistancedimension
leftmargindistancedimension
rightmargindistancedimension
topdistancedimension
headerdistancedimension
footerdistancedimension
bottomdistancedimension
presetname
leftmargindimension
rightmargindimension
leftedgedimension
rightedgedimension
headerdimension
footerdimension
topdimension
bottomdimension
backspacedimension
topspacedimension
setupsname
cutspacedimension
widthdimension middle fit
bottomspacedimension
linesnumber
heightdimension middle fit
horoffsetdimension
veroffsetdimension
columnsnumber
columndistancedimension
methoddefault normal name
locationleft middle right top bottom singlesided doublesided
textwidthdimension
textheightdimension
nxnumber
nynumber
dxdimension
dydimension
scalenumber
sxnumber
synumber
markingon off page empty color one two four
gridyes no off
textdistancedimension
alternativedefault normal makeup name
clipoffsetdimension
cropoffsetdimension auto
trimoffsetdimension
bleedoffsetdimension
artoffsetdimension
directionnormal reverse


\setuplayout[...]
[...]reset name


Syntax

\setuplayout[...,...=...,...]
width dimension fit middle
height dimension fit middle
backspace dimension
topspace dimension
margin dimension
leftmargin dimension
rightmargin dimension
header dimension
footer dimension
top dimension
bottom dimension
leftedge dimension
rightedge dimension
headerdistance dimension
footerdistance dimension
topdistance dimension
bottomdistance dimension
leftmargindistance dimension
rightmargindistance dimension
leftedgedistance dimension
rightedgedistance dimension
horoffset dimension
veroffset dimension
style normal bold slanted boldslanted type cap small... command
color name
marking on off color screen text
location left middle right bottom top singlesided doublesided
scale dimension
nx number
ny number
dx dimension
dy dimension
lines number
columns number
columndistance dimension
grid yes no more see below
bottomspace dimension
cutspace dimension
textdistance dimension
textwidth number
textmargin dimension
clipoffset dimension
page name
paper name


Description

Horizontal

If the document is singlesided, then the 'outside' is the right side and the 'inside' is the left side.

The width parameter sets \makeupwidth, the width of the text area.

  • width=middle solves the following equation to set the makeupwidth:
 paperwidth = \backspace + \makeupwidth + \cutspace
    • backspace is the distance from the inside edge of the paper to the edge of the text area.
    • cutspace is the width from the outside edge of the text area to the edge of the paper. If cutspace is set to 0, it is taken to be equal to the backspace.
  • if width=fit, then the calculation is like for width=middle, but with the following additions:
    • leftmargin/rightmargin => width of leftmargin/rightmargin area
    • margin => width of outer margin
    • leftedge/rightedge => width of leftedge/rightedge area
    • *distance (like leftmargindistance) => space separates * area from the inner
    • horoffset is applied after the various width calculations to shift everything bodily to the outside.

Comment

What is needed is a picture of a page with each of these layout parameters indicated. (see Layout)

You can use the \showframe macro to see the results of your layout. Just put the command before the \starttext and lines will be drawn on your document showing the different areas.

Grid Setups

In MkIV, at least, a number of presets for the grid parameter were defined using \definegridsnapping; they can be invoked by e.g. \setuplayout[grid=normal]. The presets are all combinations of the following options:

none don't enlarge
halfline enlarge by halfline/halfline
line enlarge by line/line
strut enlarge by ht/dp (default)
first align to top line
last align to bottom line
mindepth round depth down
maxdepth round depth up
minheight round height down
maxheight round height up
local use local interline space
shift:-3tp vertical shift within box

These are the presets and their definitions.

\definegridsnapping[normal] [maxheight,maxdepth,strut]
\definegridsnapping[standard] [maxheight,maxdepth,strut]
\definegridsnapping[yes] [maxheight,maxdepth,strut]
\definegridsnapping[strict] [\v!maxdepth:0.8,maxheight:0.8,strut]
\definegridsnapping[tolerant] [\v!maxdepth:1.2,maxheight:1.2,strut]
\definegridsnapping[top] [minheight,maxdepth,strut]
\definegridsnapping[bottom] [maxheight,mindepth,strut]
\definegridsnapping[both] [minheight,mindepth,strut]
\definegridsnapping[broad] [maxheight,maxdepth,strut,0.8]
\definegridsnapping[fit] [maxheight,maxdepth,strut,1.2]
\definegridsnapping[first] [first]
\definegridsnapping[last] [last]
\definegridsnapping[high] [minheight,maxdepth,none]
\definegridsnapping[low] [maxheight,mindepth,none]
\definegridsnapping[line] [line]
\definegridsnapping[strut] [strut]
\definegridsnapping[max] [maxdepth,maxheight,strut]
\definegridsnapping[min] [mindepth,minheight,strut]

Example

\setuppapersize[A10]

%% This is an example for showing the effect of the vertical parameters
%% top, topdistance, bottom, bottomdistance and topspace.
%% Just play around with these parameters.

\showframe

%% Show the top and the bottom with blue color:
\setupbackgrounds[header, footer][background=color, backgroundcolor=blue]

\def\MyLength{10pt}

\setuplayout[
  top=\MyLength, 
  topdistance=\MyLength,
  bottom=\MyLength, 
  bottomdistance=\MyLength,
  topspace=\dimexpr(\topheight + \topdistance),
  height=fit]

\starttext
    \input thuan
\stoptext

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: