Difference between revisions of "Command/setupinitial"

From Wiki
Jump to navigation Jump to search
(move content from Initial page, and add content)
(Noted requirement to define named initials)
Line 248: Line 248:
 
<cd:notes>
 
<cd:notes>
 
<cd:note author="Garulfo" date="2020-12-12T22:46:03+0100">
 
<cd:note author="Garulfo" date="2020-12-12T22:46:03+0100">
 +
  
  
Line 262: Line 263:
  
  
 +
 +
</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:note></cd:notes>
 
<cd:seealso>
 
<cd:seealso>

Revision as of 01:12, 16 December 2021


\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
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 0pt, 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.
location
default is text, but initial can be placed in the margin with location=margin
method
to be determined.

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: