Augusto T.
Augusto T.

Reputation: 177

How to create an automatic list of words in Sphinx

I am writing a book in Sphinx (not at all python related). And I have some terms that appear in the text that I would like to list at the end of the pdf. What I want is exactly what can be achieved by the index offered by Latex.

I am aware of the glossary directive in sphinx, but it clearly does not perform what I want. For example, several terms would not even have a definition, but I want a link to them at the end of the document. Something like this:

At page 1:

  Mammal is a type of animal, we all love them...

At page 17:

  Berries are fruits, we all love them...

At the end of the book:

  Index
    berry, 17
    mammal, 1

I have read about the index role in sphinx documentation, here. It seems perfect for my problem, but it is not clear how to create the index of all the terms in the end.

Is there a command to list all the terms created using

.. index: mammal

throughout the text? Or is there another directive that gets the job done?

Upvotes: 4

Views: 1233

Answers (1)

Augusto T.
Augusto T.

Reputation: 177

The comments were enough for me to figure it out.

The index is automatically generated in html, but it has to be found in the file genindex.html, which was hidden in my machine for other reasons.

For the pdf output, the index has to be compiled separatedly.

So, no extra command in sphinx, everything is automatic.

Upvotes: 1

Related Questions