Difference between revisions of "Command/setupinitial"

From Wiki
Jump to navigation Jump to search
Line 88: Line 88:
 
<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>Because the space carved out for the initial is rectangular, initials work best with a font with rectangular ornaments around the letter.
  
== Lettrine module ==
 
  
'''Beware:''' At this point (2020-12), the lettrine module doesn’t work with LMTX!
+
</cd:description>
 +
<cd:examples><cd:example title="The following example produces an awful-looking initial, but it illustrates how some of these parameters work."><context mode="mkiv" source="yes">
 +
\definepapersize[sheet][width=120mm,height=120mm]
 +
\setuppapersize[sheet]
 +
\setuppagenumbering[location=]
 +
\setuplayout[width=120mm,backspace=20mm,topspace=0mm,header=0mm,headerdistance=0mm]
 +
 
 +
\starttext
  
If you want more options to customize your initials, try the [http://modules.contextgarden.net/t-lettrine lettrine module]. An example of the types of customizations that this module allows is:
+
Here is some text 1.
<texcode>
 
\usemodule[lettrine]
 
\def \LettrineStyle{\definefontsynonym[LettrineFont][Italic]}
 
\setuplettrine [A][Lines=2,Findent=0.2em,Nindent=0.01em,FontHook={\LettrineStyle}]
 
\setuplettrine [T][Lines=2,Findent=0.35em,Nindent=0.01em,FontHook={\LettrineStyle},Hang=.25]
 
\setuplettrine [I][Lines=2,Findent=0.3em,Nindent=0.01em,FontHook={\LettrineStyle},Hang=.25]
 
\setuplettrine [O][Lines=2,Findent=0.2em,Nindent=0.01em,FontHook={\LettrineStyle}]
 
\setuplettrine [C][Lines=2,Findent=0.3em,Nindent=0.01em,FontHook={\LettrineStyle}]
 
\setuplettrine [W][Lines=2,Findent=0.3em,Nindent=0.01em,FontHook={\LettrineStyle},Hang=.34]
 
  
\starttext
+
\setupinitial[color=darkred, distance=15mm, n=2, m=2, before={\blank[big]\hairline\blank[big]}]
\lettrine{A}{fter the three} \input ward
+
\placeinitial
\stoptext
+
\input knuth
</texcode>
+
 
 +
\blank[2*big]
  
 +
Here is some text 2.
  
</cd:description>
+
\setupinitial[n=3, m=4]
<cd:examples><cd:example title="">The following example produces an awful-looking initial, but it illustrates how some of these parameters work:
+
\placeinitial
 +
\input knuth
  
 +
\stoptext
  
<context mode="mkiv" source="yes">
+
</context></cd:example><cd:example title="Details about offset"><context mode="mkiv" source="yes">
\definepapersize[sheet][width=150mm,height=200mm]
+
\definepapersize[sheet][width=120mm,height=250mm]
 
\setuppapersize[sheet]
 
\setuppapersize[sheet]
 
\setuppagenumbering[location=]
 
\setuppagenumbering[location=]
\setuplayout[width=150mm,backspace=0mm,topspace=0mm,header=0mm,headerdistance=0mm]
+
\setuplayout[width=120mm,backspace=20mm,topspace=0mm,header=0mm,headerdistance=0mm]
  
 
\starttext
 
\starttext
Line 123: Line 124:
 
Here is some text 1.
 
Here is some text 1.
  
\setupinitial[color=darkred, distance=15mm, n=2, m=2, before={\blank[big]\hairline\blank[big]}]
+
\setupinitial[color=darkred]
 
\placeinitial
 
\placeinitial
 
\input knuth
 
\input knuth
Line 131: Line 132:
 
Here is some text 2.
 
Here is some text 2.
  
\setupinitial[n=3, m=4]
+
\setupinitial[hoffset=5mm]
 +
\placeinitial
 +
T{\tt hoffset=5mm}\input knuth
 +
 
 +
\setupinitial[hoffset=-5mm]
 +
\placeinitial
 +
T{\tt hoffset=-5mm}\input knuth
 +
 
 +
 
 +
\setupinitial[voffset=5mm]
 +
\placeinitial
 +
T{\tt voffset=5mm}\input knuth
 +
 
 +
\setupinitial[voffset=-5mm]
 
\placeinitial
 
\placeinitial
\input knuth
+
T{\tt voffset=-5mm}\input knuth
  
 
\stoptext
 
\stoptext

Revision as of 17:36, 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

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

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

\starttext

Here is some text 1.

\setupinitial[color=darkred, distance=15mm, n=2, m=2, before={\blank[big]\hairline\blank[big]}]
\placeinitial
\input knuth

\blank[2*big]

Here is some text 2.

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

\stoptext

Details about offset

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

\starttext

Here is some text 1.

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

\blank[2*big]

Here is some text 2.

\setupinitial[hoffset=5mm]
\placeinitial
T{\tt hoffset=5mm}\input knuth

\setupinitial[hoffset=-5mm]
\placeinitial
T{\tt hoffset=-5mm}\input knuth


\setupinitial[voffset=5mm]
\placeinitial
T{\tt voffset=5mm}\input knuth

\setupinitial[voffset=-5mm]
\placeinitial
T{\tt voffset=-5mm}\input knuth

\stoptext

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: