Changes

Jump to navigation Jump to search
3,125 bytes added ,  10:22, 23 August 2013
Hans added this yesterday
{{Reference
|name=definefirstline
|attributes=
}}

== [[Help:Reference|Syntax]] ==
<table cellspacing="4" cellpadding="2" class="cmd">
<tr>
<td colspan="2" class="cmd">\definefirstline<span class="first">[..]</span><span class="third">[]</span></td>
<tr>
<td colspan="2" class="cmd">\definefirstline<span class="first">[...]</span><span class="second">[...]</span><span class="third">[...=...]</span></td>
</tr>
<tr valign="top" class="first">
<td class="cmd">[...]</td>
<td>''name of firstline style''</td>
</tr>
<tr valign="top" class="second">
<td class="cmd">[...]</td>
<td>''name of firstline style to inherit from''</td>
</tr>
<tr valign="top" class="third">
<td class="cmd">alternative</td>
<td><code>line</code> <code>word</code></td>
</tr>
<tr valign="top" class="third">
<td class="cmd">[[Command/keyword:n|n]]</td>
<td><code>integer</code>: number of words to affect</td>
</tr>
<tr valign="top" class="third">
<td class="cmd">[[Command/keyword:style|style]]</td>
<td>[[Style Alternatives|Style Alternative]]</td>
</tr>
<tr valign="top" class="third">
<td class="cmd">[[Command/keyword:color|color]]</td>
<td>[[Colors|IDENTIFIER]]: color name</td>
</tr>
</table>

== Description ==
Define a style to apply only to the first line of a paragraph.
Once defined, the style can be applied by invoking
{{cmd|setfirstlinestyle}} on a paragraph.
One of two methods can be requested by setting the keyword
<code>alternative</code>:

* ''line'' applies the style to the entire line,
* ''word'' applies the style only to the first <code>n</code> words of the first line.

''NB'':
The style substitution takes place on node level, hence small capitals
require a font which implements them as a feature, not as a separate
file
(e. g. as of 2013
[[Wishes_for_Latin_Modern#General_things|Latin Modern won’t do]]).

== Example ==

Typeset the first line once in bold, and then in small caps:

<context mode=mkiv source=yes>
\setupbodyfont [heros] %% important: smallcaps capable font!

\definefirstline [italicfirstline] [
alternative=line,
style=italic,
]

\definefirstline [smallcapsfirstline] [
alternative=line,
color=darkred,
style=smallcaps,
]

\starttext

\setfirstline[italicfirstline] \input knuth \par
\setfirstline[smallcapsfirstline] \input knuth \par

\stoptext
</context>

To affect only the first three or six words change to the alternative
''word'' and set the parameter <code>n</code> to the desired value:

<context mode=mkiv source=yes>
\definefirstline [threegreenwords] [
alternative=word,
color=green,
n=3,
]

\definefirstline [sixbluewords] [
alternative=word,
color=blue,
n=6,
]

\starttext

\setfirstline[threegreenwords] \input ward \par
\setfirstline[sixbluewords] \input ward \par

\stoptext
</context>

== See also ==
* {{cmd|setfirstline}}
* [[Style Alternatives]]
* Source code: {{src|typo-fln.mkiv}} (with examples) {{src|typo-fln.lua}}.

== Help from ConTeXt-Mailinglist/Forum ==
All issues with:
{{Forum|definefirstline}}

[[Category:Command/Fonts|definefirstline]]
188

edits

Navigation menu