SDF 2.001: SDF Guru Guide: Creating New Looks and Document Styles

Contents | Parent Topic | Previous Topic | Next Topic
Home | Catalog

# 1.7. Creating New Looks and Document Styles

## 1.7.1. Libraries and Modules

SDF implements looks and document styles as follows:

1. Each look is actually a library (within the look directory).
2. Each document style is actually a module (with an sds extension).

As a result, looks and document styles have all the flexibility and features of normal libraries and modules.

## 1.7.2. Creating a New Look

The easiest way to create a new look is to inherit details from an existing look. Typically, this involves 3 steps:

1. Creating a library directory and module.
2. Overriding the pages module.
3. Overriding tuning modules.

For example, the infomap look inherits most of its configuration details from the simple look.

## 1.7.3. Creating a library directory and module

Each library needs its own directory and a main module within it. The `look/infomap/infomap.sdm` file is simply:

    # To remove the header/footer borders, uncomment the line below
    #!default OPT_BORDERS 0

    # Inherit the simple look
    !inherit "look/simple"

## 1.7.4. Overriding the pages module

If the page layout is different, you will also need to override the pages.sdm module. For example, the `look/infomap/pages.sdm` file is:

    # Inherit what we can from the simple look
    !use "look/simple/pages"

    # Adjust the header/footer size and positioning
    !define PAGE_FIRST_FOOTER_HEIGHT  '0.50in'
    !define PAGE_FIRST_FOOTER_GAP     '0.25in'
    !define PAGE_RIGHT_HEADER_HEIGHT  '0.50in'
    !define PAGE_RIGHT_HEADER_GAP     '0.25in'
    !define PAGE_RIGHT_FOOTER_HEIGHT  '0.50in'
    !define PAGE_RIGHT_FOOTER_GAP     '0.25in'

    # Adjust the sidehead size
    !define OPT_SIDEHEAD_WIDTH "90pt"
    !define OPT_SIDEHEAD_GAP   "10pt"

## 1.7.5. Overriding tuning modules

Each look can define a tuning module for each target format which supports looks. As tuning modules are simple modules named with an sdn extension, new tuning modules can easily reuse the configuration details in an existing tuning module.

See the `look/infomap/mif.sdn` file for an example.

## 1.7.6. Creating a New Document Style

To create a new document style, simply create a module file of the required name with an sds extension in the appropriate look library directory.

For example, to create a new document style called article which is available in all looks, create a module file called article.sds in the look/simple directory.

See the `look/simple/*.sds` files in the SDF distribution for examples.