views:

64

answers:

1

How can I cross-reference an indexed item inside a reStructuredText document?

For example, how can I cross-reference SectionB:

.. index::
    pair: SectionA; SectionB

SectionB
--------

SectionB description.

I tried using :ref:'SectionB' and :index:'SectionB' but they don't work.

Thanks.

A: 

see: Cross-referencing arbitrary locations

in the Sphinx documentation.

I think what you might be missing is a reference label,

Try something like:

.. index::
pair: SectionA; SectionB

.. _section-b-label:

SectionB
--------

SectionB description.

and then elsewhere do:

:ref:`section-b-label`
Kevin Horn
I know I can use reference labels. What I was trying to avoid is having to add both the index and the reference label. It seems a bit redundant.
Unbeknown