Text blocks/Environments/Verse
Verse
The usual way to set verse in ConTeXt is to enclose it in \startlines \stoplines, which ensures that each new line in the code produces a line break in the compiled output. Additionally, \startlines has some arguments that can be used to configure how the lines of text look, such as their indentation patterns. As usual in ConTeXt, these arguments can be separated and applied throughout the document with \setuplines (and optionally \definelines).
A simple example
For example, to set an excerpt from The Monks and the Giants by John Hookham Frere:
\startlines But chiefly, when the shadowy moon had shed O'er woods and waters her mysterious hue, Their passive hearts and vacant fancies fed With thoughts and aspirations strange and new, Till their brute souls with inward working bred Dark hints that in the depths of instinct grew Subjection not from Locke's associations, Nor David Hartley's doctrine of vibrations. \stoplines
produces
Indenting lines
The \startlines command has several useful options for configuring the overall look of the text that it applies to. To specify the indentation pattern, you can use the indenting
argument, which can take on values that you would use for \setupindenting. For example:
\startlines[indenting={yes, small, even}] But chiefly, when the shadowy moon had shed O'er woods and waters her mysterious hue, Their passive hearts and vacant fancies fed With thoughts and aspirations strange and new, Till their brute souls with inward working bred Dark hints that in the depths of instinct grew Subjection not from Locke's associations, Nor David Hartley's doctrine of vibrations. \stoplines
produces
The yes
turns the indenting on, the small
makes it a small amount, and the even
makes it only for even-numbered lines.
However, if you are planning to do this several times throughout your document, it is preferable to configure those options once globally with \setuplines. For example:
\setuplines[indenting={yes, small, even}] \startlines But chiefly, when the shadowy moon had shed O'er woods and waters her mysterious hue, Their passive hearts and vacant fancies fed With thoughts and aspirations strange and new, Till their brute souls with inward working bred Dark hints that in the depths of instinct grew Subjection not from Locke's associations, Nor David Hartley's doctrine of vibrations. \stoplines And then we can also typeset a nursery rhyme with the same formatting: \startlines Hey diddle diddle, the cat played the fiddle, The cow jumped over the moon. The little dog laughed to see such craft, And the dish ran away with the spoon. \stoplines
produces
That way, if you later decide to change the look of the verses in the document, you can do it globally with a single change.
If you have different indentation patterns that you would like to use for verse in your documents, it would be good to give each one a defined name to refer to with \definelines. Then you can still make global adjustments to a single look with a single change, without affecting all the other looks that you have defined. For example:
\definelines[ottavaRima][][indenting={yes, small, even}] \definelines[nurseryRhyme][][indenting={yes, big, even}] \startottavaRima But chiefly, when the shadowy moon had shed O'er woods and waters her mysterious hue, Their passive hearts and vacant fancies fed With thoughts and aspirations strange and new, Till their brute souls with inward working bred Dark hints that in the depths of instinct grew Subjection not from Locke's associations, Nor David Hartley's doctrine of vibrations. \stopottavaRima And now we can typeset a nursery rhyme with its own formatting: \startnurseryRhyme Hey diddle diddle, the cat played the fiddle, The cow jumped over the moon. The little dog laughed to see such craft, And the dish ran away with the spoon. \stopnurseryRhyme
produces
Note that \definelines has three sets of arguments: the first is the name that you are defining, the second is blank [ ], and the third is the one to use to specify the indenting. From the documentation, it is unclear what the second argument does, but omitting it entirely sometimes (but not always) causes problems.
The author of this entry is looking for a solution for the described problem. | (See: How to?) |
Preventing pagebreaks
The commands \startlines, \setuplines, and \startuplines have many other options to configure the look of verse.
For example, you can specify commands to be executed before and after the verse with the before
and after
arguments. One way that this can be used is to prevent pagebreaks by enclosing the verse in \startframedtext \stopframedtext, as in:
\startlines[before={\startframedtext[frame=off]}, after=\stopframedtext] But chiefly, when the shadowy moon had shed O'er woods and waters her mysterious hue, Their passive hearts and vacant fancies fed With thoughts and aspirations strange and new, Till their brute souls with inward working bred Dark hints that in the depths of instinct grew Subjection not from Locke's associations, Nor David Hartley's doctrine of vibrations. \stoplines
See the documentation for \setuplines for further details of what can be customized.