Search Locate Previous Next Contents

nlStyle – set paragraph style

To run a set of paragraphs in a particular style:

nlStyle 'indent' © Set up indents
nlFlow txt1      © First para
nlFlow txt2      © Next para
nlPopStyle       © Back out

Note the use of nlPopStyle to back out the last call to nlStyle; 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 ...

nlStyle 'subhead'
nlPlace 'Introduction'
nlPopStyle

A shortcut for these three lines is:

'subhead' nlPlace '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' nlDefineStyle ('ind' 36)('bullet' '#.')
© ... later
'ct' nlFlow ‘sections

To delete an unwanted style, just call nlDefineStyle with an empty right argument.



Continue to: nlSubst – parameter substitution
© Copyright Causeway Graphical Systems Ltd 2001