Difference between revisions of "Command/setupinitial"

From Wiki
Jump to navigation Jump to search
(Meaning of "method")
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
<cd:commandgroup name="setupinitial" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807">
 
<cd:commandgroup name="setupinitial" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807">
<cd:shortdesc>Initials (also known as drop caps, dropped caps, or versals) can be made in ConTeXt using the \placeinitial command.
+
<cd:shortdesc>Initials (also known as drop caps, dropped caps, or versals) can be made in ConTeXt using the {{cmd|placeinitial}} command.
  
The command <code>\setupinitial</code> is used to customize this decorative or ornate first letter(s) to prose at the start of chapters, sections, paragraphs, and so forth.
+
The command {{cmd|setupinitial}} detailed here is used to customize this decorative first letter(s) at the start of chapters, sections, paragraphs, and so forth.
  
  
Line 16: Line 16:
 
     <cd:assignmentsdoc></cd:assignmentsdoc>
 
     <cd:assignmentsdoc></cd:assignmentsdoc>
 
     <cd:parameter name="n">
 
     <cd:parameter name="n">
       <cd:paramdoc>the number of lines in the paragraph that the initial should occupy. It defaults to 3.
+
       <cd:paramdoc>number of lines in the paragraph that the initial should occupy. It defaults to 3. The size of the initial is adapted accordingly, but it can be changed with font parameter.</cd:paramdoc>
 
 
Another description can be "line where footline of dropcapital"</cd:paramdoc>
 
 
       <cd:constant type="cd:number"></cd:constant>
 
       <cd:constant type="cd:number"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="m">
 
     <cd:parameter name="m">
       <cd:paramdoc>number of letters to capitalize</cd:paramdoc>
+
       <cd:paramdoc>number of letters to capitalize (gets ignored if you set `text`)</cd:paramdoc>
 
       <cd:constant type="cd:number"></cd:constant>
 
       <cd:constant type="cd:number"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
Line 33: Line 31:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="distance">
 
     <cd:parameter name="distance">
       <cd:paramdoc>is the horizontal distance which initial line(s) of the paragraph should be indented beyond the space needed for the letter. It defaults to 0pt, and it can be negative.
+
       <cd:paramdoc>the horizontal distance which initial line(s) of the paragraph should be indented beyond the space needed for the letter. It defaults to <code>.125\emwidth</code>, and it can be negative.</cd:paramdoc>
 
 
Another description can be "offsets the following text", or "distance to the following text"</cd:paramdoc>
 
 
       <cd:constant type="cd:dimension"></cd:constant>
 
       <cd:constant type="cd:dimension"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="hoffset">
 
     <cd:parameter name="hoffset">
       <cd:paramdoc>is the distance to the left (into the left margin) that the initial should be shifted from its default position. This defaults to 0pt.
+
       <cd:paramdoc>the distance to the left (into the left margin), or to the right, that the initial should be shifted from its default position. This defaults to 0pt.
 
+
</cd:paramdoc>
Another description can be "shift the initial horizontally, on the left (positive value) or on the right (negative value)"</cd:paramdoc>
 
 
       <cd:constant type="cd:dimension"></cd:constant>
 
       <cd:constant type="cd:dimension"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="voffset">
 
     <cd:parameter name="voffset">
       <cd:paramdoc>is the distance downward from its default position that the initial should be shifted. This defaults to 0pt.
+
       <cd:paramdoc>the distance downward, or upward (negative value), from its default position that the initial should be shifted. This defaults to 0pt.
  
Another description can be "shift the initial vertically, down (positive value) or up (negative value).
+
Value 0pt gives a "top" alignment, i.e. corresponding with the first line of the paragraph.</cd:paramdoc>
 
 
Value 0pt gives a "top" alignment.</cd:paramdoc>
 
 
       <cd:constant default="yes" type="line"></cd:constant>
 
       <cd:constant default="yes" type="line"></cd:constant>
 
       <cd:constant type="cd:dimension"></cd:constant>
 
       <cd:constant type="cd:dimension"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="style">
 
     <cd:parameter name="style">
       <cd:paramdoc>style of the initial, for example <code>style=\tex{bfd}</code> for large bold</cd:paramdoc>
+
       <cd:paramdoc>style of the initial, for example <code>style=\it</code> for italic.</cd:paramdoc>
 
       <cd:constant type="cd:style"></cd:constant>
 
       <cd:constant type="cd:style"></cd:constant>
 
       <cd:constant type="cd:command"></cd:constant>
 
       <cd:constant type="cd:command"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="color">
 
     <cd:parameter name="color">
       <cd:paramdoc>which defaults to the current color, for example <code>color=darkred</code></cd:paramdoc>
+
       <cd:paramdoc>for example <code>color=darkred</code>. It defaults to the current color.</cd:paramdoc>
 
       <cd:constant type="cd:color"></cd:constant>
 
       <cd:constant type="cd:color"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="font">
 
     <cd:parameter name="font">
       <cd:paramdoc>font specification which defaults to boldface scaled to the number of text lines that the initial occupies, for example <code>font=Bold at 32pt</code></cd:paramdoc>
+
       <cd:paramdoc>font specification. It defaults to boldface scaled to the number of text lines that the initial occupies, but can be customized, for example: <code>font=Bold at 32pt</code>.</cd:paramdoc>
 
       <cd:constant type="cd:font"></cd:constant>
 
       <cd:constant type="cd:font"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="text">
 
     <cd:parameter name="text">
       <cd:paramdoc>the text specified will be used as initial, instead of the letter following the <code>\placeinitial</code> command.</cd:paramdoc>
+
       <cd:paramdoc>the text specified will be used as initial, instead of the letter following the <code>\placeinitial</code> command; `m` gets ignored.</cd:paramdoc>
 
       <cd:constant type="cd:text"></cd:constant>
 
       <cd:constant type="cd:text"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
Line 76: Line 69:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="method">
 
     <cd:parameter name="method">
       <cd:paramdoc>no idea...</cd:paramdoc>
+
       <cd:paramdoc>Affects the handling of quotation marks at the beginning. Doesn’t work with all languages, this is probably an oversight/bug. Under most circumstances, a leading quotation mark will get used as initial.</cd:paramdoc>
 
       <cd:constant type="first"></cd:constant>
 
       <cd:constant type="first"></cd:constant>
 
       <cd:constant type="last"></cd:constant>
 
       <cd:constant type="last"></cd:constant>
       <cd:constant type="auto"></cd:constant>
+
       <cd:constant type="auto">The first letter after the quotation mark is included in the initial.</cd:constant>
 
       <cd:constant default="yes" type="none"></cd:constant>
 
       <cd:constant default="yes" type="none"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
Line 86: Line 79:
 
   </cd:command>
 
   </cd:command>
 
</cd:variants>
 
</cd:variants>
<cd:description>Because the space carved out for the initial is rectangular, initials work best with a font with rectangular ornaments around the letter.
+
<cd:description></cd:description>
 
+
<cd:examples><cd:example title="color, distance, before + variations on n, m , location">The following example produces an awful-looking initial, but it illustrates how some of these parameters work.
 
 
</cd:description>
 
<cd:examples><cd:example title="n, m , location">The following example produces an awful-looking initial, but it illustrates how some of these parameters work.
 
  
 
<context mode="mkiv" source="yes">
 
<context mode="mkiv" source="yes">
Line 96: Line 86:
 
\setuppapersize[sheet]
 
\setuppapersize[sheet]
 
\setuppagenumbering[location=]
 
\setuppagenumbering[location=]
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm]
+
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm,footer=0mm,footerdistance=0mm]
  
 
\starttext
 
\starttext
  
\setupinitial[color=darkred, distance=10mm, before={\blank[big]\hairline\blank[big]}]
+
\setupinitial
 +
  [color=darkred,
 +
  distance=10mm,
 +
  before={\blank[big]\hairline\blank[big]}]
  
\type[option=context]{\setupinitial[color=darkred, distance=10mm, before={\blank[big]\hairline\blank[big]}]}
+
\type[option=context]{\setupinitial[color=darkred,distance=10mm,before={\blank[big]\hairline\blank[big]}]}
  
 
and
 
and
Line 134: Line 127:
 
\setuppapersize[sheet]
 
\setuppapersize[sheet]
 
\setuppagenumbering[location=]
 
\setuppagenumbering[location=]
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm]
+
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm,footer=0mm,footerdistance=0mm]
  
 
\starttext
 
\starttext
Line 171: Line 164:
 
\setuppapersize[sheet]
 
\setuppapersize[sheet]
 
\setuppagenumbering[location=]
 
\setuppagenumbering[location=]
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm]
+
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm,footer=0mm,footerdistance=0mm]
  
 
\starttext
 
\starttext
Line 196: Line 189:
  
 
\blank[big]
 
\blank[big]
\type[option=context]{\setupinitial[hoffset=-5mm]}
+
\type[option=context]{\setupinitial[voffset=-5mm]}
  
\setupinitial[hoffset=-5mm]
+
\setupinitial[voffset=-5mm]
 
\placeinitial
 
\placeinitial
 
\input knuth
 
\input knuth
Line 205: Line 198:
  
 
</context></cd:example><cd:example title="font"><context mode="mkiv" source="yes">
 
</context></cd:example><cd:example title="font"><context mode="mkiv" source="yes">
\definepapersize[sheet][width=120mm,height=200mm]
+
\definepapersize[sheet][width=120mm,height=150mm]
 
\setuppapersize[sheet]
 
\setuppapersize[sheet]
 
\setuppagenumbering[location=]
 
\setuppagenumbering[location=]
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm]
+
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm,footer=0mm,footerdistance=0mm]
  
 
\starttext
 
\starttext
Line 235: Line 228:
 
\stoptext
 
\stoptext
  
</context></cd:example><cd:example title="Details about font"><context mode="mkiv" source="yes">
+
</context></cd:example><cd:example title="text"><context mode="mkiv" source="yes">
\definepapersize[sheet][width=120mm,height=120mm]
+
\definepapersize[sheet][width=120mm,height=80mm]
 
\setuppapersize[sheet]
 
\setuppapersize[sheet]
 
\setuppagenumbering[location=]
 
\setuppagenumbering[location=]
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm]
+
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm,footer=0mm,footerdistance=0mm]
  
 
\starttext
 
\starttext
Line 253: Line 246:
  
 
</context></cd:example></cd:examples>
 
</context></cd:example></cd:examples>
<cd:notes></cd:notes>
+
<cd:notes>
 +
<cd:note author="Garulfo" date="2020-12-12T22:46:03+0100">
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
Because the space carved out for the initial is rectangular, initials work best with a font with rectangular ornaments around the letter.
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
</cd:note>
 +
<cd:note author="Rik" date="2021-12-16T02:10:09+0100">
 +
 
 +
 
 +
 
 +
 
 +
Named initials must be defined using {{cmd|defineinitial}}.
 +
 
 +
 
 +
 
 +
 
 +
</cd:note></cd:notes>
 
<cd:seealso>
 
<cd:seealso>
<cd:commandref name="defineinitial" originator="system">placeinitial </cd:commandref>
+
<cd:commandref name="defineinitial" originator="system"></cd:commandref>
 
<cd:source file="typo-drp.mkiv" originator="system"></cd:source>
 
<cd:source file="typo-drp.mkiv" originator="system"></cd:source>
 
<cd:wikipage originator="system" page="Category:Fonts"></cd:wikipage>
 
<cd:wikipage originator="system" page="Category:Fonts"></cd:wikipage>
<cd:commandref name="placeinitial">placeinitial</cd:commandref></cd:seealso>
+
<cd:commandref name="placeinitial"></cd:commandref>
 +
<cd:commandref name="definefirstline">to apply specific style to the whole first line, or first words</cd:commandref></cd:seealso>
 
</cd:commandgroup>
 
</cd:commandgroup>

Latest revision as of 15:42, 4 March 2024


\setupinitial

Summary

Initials (also known as drop caps, dropped caps, or versals) can be made in ConTeXt using the \placeinitial command.

The command \setupinitial detailed here is used to customize this decorative first letter(s) at the start of chapters, sections, paragraphs, and so forth.


Settings

\setupinitial[...,...][...=...,...]
[...,...]name
nnumber
mnumber
beforecommand
distancedimension
hoffsetdimension
voffsetline dimension
stylestyle command
colorcolor
fontfont
texttext
locationmargin text
methodfirst last auto none

OptionExplanation
n
number of lines in the paragraph that the initial should occupy. It defaults to 3. The size of the initial is adapted accordingly, but it can be changed with font parameter.
m
number of letters to capitalize (gets ignored if you set text)
before
contains any commands that you would like to do prior to placing the initial. This parameter is empty by default.

For example, to insert 2 big space before placement of the initial,

before={\blank[2*big]}]
distance
the horizontal distance which initial line(s) of the paragraph should be indented beyond the space needed for the letter. It defaults to .125\emwidth, and it can be negative.
hoffset
the distance to the left (into the left margin), or to the right, that the initial should be shifted from its default position. This defaults to 0pt.
voffset
the distance downward, or upward (negative value), from its default position that the initial should be shifted. This defaults to 0pt. Value 0pt gives a "top" alignment, i.e. corresponding with the first line of the paragraph.
style
style of the initial, for example style=\it for italic.
color
for example color=darkred. It defaults to the current color.
font
font specification. It defaults to boldface scaled to the number of text lines that the initial occupies, but can be customized, for example: font=Bold at 32pt.
text
the text specified will be used as initial, instead of the letter following the \placeinitial command; m gets ignored.
location
default is text, but initial can be placed in the margin with location=margin
method
Affects the handling of quotation marks at the beginning. Doesn’t work with all languages, this is probably an oversight/bug. Under most circumstances, a leading quotation mark will get used as initial.
auto The first letter after the quotation mark is included in the initial.

Description

Examples

color, distance, before + variations on n, m , location

The following example produces an awful-looking initial, but it illustrates how some of these parameters work.

\definepapersize[sheet][width=120mm,height=200mm]
\setuppapersize[sheet]
\setuppagenumbering[location=]
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm,footer=0mm,footerdistance=0mm]

\starttext

\setupinitial
  [color=darkred,
   distance=10mm,
   before={\blank[big]\hairline\blank[big]}]

\type[option=context]{\setupinitial[color=darkred,distance=10mm,before={\blank[big]\hairline\blank[big]}]}

and

\type[option=context]{\setupinitial[n=2, m=2]}

\setupinitial[n=2, m=2]
\placeinitial
\input knuth

\blank[big]

or \type[option=context]{\setupinitial[n=3, m=4]}

\setupinitial[n=3, m=4]
\placeinitial
\input knuth

\blank[big]

or \type[option=context]{\setupinitial[location=margin,n=3, m=1,distance=5mm]}

\setupinitial[location=margin,n=3, m=1,distance=5mm]
\placeinitial
\input knuth

\stoptext

hoffset

\definepapersize[sheet][width=120mm,height=200mm]
\setuppapersize[sheet]
\setuppagenumbering[location=]
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm,footer=0mm,footerdistance=0mm]

\starttext

Here is some text 1.

\setupinitial[color=darkred]
\placeinitial
\input knuth

\blank[big]
\type[option=context]{\setupinitial[hoffset=0mm]}

\setupinitial[hoffset=0mm]
\placeinitial
\input knuth

\blank[big]
\type[option=context]{\setupinitial[hoffset=5mm]}

\setupinitial[hoffset=5mm]
\placeinitial
\input knuth

\blank[big]
\type[option=context]{\setupinitial[hoffset=-5mm]}

\setupinitial[hoffset=-5mm]
\placeinitial
\input knuth

\stoptext

voffset

\definepapersize[sheet][width=120mm,height=200mm]
\setuppapersize[sheet]
\setuppagenumbering[location=]
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm,footer=0mm,footerdistance=0mm]

\starttext

Here is some text 1.

\setupinitial[color=darkred]
\placeinitial
\input knuth

\blank[big]
\type[option=context]{\setupinitial[voffset=0mm]}

\setupinitial[voffset=0mm]
\placeinitial
\input knuth

\blank[big]
\type[option=context]{\setupinitial[voffset=5mm]}

\setupinitial[voffset=5mm]
\placeinitial
\input knuth

\blank[big]
\type[option=context]{\setupinitial[voffset=-5mm]}

\setupinitial[voffset=-5mm]
\placeinitial
\input knuth

\stoptext

font

\definepapersize[sheet][width=120mm,height=150mm]
\setuppapersize[sheet]
\setuppagenumbering[location=]
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm,footer=0mm,footerdistance=0mm]

\starttext

Here is some text 1.

\setupinitial[color=darkred]
\placeinitial
\input knuth

\blank[big]
\type[option=context]{\setupinitial[font=Bold at 45pt]}

\setupinitial[font=Bold at 45pt]
\placeinitial
\input knuth

\blank[big]
\type[option=context]{\setupinitial[font=SansBold at 45pt]}

\setupinitial[font=SansBold at 45pt]

\placeinitial
\input knuth

\stoptext

text

\definepapersize[sheet][width=120mm,height=80mm]
\setuppapersize[sheet]
\setuppagenumbering[location=]
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=0mm,footer=0mm,footerdistance=0mm]

\starttext

\type[option=context]{\setupinitial[text=Here]}

\setupinitial[color=darkred,text=Here]
\placeinitial
\input knuth


\stoptext

Notes

  • By Garulfo on 2020-12-12T22:46:03+0100:

Because the space carved out for the initial is rectangular, initials work best with a font with rectangular ornaments around the letter.

  • By Rik on 2021-12-16T02:10:09+0100:

Named initials must be defined using \defineinitial.

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: