12. Cross Referencing¶
To cross reference different parts of the book, first step is to identify canonical names/ids for the reference. e.g.
figure-red-circle. The canonical names/ids are only needed to uniquely identify the cross references. By default, the references show the actual text of the heading and figure.
For Heading the entries are defined like this:
.. _section-figures: Figures ===================================================================
For Figures, the entries are defined like this (See line
1See :ref:`figure-red-circle` 2 3 4.. _figure-red-circle: 5 6.. figure:: /img/red-circle.* 7 8 A red circle 9 10.. _figure-blue-circle: 11 12.. figure:: /img/blue-circle.* 13 14 A blue circle 15 16 17See :ref:`figure-blue-circle`
When the write with the following
reStructuredText markup / syntax:
See :ref:`figure-red-circle` and :ref:`figure-blue-circle` (They are shown as part of :ref:`section-figures` of :ref:`chapter-images-and-figures`) We can also use our name for Sections. e.g. :ref:`the section about Figures <section-figures>`, and :ref:`this Section itself <cross-referencing>`.
The |rst| text written above is generated/rendered as shown below:
See more at
Cross-referencing arbitrary locations in Sphinx Documentation.