Blame docs/custom/style.xml

Packit Service 76cb02
Packit Service 76cb02
Packit Service 76cb02
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
Packit Service 76cb02
<section id="sec-style"><title>Output Formatting Style</title>
Packit Service 76cb02
<para>The output rendering done by <command>dblatex</command> can be widely
Packit Service 76cb02
customized like explained in <xref linkend="sec-custom"/>. By default several
Packit Service 76cb02
rendering styles are provided, that one can choose by using the option
Packit Service 76cb02
<option>-T</option> (see <xref linkend="eg-style"/>). The available styles are:</para>
Packit Service 76cb02
<variablelist>
Packit Service 76cb02
<varlistentry><term>native</term>
Packit Service 76cb02
<listitem>
Packit Service 76cb02
<para>The rendering uses the default LaTeX stylesheets. It is the style used by
Packit Service 76cb02
default if dblatex has been configured without using the option
Packit Service 76cb02
<option>--style</option>.</para>
Packit Service 76cb02
</listitem>
Packit Service 76cb02
</varlistentry>
Packit Service 76cb02
<varlistentry><term>simple</term>
Packit Service 76cb02
<listitem>
Packit Service 76cb02
<para>The rendering is very close to original latex rendering. The wrapper
Packit Service 76cb02
around the default latex packages is very thin.</para>
Packit Service 76cb02
</listitem>
Packit Service 76cb02
</varlistentry>
Packit Service 76cb02
<varlistentry><term>db2latex</term>
Packit Service 76cb02
<listitem>
Packit Service 76cb02
<para>The rendering tries to be as close as possible to the
Packit Service 76cb02
<ulink url="http://db2latex.sourceforge.net">DB2LaTeX</ulink> formatting.</para>
Packit Service 76cb02
</listitem>
Packit Service 76cb02
</varlistentry>
Packit Service 76cb02
</variablelist>
Packit Service 76cb02
<example id="eg-style"><title>Choosing the DB2LaTeX style</title>
Packit Service 76cb02
<programlisting>
Packit Service 76cb02
dblatex -T db2latex file.xml
Packit Service 76cb02
]]></programlisting>
Packit Service 76cb02
</example>
Packit Service 76cb02
<section><title>How it works</title>
Packit Service 76cb02
<para>The rendering style stuff is under the <filename>latex/</filename>
Packit Service 76cb02
directory. You can see the XSL stylesheets under <filename>xsl/</filename>
Packit Service 76cb02
as the way to produce latex with as little as possible docbook specific things
Packit Service 76cb02
(even if a large amount of latex packages are used to do the work). Then, it's
Packit Service 76cb02
up to LaTeX stylesheets to format the document as you wish.</para>
Packit Service 76cb02
<para>The organization under <filename>latex/</filename> is as follow:</para>
Packit Service 76cb02
<variablelist>
Packit Service 76cb02
<varlistentry><term><filename>contrib</filename></term>
Packit Service 76cb02
<listitem>
Packit Service 76cb02
<para>Contains the non-default available LaTeX stylesheets (simple and db2latex).
Packit Service 76cb02
</para>
Packit Service 76cb02
</listitem>
Packit Service 76cb02
</varlistentry>
Packit Service 76cb02
<varlistentry><term><filename>graphics</filename></term>
Packit Service 76cb02
<listitem>
Packit Service 76cb02
<para>Default graphics used in the admonitions (e.g. <sgmltag>warning</sgmltag>).
Packit Service 76cb02
These graphics are used by the default output formatting.
Packit Service 76cb02
</para>
Packit Service 76cb02
</listitem>
Packit Service 76cb02
</varlistentry>
Packit Service 76cb02
<varlistentry><term><filename>scripts</filename></term>
Packit Service 76cb02
<listitem>
Packit Service 76cb02
<para>Scripts used to compile with <command>latex</command> or
Packit Service 76cb02
<command>pdflatex</command>.
Packit Service 76cb02
</para>
Packit Service 76cb02
</listitem>
Packit Service 76cb02
</varlistentry>
Packit Service 76cb02
<varlistentry><term><filename>specs</filename></term>
Packit Service 76cb02
<listitem>
Packit Service 76cb02
<para>Contains all the configuration files describing the available styles.
Packit Service 76cb02
A specification file must have the extension .specs, .conf, or .xml to be
Packit Service 76cb02
detected as a style description, and its basename is the name of the style.
Packit Service 76cb02
For example the style db2latex is described by the configuration file
Packit Service 76cb02
<filename>db2latex.xml</filename>.
Packit Service 76cb02
</para>
Packit Service 76cb02
<para>When <command>dblatex</command> is executed with no parameter, the usage
Packit Service 76cb02
is displayed. In particular, the list of the available styles is given, like
Packit Service 76cb02
this:
Packit Service 76cb02
<programlisting>
Packit Service 76cb02
$ dblatex
Packit Service 76cb02
dblatex [options] file.{sgml|xml}
Packit Service 76cb02
Options:
Packit Service 76cb02
-t {pdf|ps|dvi|tex|xml}: output format
Packit Service 76cb02
...
Packit Service 76cb02
-T style               : available latex styles (db2latex, native, simple)
Packit Service 76cb02
]]></programlisting>
Packit Service 76cb02
The list is built by scanning the specs files found under
Packit Service 76cb02
<filename>specs/</filename>. The spec file syntax is described in 
Packit Service 76cb02
linkend="sec-specs"/>.
Packit Service 76cb02
</para>
Packit Service 76cb02
</listitem>
Packit Service 76cb02
</varlistentry>
Packit Service 76cb02
<varlistentry><term><filename>style</filename></term>
Packit Service 76cb02
<listitem>
Packit Service 76cb02
<para>Default LaTeX stylesheets.</para>
Packit Service 76cb02
</listitem>
Packit Service 76cb02
</varlistentry>
Packit Service 76cb02
</variablelist>
Packit Service 76cb02
</section>
Packit Service 76cb02
<section><title>Adding a New Formatting Style</title>
Packit Service 76cb02
<para>To add a new formatting style, do the following steps:</para>
Packit Service 76cb02
<procedure>
Packit Service 76cb02
<step><para>Let's create the style directories that will contain all the
Packit Service 76cb02
specific data. We choose to put them under the default
Packit Service 76cb02
<command>dblatex</command> user configuration directory.</para>
Packit Service 76cb02
<programlisting>
Packit Service 76cb02
$ mkdir -p $HOME/.dblatex/mystyle/latex
Packit Service 76cb02
$ mkdir -p $HOME/.dblatex/mystyle/xsl
Packit Service 76cb02
]]></programlisting>
Packit Service 76cb02
<para>Note that you could choose another configuration directory (see 
Packit Service 76cb02
linkend="sec-conf-path"/> for more details).</para>
Packit Service 76cb02
</step>
Packit Service 76cb02
<step><para>Create the latex stylesheets you need. It must define the expected
Packit Service 76cb02
DocBook interface and include some core definitions from the default latex
Packit Service 76cb02
stylesheets (cf. <xref linkend="sec-custom-latex"/>). Create also your XSL
Packit Service 76cb02
stylesheet if necessary.</para></step>
Packit Service 76cb02
<step><para>Put these files under the appropriate directories:</para>
Packit Service 76cb02
<programlisting>
Packit Service 76cb02
$ mv mytexstyle.sty $HOME/.dblatex/mystyle/latex/.
Packit Service 76cb02
$ mv param.xsl $HOME/.dblatex/mystyle/xsl/.
Packit Service 76cb02
]]></programlisting>
Packit Service 76cb02
</step>
Packit Service 76cb02
<step><para>Create a configuration file under the directory
Packit Service 76cb02
<filename>$HOME/.dblatex</filename>. The configuration file must point to the
Packit Service 76cb02
new latex stylesheet, and give the specific parameters. Example:</para>
Packit Service 76cb02
<programlisting>
Packit Service 76cb02
$ cat $HOME/.dblatex/mystyle.conf
Packit Service 76cb02
Packit Service 76cb02
Packit Service 76cb02
     Dblatex config file for my new style.
Packit Service 76cb02
     Note that the directories are relative to mystyle.conf
Packit Service 76cb02
     ======================================================= -->
Packit Service 76cb02
<config xmlns="http://dblatex.sourceforge.net/config">
Packit Service 76cb02
  <latex>
Packit Service 76cb02
    <texinputs>mystyle/latex//</texinputs>
Packit Service 76cb02
    <texstyle use="mytexstyle"/>
Packit Service 76cb02
  </latex>
Packit Service 76cb02
  <xslt>
Packit Service 76cb02
    <stylesheet fileref="mystyle/xsl/param.xsl"/>
Packit Service 76cb02
  </xslt>
Packit Service 76cb02
  <options>-f fig</options>
Packit Service 76cb02
</config>
Packit Service 76cb02
]]></programlisting>
Packit Service 76cb02
</step>
Packit Service 76cb02
<step><para>That's it. Try to compile your document with your style, and check
Packit Service 76cb02
the output. The configuration file basename is the name of the style to
Packit Service 76cb02
call.</para>
Packit Service 76cb02
<programlisting>
Packit Service 76cb02
$ dblatex -T mystyle file.xml
Packit Service 76cb02
]]></programlisting>
Packit Service 76cb02
</step>
Packit Service 76cb02
</procedure>
Packit Service 76cb02
Packit Service 76cb02
</section>
Packit Service 76cb02
</section>
Packit Service 76cb02