## 3.3.4 Indexes

All index building and sorting is done internally in plasTeX. It is done this way because the information that tools like makeindex generate is only useful to LaTeX itself since the refence to the place where the index tag was inserted is simply a page number. Since plasTeX wants to be able to reference the index tag node, it has to do all of the index processing natively.

There are actually two index structures. The default structure is simply the index nodes sorted and grouped into the appropriate hierarchies. This structure looks like the structure pictured in Figure 3.6.

Figure 3.6 Default index structure

Each item, subitem, and subsubitem has an attribute called key that contains a document fragment of the key for that index item. The document nodes that this key corresponds to are held in a list in the pages attribute. These nodes are the actual nodes corresponding to the index entry macros from the LaTeX document. The content of the node is a number corresponding to the index entry that is formatted according to the formatting rules specified in the index entry.

While the structure above works well for paged media, it is sometimes nice to have the index entries grouped by first letter and possibly even arranged into multiple columns. This alternate representation can be accessed in the groups property. The structure for this type of index is shown in Figure 3.7.

Figure 3.7 Grouped index structure

In this case, the item, subitem, and subsubitem nodes are the same as in the default scheme. The group has a title attribute that contains the first letter of the entries in that group. Entries that start with something other than a letter or an underscore are put into a group called “Symbols”. The columns are approximately equally sized columns of index entries. The number of columns is determined by the document:index-columns configuration item.