Blame docs/xhtml/manual/sec-index.html

Packit Service 76cb02
Packit Service 76cb02
Packit Service 76cb02
<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.76.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>

Creating an Index

Packit Service 76cb02
   An index is automatically generated if some index entries (indexterm), telling the terms to put in the index, are written in the document. The keyword elements are not printed but are also added to the index.
Packit Service 76cb02
  

Example 3.13. Index Entry

Packit Service 76cb02
<para>In this paragraph is described the function 
Packit Service 76cb02
<function>strcpy</function><indexterm><primary>strcpy</primary></indexterm>.
Packit Service 76cb02
</para>
Packit Service 76cb02
  

Packit Service 76cb02
   The index is put at the end of the document. It is not possible to put it somewhere else.
Packit Service 76cb02
  

Internationalized Indexes

Indexing Tools

Makeindex is used by default to build the index. It works fine for latin charset but it is not

Packit Service 76cb02
suited for other charsets and UTF-8 encoding. Moreover its sorting rule is
Packit Service 76cb02
not suited for many languages.

Therefore dblatex gives the possibility to use

Packit Service 76cb02
xindy that allows internationalized indexing. When xindy
Packit Service 76cb02
is used, the sorting language used is deduced from the Docbook document lang.
Packit Service 76cb02
If the document lang has no correspondance for xindy, or if you want to force
Packit Service 76cb02
the use of a specific sorting language, you can specify the sorting language
Packit Service 76cb02
to use. With Xindy you can
Packit Service 76cb02
also provide your own sort rules, but see the official Xindy documentation
Packit Service 76cb02
for more details.

A parameter is provided to use xindy instead of makeindex:

Packit Service 76cb02

  • latex.index.tool=xindy tells dblatex

Packit Service 76cb02
to use xindy instead of makeindex (default).

Packit Service 76cb02

A typical use is then:

Packit Service 76cb02

Packit Service 76cb02
dblatex -P latex.index.tool=xindy file.xml
Packit Service 76cb02

Packit Service 76cb02

Index Sorting

Makeindex has very few methods to change its

Packit Service 76cb02
index sorting rules, except the -g and -L options which are not very hepfull in a DocBook context. On the contrary xindy can sort the index according to
Packit Service 76cb02
a specific language.

When xindy is used as index tool, dblatex passes to

Packit Service 76cb02
xindy through the xindy -L option
Packit Service 76cb02
the language name corresponding to the lang attribute of the
Packit Service 76cb02
document. If the document has no language or if xindy
Packit Service 76cb02
does not support the document language, the default sorting is applied. In this
Packit Service 76cb02
case you can use the following parameter:
Packit Service 76cb02
Packit Service 76cb02

  • latex.index.language specifies the

Packit Service 76cb02
language used to sort the indexes. Currently this parameter is relevant
Packit Service 76cb02
only for xindy. The language set must be known by xindy (see the xindy
Packit Service 76cb02
documentation). When not set (or empty) the sorting language to apply
Packit Service 76cb02
is deduced from the document lang.

Packit Service 76cb02

The parameter can be used like any other like this:

Packit Service 76cb02

Packit Service 76cb02
dblatex -P latex.index.language=german-din file.xml
Packit Service 76cb02

Packit Service 76cb02
Packit Service 76cb02
But it can also be used through an XSL configuration file to provide new mapping
Packit Service 76cb02
rules between ISO lang codes and known xindy languages, or override the current
Packit Service 76cb02
mapping done by dblatex as shown in Example 3.14, “XSL Index Language Setup”.
Packit Service 76cb02

Example 3.14. XSL Index Language Setup

By default dblatex maps the de lang

Packit Service 76cb02
code to the language named german-din, and has no
Packit Service 76cb02
correspondance to map cy (Welsh) or eu
Packit Service 76cb02
(Basque). The following setup provides a mapping for these cases:
Packit Service 76cb02

Packit Service 76cb02
<xsl:param name="latex.index.tool">xindy</xsl:param>
Packit Service 76cb02
Packit Service 76cb02
<xsl:param name="latex.index.language">
Packit Service 76cb02
  <xsl:variable name="lang">
Packit Service 76cb02
    <xsl:call-template name="l10n.language">
Packit Service 76cb02
      <xsl:with-param name="target" select="(/set|/book|/article)[1]"/>
Packit Service 76cb02
      <xsl:with-param name="xref-context" select="true()"/>
Packit Service 76cb02
    </xsl:call-template>
Packit Service 76cb02
  </xsl:variable>
Packit Service 76cb02
Packit Service 76cb02
  <!-- Define Xindy lang to use in specific cases -->
Packit Service 76cb02
  <xsl:choose>
Packit Service 76cb02
  <xsl:when test="$lang='de'">german-duden</xsl:when>
Packit Service 76cb02
  <xsl:when test="$lang='cy'">english</xsl:when>
Packit Service 76cb02
  <xsl:when test="$lang='eu'">french</xsl:when>
Packit Service 76cb02
  </xsl:choose>
Packit Service 76cb02
</xsl:param>
Packit Service 76cb02
 
</body></html>