Difference between revisions of "Command/setupinterlinespace"

From Wiki
Jump to navigation Jump to search
m (Text replace - "== Help from ConTeXt-Forum ==" to "== Help from ConTeXt-Forum == All issues with:")
(Add notes about lineheight)
 
(13 intermediate revisions by 7 users not shown)
Line 3: Line 3:
 
|attributes=
 
|attributes=
 
}}
 
}}
 +
 +
== [[Help:Reference|Syntax]] (autogenerated) ==
 +
<syntax>setupinterlinespace</syntax>
  
 
== [[Help:Reference|Syntax]] ==
 
== [[Help:Reference|Syntax]] ==
 
<table cellspacing="4" cellpadding="2" class="cmd">
 
<table cellspacing="4" cellpadding="2" class="cmd">
 
   <tr>
 
   <tr>
     <td colspan="2" class="cmd">\setupinterlinespace<span class="first" style="color:red;">[...]</span><span class="second" >|</span><span class="third" >[...,...=...,...]</span><span class="first" >|</span></td>
+
     <td colspan="2" class="cmd">\setupinterlinespace</td>
 +
  </tr>
 +
  <tr>
 +
    <td colspan="2" class="cmd">\setupinterlinespace<span class="first">[...]</span></td>
 +
  </tr>
 +
  <tr>
 +
    <td colspan="2" class="cmd">\setupinterlinespace<span class="third">[...,...=...,...]</span></td>
 
   </tr>
 
   </tr>
 
   <tr valign="top" class="first">
 
   <tr valign="top" class="first">
Line 15: Line 24:
 
   <tr valign="top" class="third">
 
   <tr valign="top" class="third">
 
     <td class="cmd">[[Command/keyword:height|height]]</td>
 
     <td class="cmd">[[Command/keyword:height|height]]</td>
     <td>[[Command/value:number|number]] </td>
+
     <td>[[Command/value:number|number]]</td>
 
   </tr>
 
   </tr>
 
   <tr valign="top" class="third">
 
   <tr valign="top" class="third">
Line 34: Line 43:
 
   </tr>
 
   </tr>
 
</table>
 
</table>
 
  
 
== Description ==  
 
== Description ==  
<pre>
 
can be used in 3 variants:
 
  
1. \setupinterlinespace
+
{{cmd|setupinterlinespace}} sets up the distance between lines. can be used in three variants:
  (without any param) set line=2.8ex
 
  
2. \setupinterlinespace[...]
+
* Without any keywords: <texcode>\setupinterlinespace</texcode> The command sets the baselineskip to <code>2.8ex</code>.
  reset
 
  small
 
  medium
 
  big
 
  on
 
  off
 
  
3. \setupinterlinespace[...,...=...,...]
+
* With a keyword: <texcode>\setupinterlinespace[KEYWORD]</texcode> The following keywords are available:
  line:   base interline spacing (baselineskip) (e.g. 3ex or 12pt)
+
**  reset
 +
**  small
 +
**  medium
 +
**  big
 +
**  on
 +
**   off
  
  height: size of strut as multiple of line height (e.g. 0.72)
+
* Setting all the parameters involved in line positioning:\setupinterlinespace[...,...=...,...]
  depth:  size of strut as multiple of line height (e.g. 0.28)
+
**  <code>line</code>:  base interline spacing (baselineskip) (e.g. 3ex or 12pt)
 +
**  <code>height</code>: size of strut as multiple of <code>line</code> (e.g. 0.72)
 +
**  <code>depth</code>:  size of strut as multiple of <code>line</code> (e.g. 0.28)
 +
**  <code>top</code>:    topskip (as multiple of line height)
 +
**  <code>bottom</code>: maxdepth (as multiple of line height)
 +
**  <code>stretch</code>: (glue) line stretching
  
  top:    topskip (as multiple of line height)
+
Note that the `lineheight` as shown in {{cmd|showlayout}} is calculated from the `baselineskip`.
  bottom: maxdepth (as multiple of line height)
+
However, a `baselineskip` of `0` will result in a hardcoded value being used, so refrain from that.
 +
If you want the `lineheight` to never exceed the font size,
 +
use a very small value such as `1pt` for `line`.
  
  stretch: (glue) line stretching
+
When setting up the interlinespace, the unit matters:
</pre>
 
  
== Comment ==
+
<texcode>
 +
% interline space adapts itself to body font size
 +
\setupinterlinespace[line=2.8ex]
  
It seems, that <tt>\setupinterlinespace[line=XX\baselineskip]</tt> interacts badly with <tt>\setuplayout</tt> while <tt>\setupinterlinespace[big]</tt> works fine.
+
% set interlinespace to 12pt for every font size --- don't do this!
 +
\setupinterlinespace[line=12pt]
  
 +
% set interlinespace for a particular body font size
 +
% Useful if you think in terms of "nine-point type on eleven-point leading"
 +
\definebodyfontenvironment[9pt][interlinespace=11pt]
 +
</texcode>
  
 +
A final note:
 +
It seems that `\setupinterlinespace[line=XX\baselineskip]` interacts badly with {{cmd|setuplayout}} while `\setupinterlinespace[big]` works fine.
  
 
== Example ==
 
== Example ==
<context source="yes">
+
<context source=yes mode=mkiv>
 +
\setupwhitespace[big]
 +
Original baselineskip=\the\baselineskip
 +
 
 +
{  \definedfont[Serif at 12pt]
 +
    The interlinespace does not change automatically when the font changes\crlf
 +
    baselineskip=\the\baselineskip
 +
}
 +
 
 +
{  \definedfont[Serif at 12pt]
 +
    \setupinterlinespace
 +
    Invoking setupinterlinespace sets baselineskip to 2.8ex of current font\crlf
 +
    baselineskip=\the\baselineskip
 +
}
 +
</context>
 +
 
 +
== Example within {{cmd|startnarrower}}...{{cmd|stopnarrower}} ==
 +
<context source=yes mode=mkiv>
 +
\setupinterlinespace[5] % this has no effect before \starttext
 +
 
 
\starttext
 
\starttext
{\definedfont[Serif at 32pt]This is the long long long title of my book.\par}
+
\input tufte % this is default, not 5
 +
\setupinterlinespace[big]
 +
\input tufte % this is big
  
{\definedfont[Serif at 32pt]\setupinterlinespace This is the long long long title of my book.\par}
+
\startnarrower[left]
 +
\setupinterlinespace[small]
 +
\input tufte % this is small
 +
\stopnarrower
 +
 
 +
\input tufte % this is big again
 
\stoptext
 
\stoptext
 +
 
</context>
 
</context>
 +
  
 
== See also ==
 
== See also ==
<!-- something like [[cmd:goto|\goto]] -->
+
* {{cmd|setupwhitespace}} to set up inter-paragraph spacing.
 +
* {{cmd|setuplayout}} to set sizes of text areas.
 +
* {{cmd|setuplocalinterlinespace}} to set interline spacing locally.
 +
* {{cmd|definebodyfontenvironment}} with keyword [[Command/keyword:interlinespace|interlinespace]] to set interline spacing globally (i.e. before {{cmd|starttext}}).
  
== Help from ConTeXt-Forum ==
+
== Help from ConTeXt-Mailinglist/Forum ==
 
All issues with:
 
All issues with:
 
{{Forum|{{SUBPAGENAME}}}}
 
{{Forum|{{SUBPAGENAME}}}}
  
[[Category:Commands|setupinterlinespace]]
+
[[Category:Command/Paragraphs|setupinterlinespace]]
 +
[[Category:Command/Layout|setupinterlinespace]]

Latest revision as of 11:06, 4 February 2022

\setupinterlinespace

Syntax (autogenerated)

\setupinterlinespace[...,...][...=...,...]
[...,...]name
linedimension
heightnumber
depthnumber
minheightnumber
mindepthnumber
distancedimension
topnumber height
bottomnumber
stretchnumber
shrinknumber


\setupinterlinespace[...,...]
[...,...]on off reset auto small medium big number dimension


\setupinterlinespace[...]
[...]name


Syntax

\setupinterlinespace
\setupinterlinespace[...]
\setupinterlinespace[...,...=...,...]
[...] reset small medium auto big on off
height number
depth number
line dimension
top number
bottom number

Description

\setupinterlinespace sets up the distance between lines. can be used in three variants:

  • Without any keywords:
    \setupinterlinespace
    The command sets the baselineskip to 2.8ex.
  • With a keyword:
    \setupinterlinespace[KEYWORD]
    The following keywords are available:
    • reset
    • small
    • medium
    • big
    • on
    • off
  • Setting all the parameters involved in line positioning:\setupinterlinespace[...,...=...,...]
    • line: base interline spacing (baselineskip) (e.g. 3ex or 12pt)
    • height: size of strut as multiple of line (e.g. 0.72)
    • depth: size of strut as multiple of line (e.g. 0.28)
    • top: topskip (as multiple of line height)
    • bottom: maxdepth (as multiple of line height)
    • stretch: (glue) line stretching

Note that the lineheight as shown in \showlayout is calculated from the baselineskip. However, a baselineskip of 0 will result in a hardcoded value being used, so refrain from that. If you want the lineheight to never exceed the font size, use a very small value such as 1pt for line.

When setting up the interlinespace, the unit matters:

% interline space adapts itself to body font size
\setupinterlinespace[line=2.8ex]

% set interlinespace to 12pt for every font size --- don't do this!
\setupinterlinespace[line=12pt]

% set interlinespace for a particular body font size
% Useful if you think in terms of "nine-point type on eleven-point leading"
\definebodyfontenvironment[9pt][interlinespace=11pt]

A final note: It seems that \setupinterlinespace[line=XX\baselineskip] interacts badly with \setuplayout while \setupinterlinespace[big] works fine.

Example

\setupwhitespace[big]
Original baselineskip=\the\baselineskip

{   \definedfont[Serif at 12pt]
    The interlinespace does not change automatically when the font changes\crlf
    baselineskip=\the\baselineskip
}

{   \definedfont[Serif at 12pt]
    \setupinterlinespace 
    Invoking setupinterlinespace sets baselineskip to 2.8ex of current font\crlf
    baselineskip=\the\baselineskip
}

Example within \startnarrower...\stopnarrower

\setupinterlinespace[5] % this has no effect before \starttext

\starttext
\input tufte % this is default, not 5
\setupinterlinespace[big]
\input tufte % this is big

\startnarrower[left]
\setupinterlinespace[small]
\input tufte % this is small
\stopnarrower

\input tufte % this is big again
\stoptext


See also

Help from ConTeXt-Mailinglist/Forum

All issues with: