4
votes

I have directives in my rst document, which insert figures; and I use rst2pdf's :counter: directive to automatically number them.

.. figure:: Graphics\Manual_test_timeline.png
   :scale: 100%
   :align: center

   Figure :counter:`figure`. Manual Testing Timeline

The caption renders as Figure 1. Manual Testing Timeline.

How can I reference those automatically numbered figures elsewhere in the document? I need to be able to write

See ??? for more details on the timeline.

Where ??? is a reference to the text in caption of the figure (including the number).

Is there a way to do this with either standard restructured text or a special rst2pdf hack?

2

2 Answers

2
votes

There is no way to do that automatically. There are, of course, ways to do that manually.

2
votes

If you can sacrifice the figure number, then this would work with a hyperlink:

.. _Manual Testing Timeline:

.. figure:: Graphics\Manual_test_timeline.png
   :scale: 100%
   :align: center

   Figure :counter:`figure`. Manual Testing Timeline

Here is some text referencing `Manual Testing Timeline`_

But if you can't sacrifice the figure number, I can't think of any solution.

The syntax Text <#figure-1> could be something to look into as well.