|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
|
Packit |
0f19cf |
<section id="sec-index" xmlns:xi="http://www.w3.org/2001/XInclude">
|
|
Packit |
0f19cf |
<title>Creating an Index</title>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
<para>
|
|
Packit |
0f19cf |
An index is automatically generated if some index entries (<sgmltag>indexterm</sgmltag>), telling the terms to put in the index, are written in the document. The <sgmltag>keyword</sgmltag> elements are not printed but are also added to the index.
|
|
Packit |
0f19cf |
</para>
|
|
Packit |
0f19cf |
<example><title>Index Entry</title>
|
|
Packit |
0f19cf |
<programlisting language="XML">
|
|
Packit |
0f19cf |
In this paragraph is described the function
|
|
Packit |
0f19cf |
<function>strcpy</function><indexterm><primary>strcpy</primary></indexterm>.
|
|
Packit |
0f19cf |
</para>
|
|
Packit |
0f19cf |
]]> </programlisting>
|
|
Packit |
0f19cf |
</example>
|
|
Packit |
0f19cf |
<para>
|
|
Packit |
0f19cf |
The index is put at the end of the document. It is not possible to put it somewhere else.
|
|
Packit |
0f19cf |
</para>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
<section id="sec-index-locale"><title>Internationalized Indexes</title>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
<section id="sec-index-tools"><title>Indexing Tools</title>
|
|
Packit |
0f19cf |
<para><command>Makeindex</command> is used by default to build the index. It works fine for latin charset but it is not
|
|
Packit |
0f19cf |
suited for other charsets and UTF-8 encoding. Moreover its sorting rule is
|
|
Packit |
0f19cf |
not suited for many languages.</para>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
<para>Therefore dblatex gives the possibility to use
|
|
Packit |
0f19cf |
<command>xindy</command> that allows internationalized indexing. When xindy
|
|
Packit |
0f19cf |
is used, the sorting language used is deduced from the Docbook document lang.
|
|
Packit |
0f19cf |
If the document lang has no correspondance for xindy, or if you want to force
|
|
Packit |
0f19cf |
the use of a specific sorting language, you can specify the sorting language
|
|
Packit |
0f19cf |
to use. With Xindy you can
|
|
Packit |
0f19cf |
also provide your own sort rules, but see the official Xindy documentation
|
|
Packit |
0f19cf |
for more details.</para>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
<para>A parameter is provided to use xindy instead of makeindex:
|
|
Packit |
0f19cf |
<itemizedlist>
|
|
Packit |
0f19cf |
<listitem><para><parameter>latex.index.tool</parameter>=xindy tells dblatex
|
|
Packit |
0f19cf |
to use xindy instead of makeindex (default).</para>
|
|
Packit |
0f19cf |
</listitem>
|
|
Packit |
0f19cf |
</itemizedlist>
|
|
Packit |
0f19cf |
</para>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
<para>A typical use is then:
|
|
Packit |
0f19cf |
<screen>
|
|
Packit |
0f19cf |
dblatex -P latex.index.tool=xindy file.xml
|
|
Packit |
0f19cf |
</screen>
|
|
Packit |
0f19cf |
</para>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
</section>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
<section><title>Index Sorting</title>
|
|
Packit |
0f19cf |
<para><command>Makeindex</command> has very few methods to change its
|
|
Packit |
0f19cf |
index sorting rules, except the <option>-g</option> and <option>-L</option> options which are not very hepfull in a DocBook context. On the contrary <command>xindy</command> can sort the index according to
|
|
Packit |
0f19cf |
a specific language.</para>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
<para>When xindy is used as index tool, <command>dblatex</command> passes to
|
|
Packit |
0f19cf |
xindy through the xindy <option>-L</option> option
|
|
Packit |
0f19cf |
the language name corresponding to the <literal>lang</literal> attribute of the
|
|
Packit |
0f19cf |
document. If the document has no language or if <command>xindy</command>
|
|
Packit |
0f19cf |
does not support the document language, the default sorting is applied. In this
|
|
Packit |
0f19cf |
case you can use the following parameter:
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
<itemizedlist>
|
|
Packit |
0f19cf |
<listitem><para><parameter>latex.index.language</parameter> specifies the
|
|
Packit |
0f19cf |
language used to sort the indexes. Currently this parameter is relevant
|
|
Packit |
0f19cf |
only for xindy. The language set must be known by xindy (see the xindy
|
|
Packit |
0f19cf |
documentation). When not set (or empty) the sorting language to apply
|
|
Packit |
0f19cf |
is deduced from the document lang.</para>
|
|
Packit |
0f19cf |
</listitem>
|
|
Packit |
0f19cf |
</itemizedlist>
|
|
Packit |
0f19cf |
</para>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
<para>The parameter can be used like any other like this:
|
|
Packit |
0f19cf |
<screen>
|
|
Packit |
0f19cf |
dblatex -P latex.index.language=german-din file.xml
|
|
Packit |
0f19cf |
</screen>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
But it can also be used through an XSL configuration file to provide new mapping
|
|
Packit |
0f19cf |
rules between ISO lang codes and known xindy languages, or override the current
|
|
Packit |
0f19cf |
mapping done by dblatex as shown in <xref linkend="xsl-index-lang"/>.
|
|
Packit |
0f19cf |
</para>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
<example id="xsl-index-lang"><title>XSL Index Language Setup</title>
|
|
Packit |
0f19cf |
<para>By default dblatex maps the <literal>de</literal> lang
|
|
Packit |
0f19cf |
code to the language named <literal>german-din</literal>, and has no
|
|
Packit |
0f19cf |
correspondance to map <literal>cy</literal> (Welsh) or <literal>eu</literal>
|
|
Packit |
0f19cf |
(Basque). The following setup provides a mapping for these cases:
|
|
Packit |
0f19cf |
</para>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
<programlisting language="XML">
|
|
Packit |
0f19cf |
xindy</xsl:param>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
<xsl:param name="latex.index.language">
|
|
Packit |
0f19cf |
<xsl:variable name="lang">
|
|
Packit |
0f19cf |
<xsl:call-template name="l10n.language">
|
|
Packit |
0f19cf |
<xsl:with-param name="target" select="(/set|/book|/article)[1]"/>
|
|
Packit |
0f19cf |
<xsl:with-param name="xref-context" select="true()"/>
|
|
Packit |
0f19cf |
</xsl:call-template>
|
|
Packit |
0f19cf |
</xsl:variable>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
<xsl:choose>
|
|
Packit |
0f19cf |
<xsl:when test="$lang='de'">german-duden</xsl:when>
|
|
Packit |
0f19cf |
<xsl:when test="$lang='cy'">english</xsl:when>
|
|
Packit |
0f19cf |
<xsl:when test="$lang='eu'">french</xsl:when>
|
|
Packit |
0f19cf |
</xsl:choose>
|
|
Packit |
0f19cf |
</xsl:param>
|
|
Packit |
0f19cf |
]]> </programlisting>
|
|
Packit |
0f19cf |
</example>
|
|
Packit |
0f19cf |
|
|
Packit |
0f19cf |
</section>
|
|
Packit |
0f19cf |
</section>
|
|
Packit |
0f19cf |
</section>
|