Difference between revisions of "Command/setupinitial"

From Wiki
Jump to navigation Jump to search
Line 90: Line 90:
  
 
</cd:description>
 
</cd:description>
<cd:examples><cd:example title="">The following example produces an awful-looking initial, but it illustrates how some of these parameters work.
+
<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 101: Line 101:
  
 
\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]}]}
 +
 +
and
  
 
\type[option=context]{\setupinitial[n=2, m=2]}
 
\type[option=context]{\setupinitial[n=2, m=2]}
Line 108: Line 112:
 
\input knuth
 
\input knuth
  
\blank[2*big]
+
\blank[big]
  
\type[option=context]{\setupinitial[n=3, m=4]}
+
or \type[option=context]{\setupinitial[n=3, m=4]}
  
 
\setupinitial[n=3, m=4]
 
\setupinitial[n=3, m=4]
Line 116: Line 120:
 
\input knuth
 
\input knuth
  
\blank[2*big]
+
\blank[big]
  
\type[option=context]{\setupinitial[location=margin,n=3, m=1,distance=5mm]}
+
or \type[option=context]{\setupinitial[location=margin,n=3, m=1,distance=5mm]}
  
 
\setupinitial[location=margin,n=3, m=1,distance=5mm]
 
\setupinitial[location=margin,n=3, m=1,distance=5mm]
Line 126: Line 130:
 
\stoptext
 
\stoptext
  
</context></cd:example><cd:example title="Details about hoffset"><context mode="mkiv" source="yes">
+
</context></cd:example><cd:example title="hoffset"><context mode="mkiv" source="yes">
 
\definepapersize[sheet][width=120mm,height=200mm]
 
\definepapersize[sheet][width=120mm,height=200mm]
 
\setuppapersize[sheet]
 
\setuppapersize[sheet]
Line 163: Line 167:
 
\stoptext
 
\stoptext
  
</context></cd:example><cd:example title="Details about voffset"><context mode="mkiv" source="yes">
+
</context></cd:example><cd:example title="voffset"><context mode="mkiv" source="yes">
 
\definepapersize[sheet][width=120mm,height=200mm]
 
\definepapersize[sheet][width=120mm,height=200mm]
 
\setuppapersize[sheet]
 
\setuppapersize[sheet]
Line 177: Line 181:
 
\input knuth
 
\input knuth
  
\blank[2*big]
+
\blank[big]
 
+
\type[option=context]{\setupinitial[voffset=0mm]}
Here is some text 2.
 
  
 
\setupinitial[voffset=0mm]
 
\setupinitial[voffset=0mm]
 
\placeinitial
 
\placeinitial
T{\tt\bf voffset=0mm}~\input knuth
+
\input knuth
 +
 
 +
\blank[big]
 +
\type[option=context]{\setupinitial[voffset=5mm]}
  
 
\setupinitial[voffset=5mm]
 
\setupinitial[voffset=5mm]
 
\placeinitial
 
\placeinitial
T{\tt\bf voffset=5mm}~\input knuth
+
\input knuth
  
\setupinitial[voffset=-5mm]
+
\blank[big]
 +
\type[option=context]{\setupinitial[hoffset=-5mm]}
 +
 
 +
\setupinitial[hoffset=-5mm]
 
\placeinitial
 
\placeinitial
T{\tt\bf voffset=-5mm}~\input knuth
+
\input knuth
 
 
  
 
\stoptext
 
\stoptext
  
</context></cd:example><cd:example title="Details about 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=200mm]
 
\setuppapersize[sheet]
 
\setuppapersize[sheet]
Line 210: Line 218:
 
\input knuth
 
\input knuth
  
\blank[2*big]
+
\blank[big]
 
+
\type[option=context]{\setupinitial[font=Bold at 45pt]}
Here is some text 2.
 
  
 
\setupinitial[font=Bold at 45pt]
 
\setupinitial[font=Bold at 45pt]
Line 218: Line 225:
 
\input knuth
 
\input knuth
  
Here is some text 3.
+
\blank[big]
 +
\type[option=context]{\setupinitial[font=SansBold at 45pt]}
  
 
\setupinitial[font=SansBold at 45pt]
 
\setupinitial[font=SansBold at 45pt]
Line 235: Line 243:
 
\starttext
 
\starttext
  
Here is some text 1.
+
\type[option=context]{\setupinitial[text=Here]}
  
 
\setupinitial[color=darkred,text=Here]
 
\setupinitial[color=darkred,text=Here]

Revision as of 21:33, 12 December 2020


\setupinitial

Summary

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

The command \setupinitial is used to customize this decorative or ornate first letter(s) to prose 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
the number of lines in the paragraph that the initial should occupy. It defaults to 3. Another description can be "line where footline of dropcapital"
m
number of letters to capitalize
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
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. Another description can be "offsets the following text", or "distance to the following text"
hoffset
is the distance to the left (into the left margin) that the initial should be shifted from its default position. This defaults to 0pt. Another description can be "shift the initial horizontally, on the left (positive value) or on the right (negative value)"
voffset
is the distance downward 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.
style
style of the initial, for example style=\tex{bfd} for large bold
color
which defaults to the current color, for example color=darkred
font
font specification which defaults to boldface scaled to the number of text lines that the initial occupies, for example font=Bold at 32pt
text
the text specified will be used as initial, instead of the letter following the \placeinitial command.
location
default is text, but initial can be placed in the margin with location=margin
method
no idea...

Description

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


Examples

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]

\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]

\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]

\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[hoffset=-5mm]}

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

\stoptext

font

\definepapersize[sheet][width=120mm,height=200mm]
\setuppapersize[sheet]
\setuppagenumbering[location=]
\setuplayout[width=100mm,backspace=15mm,topspace=0mm,header=0mm,headerdistance=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

Details about font

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

\starttext

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

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


\stoptext

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: