5. Skribe User Manual -- Indexes

Skribe support indexes. One may accumulate all entries inside one unique index or dispatch them amongst user declared indexes. Indexes may be monolithic or split. They only differ in the way they are rendered by the back-ends. For a split index a sectioning based on the specific (e.g., "the first one") character of index entries is deployed.

5.1 Making indexes

The function make-index declares a new index.

prototype
(make-index ident)
argumentdescription
identA string, the name the index (currently unused).
See also
default-index index the-index ref mark

For instance, the following Skribe expression declares an index named *index1*:

Example:
(define *index1* (make-index "a new index"))
Ex. 22: Creation of a new index

This example produces no output but enables entries to be added to that index. In general it is convenient to declare indexes before the call to the document function.

The function default-index returns the default index that pre-exists to all execution.

prototype
(default-index)

5.2 Adding entries to an index

The function index adds a new entry into one existing index and sets a mark in the text where the index will point to. It is an error to add an entry into an index that is not already declared.

prototype
(index [:ident] [:class "index"] [:note] [:index] [:shape] [:url] name)
optionenginesdescription
identhtml latex xml The node identifier.
classhtml latex xml The node class.
indexThe name of the index whose index entry belongs to. A value of #f means that the default-index owns this entry.
noteAn optional note added to the index entry. This note will be displayed in the index printing.
shapeAn optional shape to be used for rendering the entry.
urlAn optional URL that is referenced in the index table instead of the location of the index.
argumentdescription
nameThe name of the entry. This must be a string.
See also
make-index default-index the-index

The following expressions add entries to the index *index1*:

Example:
[The identifier ,(code "Foo"),(index :index *index1* "Foo") is a usually
used as an example. When two identifiers have to used, frequently the
second choice is ,(code "Bar"),(index :index *index1* "Bar" :shape (it "Bar")).
When three are needed, some use ,(code "Baz")
,(index :index *index1* "Baz" :shape (it "Baz")).

This illustrates how to use identifier
,(index :index *index1* "Foo" :note "How to use Foo")
,(index :index *index1* "Foo" :note "How not to use Foo")
,(index :index *index1* "Fooz")
...]
Ex. 23: Adding entries to an index
The identifier Foo is a usually used as an example. When two identifiers have to used, frequently the second choice is Bar. When three are needed, some use Baz . This illustrates how to use identifier ...

There is no output associated with these expressions.


5.3 Printing indexes

The function the-index displays indexes in the produced document.

prototype
(the-index [:ident] [:class "the-index"] [:split] [:char-offset 0] [:header-limit 50] [:column 1] index...)
optionenginesdescription
identhtml latex xml The node identifier.
classhtml latex xml The node class.
splitIf #t, character based sectioning is deployed. Otherwise all the index entries are displayed one next to the other.
char-offsetThe character number to use when split is required. This option may be useful when printing index whose items share a common prefix. The argument can be used to skip this prefix.
header-limitThe number of entries from which an index header is introduced.
columnThe number of columns of the index.
argumentdescription
index...The indexes to be displayed. If index is provided, the global index default-index is printed.

If the engine custom index-page-ref is true when a index is rendered then, page reference framework is used instead of a direct reference framework.

Example:
(the-index *index1*)
Ex. 24: Printing indexes

Produces:

Bar
Baz
Foo
...How not to use Foo
...How to use Foo
Fooz

See the Skribe global index for a real life index example.



This Html page has been produced by Skribe.
Last update Tue Jun 29 09:37:13 2010.