6.6. Custom Formatting


6.6.1. Overview

One of the nice things about SDF is that system administrators can control the formatting of documents via templates. This has two major advantages:

  1. document authors can focus on content
  2. by default, documents have a consistent format.

However, there are occasions when authors need to override the default formatting conventions. Custom formatting is supported for documents, paragraphs and phrases.


6.6.2. Custom Document Formatting

Document formatting can be controlled by setting variables. The commonly used ones are given below.

Name Type Purpose
DOC_TOC integer table of contents level
DOC_LOF boolean build a list of figures
DOC_LOT boolean build a list of tables
DOC_IX boolean build an index
DOC_TWO_SIDES boolean build a two-sided document

For example, to create a two-sided document, add this line to your document:

  !define DOC_TWO_SIDES

6.6.3. Custom Paragraph Formatting

Paragraph formatting can be controlled by setting attributes. The commonly used ones are given below.

Name Purpose
label prefix label (e.g. Note:)
top either Page (the default), Column, LPage or RPage
left left margin indent (in points)
first first line indent (in points)
right right margin indent (in points)
justify either Full, Left, Right or Center

For example, to start a paragraph at the top of a page:

 H3[top] Other Issues

To indent a paragraph 1 inch from both margins:

 [left='1in'; right='1in'] This paragraph will be indented from
 both margins by 1 inch.

The result is:

This paragraph will be indented from both margins by 1 inch.


6.6.4. Custom Phrase Formatting

Phrase formatting can be controlled by setting attributes. The commonly used ones are given below.

Name Purpose
family font family
size font size
color text colour
bold enable bold
italics enable italics
underline enable underline
changed enable change bars

For example, to change the size of a phrase to 11.5 points:

  I love {{N[size=11.5]custom formatting}}.

The result is:

I love custom formatting.


6.6.5. Applying Phrase Attributes to Paragraphs

Phrase attributes can also be used for paragraphs. For example, to add a change bar to a paragraph:

  [changed] This paragraph has a change bar.

The result is:

This paragraph has a change bar.


6.6.6. sdf Blocks

Attributes can be applied to a block of text by using the sdf filter. For example:

!block sdf; size='8pt'; bold; align='Center'
This paragraph has custom formatting:

* and so does this.
!endblock

The result is:

This paragraph has custom formatting: