Difference between revisions of "Command/setupinterlinespace"

From Wiki
Jump to navigation Jump to search
m (Added comment about using this command for "leading" specification in traditional terms.)
m (Added "definebodyfontenvironment" under "See also".)
(6 intermediate revisions by 4 users not shown)
Line 7: Line 7:
 
<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 21:
 
   <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 35: Line 41:
 
</table>
 
</table>
  
 +
== Description ==
  
== Description ==
+
{{cmd|setupinterlinespace}} sets up the distance between lines. can be used in three variants:
<pre>
+
 
can be used in 3 variants:
+
* Without any keywords:<texcode>\setupinterlinespace</texcode> The command sets the baselineskip to <code>2.8ex</code>.
  
1. \setupinterlinespace
+
* With a keyword: <texcode>\setupinterlinespace[...]</texcode> The following keywords are available:
  (without any param) set line=2.8ex
+
**  reset
 +
**  small
 +
**  medium
 +
**  big
 +
**  on
 +
**  off
  
2. \setupinterlinespace[...]
+
* Setting all the parameters involved in line positioning:\setupinterlinespace[...,...=...,...]
  reset
+
**  <code>line</code>:  base interline spacing (baselineskip) (e.g. 3ex or 12pt)
  small
+
**  <code>height</code>: size of strut as multiple of <code>line</code> (e.g. 0.72)
  medium
+
**  <code>depth</code>:  size of strut as multiple of <code>line</code> (e.g. 0.28)
   big
+
**  <code>top</code>:   topskip (as multiple of line height)
  on
+
**  <code>bottom</code>: maxdepth (as multiple of line height)
  off
+
**  <code>stretch</code>: (glue) line stretching
  
3. \setupinterlinespace[...,...=...,...]
+
When setting up the interlinespace, it matters which unit one chooses:
  line:   base interline spacing (baselineskip) (e.g. 3ex or 12pt)
 
  
  height: size of strut as multiple of line height (e.g. 0.72)
+
<texcode>
  depth:  size of strut as multiple of line height (e.g. 0.28)
+
% interline space adapts itself to body font size
 +
\setupinterlinespace[line=2.8ex]
  
  top:    topskip (as multiple of line height)
+
% set interlinespace to 12pt for every font size --- don't do this!
  bottom: maxdepth (as multiple of line height)
+
\setupinterlinespace[line=12pt]
  
  stretch: (glue) line stretching
+
% set interlinespace for a particular body font size
</pre>
+
% Useful if you think in terms of "nine-point type on eleven-point leading"
 +
\definebodyfontenvironment[9pt][interlinespace=11pt]
 +
</texcode>
  
== Comment ==
+
A final note: it seems that <tt>\setupinterlinespace[line=XX\baselineskip]</tt> interacts badly with <tt>\setuplayout</tt> while <tt>\setupinterlinespace[big]</tt> works fine.
  
It seems, that <tt>\setupinterlinespace[line=XX\baselineskip]</tt> interacts badly with <tt>\setuplayout</tt> while <tt>\setupinterlinespace[big]</tt> works fine.
+
== Example ==
 +
<context source=yes mode=mkiv>
 +
\setuppapersize[A5][A5]
 +
\setupwhitespace[big]
  
Those used to traditional typography specifications (e.g. "eleven point type on fourteen point leading" written as 11/14) would use the following:
+
\starttext
<p>
 
<tt>\setupbodyfont[11pt] % not necessary because 12pt is the default font size</tt><br>
 
<tt>\setupinterlinespace[line=14pt] % default: line=2.8ex</tt>
 
</p>
 
  
 +
\the\baselineskip
  
 +
% The interlinespace does not change automatically when the font changes
 +
{  \definedfont[Serif at 32pt]
 +
    This is the long long title of my book\crlf
 +
    baselineskip=\the\baselineskip
 +
}
  
 +
% Invoking \setupinterlinespace sets baselineskip to 2.8ex of current font
 +
{  \definedfont[Serif at 32pt]
 +
    \setupinterlinespace
 +
    This is the long long title of my book\crlf
 +
    baselineskip=\the\baselineskip
 +
}
 +
 +
\stoptext
 +
 +
</context>
 +
 +
== Example within {{cmd|startnarrower}}...{{cmd|stopnarrower}} ==
 +
<context source=yes mode=mkiv>
 +
\setuppapersize[A5][A5]
 +
\setupinterlinespace[5] % this has no effect before \starttext
  
== Example ==
 
<context source="yes">
 
 
\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
 +
 
 +
\startnarrower[left]
 +
\setupinterlinespace[small]
 +
\input tufte % this is small
 +
\stopnarrower
  
{\definedfont[Serif at 32pt]\setupinterlinespace This is the long long long title of my book.\par}
+
\input tufte % this is big again
 
\stoptext
 
\stoptext
 +
 
</context>
 
</context>
 +
  
 
== See also ==
 
== See also ==
<!-- something like {{cmd|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-Mailinglist/Forum ==
 
== Help from ConTeXt-Mailinglist/Forum ==
Line 93: Line 137:
  
 
[[Category:Command/Paragraphs|setupinterlinespace]]
 
[[Category:Command/Paragraphs|setupinterlinespace]]
 +
[[Category:Command/Layout|setupinterlinespace]]

Revision as of 11:57, 28 September 2016

\setupinterlinespace

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[...]
    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

When setting up the interlinespace, it matters which unit one chooses:

% 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

\setuppapersize[A5][A5]
\setupwhitespace[big]

\starttext

\the\baselineskip

% The interlinespace does not change automatically when the font changes
{   \definedfont[Serif at 32pt]
    This is the long long title of my book\crlf
    baselineskip=\the\baselineskip
}

% Invoking \setupinterlinespace sets baselineskip to 2.8ex of current font
{   \definedfont[Serif at 32pt]
    \setupinterlinespace 
    This is the long long title of my book\crlf
    baselineskip=\the\baselineskip
}

\stoptext

Example within \startnarrower...\stopnarrower

\setuppapersize[A5][A5]
\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: