| 1 |
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Creating an Index</title><link rel="stylesheet" type="text/css" href="manual.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="home" href="index.html" title="DocBook to LaTeX Publishing" /><link rel="up" href="ch03.html" title="Chapter 3. Using dblatex" /><link rel="prev" href="sec-verbatim.html" title="Extending the Verbatim Rendering" /><link rel="next" href="ch03s14.html" title="Writing a Bibliography" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Creating an Index</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-verbatim.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using dblatex</th><td width="20%" align="right"> <a accesskey="n" href="ch03s14.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="sec-index"></a>Creating an Index</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="sec-index.html#sec-index-locale">Internationalized Indexes</a></span></dt></dl></div><p> |
| 3 |
An index is automatically generated if some index entries (<code class="sgmltag-element">indexterm</code>), telling the terms to put in the index, are written in the document. The <code class="sgmltag-element">keyword</code> elements are not printed but are also added to the index. |
| 4 |
</p><div class="example"><a id="idp1731"></a><p class="title"><strong>Example 3.13. Index Entry</strong></p><div class="example-contents"><pre class="programlisting"> |
| 5 |
<para>In this paragraph is described the function |
| 6 |
<function>strcpy</function><indexterm><primary>strcpy</primary></indexterm>. |
| 7 |
</para> |
| 8 |
</pre></div></div><br class="example-break" /><p> |
| 9 |
The index is put at the end of the document. It is not possible to put it somewhere else. |
| 10 |
</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sec-index-locale"></a>Internationalized Indexes</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="sec-index.html#sec-index-tools">Indexing Tools</a></span></dt><dt><span class="section"><a href="sec-index.html#idp1750">Index Sorting</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="sec-index-tools"></a>Indexing Tools</h4></div></div></div><p><span class="command"><strong>Makeindex</strong></span> is used by default to build the index. It works fine for latin charset but it is not |
| 11 |
suited for other charsets and UTF-8 encoding. Moreover its sorting rule is |
| 12 |
not suited for many languages.</p><p>Therefore dblatex gives the possibility to use |
| 13 |
<span class="command"><strong>xindy</strong></span> that allows internationalized indexing. When xindy |
| 14 |
is used, the sorting language used is deduced from the Docbook document lang. |
| 15 |
If the document lang has no correspondance for xindy, or if you want to force |
| 16 |
the use of a specific sorting language, you can specify the sorting language |
| 17 |
to use. With Xindy you can |
| 18 |
also provide your own sort rules, but see the official Xindy documentation |
| 19 |
for more details.</p><p>A parameter is provided to use xindy instead of makeindex: |
| 20 |
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><em class="parameter"><code>latex.index.tool</code></em>=xindy tells dblatex |
| 21 |
to use xindy instead of makeindex (default).</p></li></ul></div><p> |
| 22 |
</p><p>A typical use is then: |
| 23 |
</p><pre class="screen"> |
| 24 |
dblatex -P latex.index.tool=xindy file.xml |
| 25 |
</pre><p> |
| 26 |
</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="idp1750"></a>Index Sorting</h4></div></div></div><p><span class="command"><strong>Makeindex</strong></span> has very few methods to change its |
| 27 |
index sorting rules, except the <code class="option">-g</code> and <code class="option">-L</code> options which are not very hepfull in a DocBook context. On the contrary <span class="command"><strong>xindy</strong></span> can sort the index according to |
| 28 |
a specific language.</p><p>When xindy is used as index tool, <span class="command"><strong>dblatex</strong></span> passes to |
| 29 |
xindy through the xindy <code class="option">-L</code> option |
| 30 |
the language name corresponding to the <code class="literal">lang</code> attribute of the |
| 31 |
document. If the document has no language or if <span class="command"><strong>xindy</strong></span> |
| 32 |
does not support the document language, the default sorting is applied. In this |
| 33 |
case you can use the following parameter: |
| 34 |
|
| 35 |
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><em class="parameter"><code>latex.index.language</code></em> specifies the |
| 36 |
language used to sort the indexes. Currently this parameter is relevant |
| 37 |
only for xindy. The language set must be known by xindy (see the xindy |
| 38 |
documentation). When not set (or empty) the sorting language to apply |
| 39 |
is deduced from the document lang.</p></li></ul></div><p> |
| 40 |
</p><p>The parameter can be used like any other like this: |
| 41 |
</p><pre class="screen"> |
| 42 |
dblatex -P latex.index.language=german-din file.xml |
| 43 |
</pre><p> |
| 44 |
|
| 45 |
But it can also be used through an XSL configuration file to provide new mapping |
| 46 |
rules between ISO lang codes and known xindy languages, or override the current |
| 47 |
mapping done by dblatex as shown in <a class="xref" href="sec-index.html#xsl-index-lang" title="Example 3.14. XSL Index Language Setup">Example 3.14, “XSL Index Language Setup”</a>. |
| 48 |
</p><div class="example"><a id="xsl-index-lang"></a><p class="title"><strong>Example 3.14. XSL Index Language Setup</strong></p><div class="example-contents"><p>By default dblatex maps the <code class="literal">de</code> lang |
| 49 |
code to the language named <code class="literal">german-din</code>, and has no |
| 50 |
correspondance to map <code class="literal">cy</code> (Welsh) or <code class="literal">eu</code> |
| 51 |
(Basque). The following setup provides a mapping for these cases: |
| 52 |
</p><pre class="programlisting"> |
| 53 |
<xsl:param name="latex.index.tool">xindy</xsl:param> |
| 54 |
|
| 55 |
<xsl:param name="latex.index.language"> |
| 56 |
<xsl:variable name="lang"> |
| 57 |
<xsl:call-template name="l10n.language"> |
| 58 |
<xsl:with-param name="target" select="(/set|/book|/article)[1]"/> |
| 59 |
<xsl:with-param name="xref-context" select="true()"/> |
| 60 |
</xsl:call-template> |
| 61 |
</xsl:variable> |
| 62 |
|
| 63 |
<!-- Define Xindy lang to use in specific cases --> |
| 64 |
<xsl:choose> |
| 65 |
<xsl:when test="$lang='de'">german-duden</xsl:when> |
| 66 |
<xsl:when test="$lang='cy'">english</xsl:when> |
| 67 |
<xsl:when test="$lang='eu'">french</xsl:when> |
| 68 |
</xsl:choose> |
| 69 |
</xsl:param> |
| 70 |
</pre></div></div><br class="example-break" /></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-verbatim.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s14.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Extending the Verbatim Rendering </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Writing a Bibliography</td></tr></table></div></body></html> |