| Search Locate Previous Next | Contents |
To run a set of paragraphs in a particular style:
leaf.Style 'indent' © Set up indents leaf.Flow txt1 © First para leaf.Flow txt2 © Next para leaf.PopStyle © Back out
Note the use of leaf.PopStyle to back out the last call to leaf.Style; you can stack styles to any depth with these, but it is hard to see the value of going more than two deep!
This allows you to superimpose styles effectively, for example an indent might add indents (obviously), reduce the font size, and increase the keep value. By using PopStyle to back out you automatically reverse all the changes, so your normal body text style does not need to mention these properties explicitly.
Styles are matched ignoring case; you only need to give enough of the name to ensure an unambiguous choice.
Using in-line styles with Flow and Place
Often, you will want to set a style, output one paragraph, and then immediately reverse it ...
leaf.Style 'subhead' leaf.Place 'Introduction' leaf.PopStyle
A shortcut for these three lines is:
'subhead' leaf.Place 'Introduction'
... which uses the optional left argument to set the style, then immediately reverses it. Because NewLeaf can take vectors of text vectors at a single call, it is possible to set an entire block of numbered indents in a single call:
'ct' leaf.DefineStyle ('ind' 36)('bullet' '#.')
© ... later
'ct' leaf.Flow sections
To delete an unwanted style, just call leaf.DefineStyle with an empty right argument.