Menu Close

LaTeX embedded indexing

What is LaTeX?

LaTeX is a document preparation system that uses markup language. It is especially well-suited for technical documents that contain many special symbols, complex tables, and mathematical formulas. LaTeX originated from the TeX formatting system developed by Donald Knut, American mathematician and professor of Stanford University. The first version of this system was produced in 1978, and in the following years its algorithm was frequently modified and improved.

In 1983, an American computer scientist Leslie Lamport developed set of macros built on the top of TeX with many functionalities that can produce beautiful output of a document, or a book. The new system became known as LaTeX. There are few thousand of packages written over the years that can be used in LaTeX to accomplish typesetting-related tasks.

LaTeX approach is based on structure of the document, not on appearance. Changes in source code apply to the whole document, but in order to see the changes, you need to generate a PDF file. Fortunately, integrated PDF viewer is embedded in the most popular LaTeX editors, such as Texmaker, TeXstudio, LyX, and Overleaf. These programs are open source software, and they are distributed free of charge.

How to index in LaTeX?

Every LaTeX document begins with a preamble, where you can place a set of commands that affect the entire document. Here, you can determine settings of the layout, indicate paper size, fonts, margins, columns, etc. However, the functionality of the basic commands is limited. To enhance the capability of LaTeX, you may need to add special packages.

To enable indexing function in LaTeX, you need to install the makeindex package by adding the following line in the preamble: \usepackage{makeidx}. Index entries are created by placing \index codes in the layout of the document followed by a name or a subject in the curly brackets. For example: \index{main heading}.

Indexing feature in LaTeX is designed for ideal scenarios, where index, once generated, is required minimum or no revision. As every professional indexer knows, this is never the case. Multiple revisions, additions, deletions, merging entries and locators, breaking down locator strings are inevitable in every project. And this is where LaTeX fails profoundly. Editing index means finding entries in the text and making changes manually. This work could be time consuming and probably would not fit your client’s schedule.

I have developed my own approach to indexing LaTeX documents, which combines the use of the conventional indexing software (Cindex/Macrex/SKY), DEXembed macro, and LaTeX features. This method proved to be efficient regardless of the complexity of the layout.

See also: “Indexing in LaTeX”, The Bulletin of the ISC/SCI, 42(1), Spring 2020, p. 13-16.

Posted in Embedded indexing