| 1 |
<?xml version="1.0" encoding="iso-8859-1"?> |
| 2 |
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"> |
| 4 |
<section id="sec-style"><title>Output Formatting Style</title> |
| 5 |
<para>The output rendering done by <command>dblatex</command> can be widely |
| 6 |
customized like explained in <xref linkend="sec-custom"/>. By default several |
| 7 |
rendering styles are provided, that one can choose by using the option |
| 8 |
<option>-T</option> (see <xref linkend="eg-style"/>). The available styles are:</para> |
| 9 |
<variablelist> |
| 10 |
<varlistentry><term>native</term> |
| 11 |
<listitem> |
| 12 |
<para>The rendering uses the default LaTeX stylesheets. It is the style used by |
| 13 |
default if dblatex has been configured without using the option |
| 14 |
<option>--style</option>.</para> |
| 15 |
</listitem> |
| 16 |
</varlistentry> |
| 17 |
<varlistentry><term>simple</term> |
| 18 |
<listitem> |
| 19 |
<para>The rendering is very close to original latex rendering. The wrapper |
| 20 |
around the default latex packages is very thin.</para> |
| 21 |
</listitem> |
| 22 |
</varlistentry> |
| 23 |
<varlistentry><term>db2latex</term> |
| 24 |
<listitem> |
| 25 |
<para>The rendering tries to be as close as possible to the |
| 26 |
<ulink url="http://db2latex.sourceforge.net">DB2LaTeX</ulink> formatting.</para> |
| 27 |
</listitem> |
| 28 |
</varlistentry> |
| 29 |
</variablelist> |
| 30 |
<example id="eg-style"><title>Choosing the DB2LaTeX style</title> |
| 31 |
<programlisting><![CDATA[ |
| 32 |
dblatex -T db2latex file.xml |
| 33 |
]]></programlisting> |
| 34 |
</example> |
| 35 |
<section><title>How it works</title> |
| 36 |
<para>The rendering style stuff is under the <filename>latex/</filename> |
| 37 |
directory. You can see the XSL stylesheets under <filename>xsl/</filename> |
| 38 |
as the way to produce latex with as little as possible docbook specific things |
| 39 |
(even if a large amount of latex packages are used to do the work). Then, it's |
| 40 |
up to LaTeX stylesheets to format the document as you wish.</para> |
| 41 |
<para>The organization under <filename>latex/</filename> is as follow:</para> |
| 42 |
<variablelist> |
| 43 |
<varlistentry><term><filename>contrib</filename></term> |
| 44 |
<listitem> |
| 45 |
<para>Contains the non-default available LaTeX stylesheets (simple and db2latex). |
| 46 |
</para> |
| 47 |
</listitem> |
| 48 |
</varlistentry> |
| 49 |
<varlistentry><term><filename>graphics</filename></term> |
| 50 |
<listitem> |
| 51 |
<para>Default graphics used in the admonitions (e.g. <sgmltag>warning</sgmltag>). |
| 52 |
These graphics are used by the default output formatting. |
| 53 |
</para> |
| 54 |
</listitem> |
| 55 |
</varlistentry> |
| 56 |
<varlistentry><term><filename>scripts</filename></term> |
| 57 |
<listitem> |
| 58 |
<para>Scripts used to compile with <command>latex</command> or |
| 59 |
<command>pdflatex</command>. |
| 60 |
</para> |
| 61 |
</listitem> |
| 62 |
</varlistentry> |
| 63 |
<varlistentry><term><filename>specs</filename></term> |
| 64 |
<listitem> |
| 65 |
<para>Contains all the configuration files describing the available styles. |
| 66 |
A specification file must have the extension .specs, .conf, or .xml to be |
| 67 |
detected as a style description, and its basename is the name of the style. |
| 68 |
For example the style db2latex is described by the configuration file |
| 69 |
<filename>db2latex.xml</filename>. |
| 70 |
</para> |
| 71 |
<para>When <command>dblatex</command> is executed with no parameter, the usage |
| 72 |
is displayed. In particular, the list of the available styles is given, like |
| 73 |
this: |
| 74 |
<programlisting><![CDATA[ |
| 75 |
$ dblatex |
| 76 |
dblatex [options] file.{sgml|xml} |
| 77 |
Options: |
| 78 |
-t {pdf|ps|dvi|tex|xml}: output format |
| 79 |
... |
| 80 |
-T style : available latex styles (db2latex, native, simple) |
| 81 |
]]></programlisting> |
| 82 |
The list is built by scanning the specs files found under |
| 83 |
<filename>specs/</filename>. The spec file syntax is described in <xref |
| 84 |
linkend="sec-specs"/>. |
| 85 |
</para> |
| 86 |
</listitem> |
| 87 |
</varlistentry> |
| 88 |
<varlistentry><term><filename>style</filename></term> |
| 89 |
<listitem> |
| 90 |
<para>Default LaTeX stylesheets.</para> |
| 91 |
</listitem> |
| 92 |
</varlistentry> |
| 93 |
</variablelist> |
| 94 |
</section> |
| 95 |
<section><title>Adding a New Formatting Style</title> |
| 96 |
<para>To add a new formatting style, do the following steps:</para> |
| 97 |
<procedure> |
| 98 |
<step><para>Let's create the style directories that will contain all the |
| 99 |
specific data. We choose to put them under the default |
| 100 |
<command>dblatex</command> user configuration directory.</para> |
| 101 |
<programlisting><![CDATA[ |
| 102 |
$ mkdir -p $HOME/.dblatex/mystyle/latex |
| 103 |
$ mkdir -p $HOME/.dblatex/mystyle/xsl |
| 104 |
]]></programlisting> |
| 105 |
<para>Note that you could choose another configuration directory (see <xref |
| 106 |
linkend="sec-conf-path"/> for more details).</para> |
| 107 |
</step> |
| 108 |
<step><para>Create the latex stylesheets you need. It must define the expected |
| 109 |
DocBook interface and include some core definitions from the default latex |
| 110 |
stylesheets (cf. <xref linkend="sec-custom-latex"/>). Create also your XSL |
| 111 |
stylesheet if necessary.</para></step> |
| 112 |
<step><para>Put these files under the appropriate directories:</para> |
| 113 |
<programlisting><![CDATA[ |
| 114 |
$ mv mytexstyle.sty $HOME/.dblatex/mystyle/latex/. |
| 115 |
$ mv param.xsl $HOME/.dblatex/mystyle/xsl/. |
| 116 |
]]></programlisting> |
| 117 |
</step> |
| 118 |
<step><para>Create a configuration file under the directory |
| 119 |
<filename>$HOME/.dblatex</filename>. The configuration file must point to the |
| 120 |
new latex stylesheet, and give the specific parameters. Example:</para> |
| 121 |
<programlisting><![CDATA[ |
| 122 |
$ cat $HOME/.dblatex/mystyle.conf |
| 123 |
<?xml version="1.0" encoding="utf-8"?> |
| 124 |
<!-- ======================================================= |
| 125 |
Dblatex config file for my new style. |
| 126 |
Note that the directories are relative to mystyle.conf |
| 127 |
======================================================= --> |
| 128 |
<config xmlns="http://dblatex.sourceforge.net/config"> |
| 129 |
<latex> |
| 130 |
<texinputs>mystyle/latex//</texinputs> |
| 131 |
<texstyle use="mytexstyle"/> |
| 132 |
</latex> |
| 133 |
<xslt> |
| 134 |
<stylesheet fileref="mystyle/xsl/param.xsl"/> |
| 135 |
</xslt> |
| 136 |
<options>-f fig</options> |
| 137 |
</config> |
| 138 |
]]></programlisting> |
| 139 |
</step> |
| 140 |
<step><para>That's it. Try to compile your document with your style, and check |
| 141 |
the output. The configuration file basename is the name of the style to |
| 142 |
call.</para> |
| 143 |
<programlisting><![CDATA[ |
| 144 |
$ dblatex -T mystyle file.xml |
| 145 |
]]></programlisting> |
| 146 |
</step> |
| 147 |
</procedure> |
| 148 |
|
| 149 |
</section> |
| 150 |
</section> |
| 151 |
|