Difference between revisions of "Command/setupinterlinespace"

From Wiki
Jump to navigation Jump to search
(new)
 
m (small fix)
 
Line 83: Line 83:
 
<cd:description>{{cmd|setupinterlinespace}} sets up the distance between lines. can be used in three variants:
 
<cd:description>{{cmd|setupinterlinespace}} sets up the distance between lines. can be used in three variants:
  
* Without any keywords: <texcode>\setupinterlinespace</texcode> The command sets the baselineskip to the default value of <code>2.8ex</code>.
+
* Without any keywords: <texcode>\setupinterlinespace</texcode> The command sets the baselineskip to the default value of <code>2.8ex</code>. Use this after changing the font size.
Use this after changing the font size.
 
  
 
* With a keyword: <texcode>\setupinterlinespace[KEYWORD]</texcode> The following keywords are available:
 
* With a keyword: <texcode>\setupinterlinespace[KEYWORD]</texcode> The following keywords are available:
Line 120: Line 119:
 
\definebodyfontenvironment[9pt][interlinespace=11pt]
 
\definebodyfontenvironment[9pt][interlinespace=11pt]
 
</texcode>
 
</texcode>
 
A final note:
 
It seems that `\setupinterlinespace[line=XX\baselineskip]` interacts badly with {{cmd|setuplayout}} while `\setupinterlinespace[big]` works fine.
 
 
</cd:description>
 
</cd:description>
 
<cd:examples><cd:example title="Call &lt;code&gt;\setupinterlinespace&lt;/code&gt; after a font change"><context source="yes">
 
<cd:examples><cd:example title="Call &lt;code&gt;\setupinterlinespace&lt;/code&gt; after a font change"><context source="yes">
Line 134: Line 130:
  
 
{  \definedfont[Serif at 12pt]
 
{  \definedfont[Serif at 12pt]
     \setupinterlinespace  
+
     \setupinterlinespace
 
     Invoking setupinterlinespace sets baselineskip to 2.8ex of current font\crlf
 
     Invoking setupinterlinespace sets baselineskip to 2.8ex of current font\crlf
 
     baselineskip=\the\baselineskip
 
     baselineskip=\the\baselineskip
Line 156: Line 152:
 
\stoptext
 
\stoptext
 
</context></cd:example></cd:examples>
 
</context></cd:example></cd:examples>
<cd:notes></cd:notes>
+
<cd:notes>
 +
<cd:note author="Hraban" date="2024-04-01T19:46:18+0200">
 +
It seems that `\setupinterlinespace[line=XX\baselineskip]` interacts badly with {{cmd|setuplayout}} while `\setupinterlinespace[big]` works fine.
 +
 
 +
</cd:note></cd:notes>
 
<cd:seealso>
 
<cd:seealso>
 
<cd:commandref name="defineinterlinespace" originator="system"></cd:commandref>
 
<cd:commandref name="defineinterlinespace" originator="system"></cd:commandref>

Latest revision as of 17:48, 1 April 2024


\setupinterlinespace

Summary

The command \setupinterlinespace is used to set the (general) baseline skip.

Settings

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

Settings argument

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

Settings name

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

Description

\setupinterlinespace sets up the distance between lines. can be used in three variants:
  • Without any keywords:
    \setupinterlinespace
    The command sets the baselineskip to the default value of 2.8ex. Use this after changing the font size.
  • With a keyword:
    \setupinterlinespace[KEYWORD]
    The following keywords are available:
    • reset
    • small
    • medium
    • big
    • on
    • off
  • Setting all the parameters involved in line positioning:
    • 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]

Examples

Call \setupinterlinespace after a font change

\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

Notes

  • By Hraban on 2024-04-01T19:46:18+0200:
It seems that \setupinterlinespace[line=XX\baselineskip] interacts badly with \setuplayout while \setupinterlinespace[big] works fine.

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: