1

I want to add variables that are defined as Greek letters to my glossary in a sphinx document. For example:

.. glossary::

    :math:`{\alpha}`
        Definition for alpha

The goal is to have these variables appear in the document's index. Anyone have experience with this?

bad_coder
  • 11,289
  • 20
  • 44
  • 72
Eric D.
  • 305
  • 1
  • 11
  • Syntax wasn't my concern, but I updated the example to eliminate confusion. I'd like to be able to define glossary terms that are Greek letters. – Eric D. Nov 30 '16 at 16:21
  • It would help if you explained what the actual problem is. – mzjn Nov 30 '16 at 16:22
  • Sure. In the example above, a Greek letter will be added to the document with a definition. However, the Greek letter (in this case alpha) will not appear in the glossary as a term. – Eric D. Nov 30 '16 at 16:25
  • That is not what I see. The alpha character is there as a term in the glossary in the output. But with your example, Sphinx (1.4.9) emits this warning "WARNING: invalid single index entry ''" (which is related to the fact that glossary terms are added to the index as well). – mzjn Nov 30 '16 at 16:32
  • Thanks for the comment. The indexing functionality is what I want to achieve, is that possible with Greek letters? – Eric D. Nov 30 '16 at 16:35
  • So you get the same warning then? – mzjn Nov 30 '16 at 16:39
  • Nope. I'm using Sphinx 1.4.9 as well. – Eric D. Nov 30 '16 at 16:41

1 Answers1

3

Glossary terms are automatically added to the index. But that does not work for the glossary entry in the question. Sphinx emits this warning: WARNING: invalid single index entry '' (at least it does for me). This feels like a bug.

Here are two workarounds:

  1. Use a substitution

    |alpha|
       Description of alpha
    
    .. |alpha| replace:: :math:`{\alpha}`
    

    The drawback is that it will say "alpha" in the index instead of "α".

  2. Use the actual alpha letter

    α
       Description of alpha
    

    Here α will be an entry in the index under the heading "Symbols".

mzjn
  • 48,958
  • 13
  • 128
  • 248
  • Thanks for your help! I'm going to use the second option because it will use the character in the index. – Eric D. Dec 01 '16 at 13:04