# Output Formatting Style

The output rendering done by `dblatex` can be widely customized like explained in . By default several rendering styles are provided, that one can choose by using the option `-T` (see ). The available styles are:

native

  The rendering uses the default LaTeX stylesheets. It is the style used by default if dblatex has been configured without using the option `--style`.

simple

  The rendering is very close to original latex rendering. The wrapper around the default latex packages is very thin.

db2latex

  The rendering tries to be as close as possible to the DB2LaTeX formatting.

Choosing the DB2LaTeX style

    dblatex -T db2latex file.xml

## How it works

The rendering style stuff is under the `latex/` directory. You can see the XSL stylesheets under `xsl/` as the way to produce latex with as little as possible docbook specific things (even if a large amount of latex packages are used to do the work). Then, it's up to LaTeX stylesheets to format the document as you wish.

The organization under `latex/` is as follow:

`contrib`

  Contains the non-default available LaTeX stylesheets (simple and db2latex).

`graphics`

  Default graphics used in the admonitions (e.g. warning). These graphics are used by the default output formatting.

`scripts`

  Scripts used to compile with `latex` or `pdflatex`.

`specs`

  Contains all the specification files describing the available styles. A specification file must have the extension .specs to be detected as a style description, and its basename is the name of the style. For example the style db2latex is described by the specification file `db2latex.specs`.

  When `dblatex` is executed with no parameter, the usage is displayed. In particular, the list of the available styles is given, like this:

      $ dblatex
      dblatex [options] file.{sgml|xml}
      Options:
      -t {pdf|ps|dvi|tex|xml}: output format
      ...
      -T style               : available latex styles (db2latex, native, simple)

  The list is built by scanning the specs files found under `specs/`. The spec file syntax is described in .
`style`

  Default LaTeX stylesheets.

## Adding a New Formatting Style

To add a new formatting style, do the following steps:

- Let's create the style directores that will contain all the specific data. We choose to put them under the default `dblatex` user configuration directory.

      $ mkdir -p $HOME/.dblatex/mystyle/latex
      $ mkdir -p $HOME/.dblatex/mystyle/xsl

  Note that you could choose another configuration directory (see for more details).

- Create the latex stylesheets you need. It must define the expected DocBook interface and include some core definitions from the default latex stylesheets (cf. ). Create also your XSL stylesheet if necessary.

- Put these files under the appropriate directories:

      $ mv mytexstyle.sty $HOME/.dblatex/mystyle/latex/.
      $ mv param.xsl $HOME/.dblatex/mystyle/xsl/.

- Create a configuration file under the directory `$HOME/.dblatex`. The specification file must point to the new latex stylesheet, and give the specific parameters. Example:

      $ cat $HOME/.dblatex/mystyle.conf
      #
      # Dblatex config file for my new style.
      # Note that the directories are relative to mystyle.conf
      #
      TexInputs: mystyle/latex//
      TexStyle:  mytexstyle
      XslParam:  mystyle/param.xsl
      Options:   -f fig

- That's it. Try to compile your document with your style, and check the output.

      $ dblatex -T mystyle file.xml