Changes

Jump to navigation Jump to search
3,072 bytes added ,  18:14, 20 October 2020
Filled in some details and put more examples in.
= Verse =
 
The usual way to set verse in ConTeXt is to enclose it in {{cmd|startlines}} {{cmd|stoplines}}, which ensures that each new line in the code produces a line break in the compiled output. Additionally, {{cmd|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 {{cmd|setuplines}} (and optionally {{cmd|definelines}}).
== A simple example ==
For example, to set an excerpt from ''The Monks and the Giants'' by John Hookham Frere:<texcodecontext source="yes" text="produces">
\startlines
But chiefly, when the shadowy moon had shed
Nor David Hartley's doctrine of vibrations.
\stoplines
</texcodecontext== Indenting lines ==The {{cmd|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 {{code|indenting}} argument, which can take on values that you would use for {{cmd|setupindenting}}. For example:
<contextsource="yes" text="produces">\startlines[indenting={yes, small, even}]
But chiefly, when the shadowy moon had shed
O'er woods and waters her mysterious hue,
</context>
== Indenting lines == You could give the output in The {{code|yes}} turns the lines environment a special look with indenting of odd or even lines. You could do this with on, the <{{code>indenting</code> key for <code>\setuplines</code>|small}} makes it a small amount, and the arguments are the same as you could use {{code|even}} makes it only for <code>\setupindenting</code>even-numbered lines.
<texcode>\setuplines[indenting={yesHowever,mediumif you are planning to do this several times throughout your document,oddit is preferable to configure those options once globally with {{cmd|setuplines}}]</texcode>. For example:
<contextsource="yes" text="produces">\setuplines[indenting={yes,mediumsmall,oddeven}]
\startlines
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
</context>
<texcode>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.\setuplines[indenting=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 {{yescmd|definelines}}. Then you can still make global adjustments to a single look with a single change,medium,even}]</texcode>without affecting all the other looks that you have defined. For example:
<contextsource="yes" text="produces">\setuplinesdefinelines[ottavaRima][][indenting={yes, small, even}]\definelines[nurseryRhyme][][indenting={yes,mediumbig,even}]
\startlinesstartottavaRima
But chiefly, when the shadowy moon had shed
O'er woods and waters her mysterious hue,
Subjection not from Locke's associations,
Nor David Hartley's doctrine of vibrations.
\stoplinesstopottavaRima And now we can typeset a nursery rhyme with its own formatting: \startnurseryRhymeHey 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
</context>
== Preventing pagebreaks ==Note that {{cmd|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.{{howto}}
Text in the lines environment is normally split at the end of the page, to prevent this you could enclose the block with a framedtext.
== Preventing pagebreaks ==
The commands {{cmd|startlines}}, {{cmd|setuplines}}, and {{cmd|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 {{code|before}} and {{code|after}} arguments. One way that this can be used is to prevent pagebreaks by enclosing the verse in {{cmd|startframedtext}} {{cmd|stopframedtext}}, as in:
<texcode>
\setuplines startlines[before={\startframedtext[frame=off]}, after=\stopframedtext]But chiefly, when the shadowy moon had shedO'er woods and waters her mysterious hue,Their passive hearts and vacant fancies fedWith thoughts and aspirations strange and new,Till their brute souls with inward working bredDark hints that in the depths of instinct grewSubjection not from Locke's associations,Nor David Hartley's doctrine of vibrations.\stoplines
</texcode>
 
See the documentation for {{cmd|setuplines}} for further details of what can be customized.
 
[[Category:Basics]]
53

edits

Navigation menu