When writing RST that will be processed with Sphinx, I can\'t get Sphinx LaTeX output to use figure numbers when referencing figures. For instance, this code:
To expand on the accepted answer, you can quickly get this set up as follows. Put the numfig.py
file in your source
directory. Then open conf.py
and uncomment the line that says
sys.path.insert(0, os.path.abspath('.'))
Then add 'numfig'
to the extensions
list.
To use in your rst
document, first label your figure (e.g., fig-main
):
.. _fig-main:
.. figure:: main.png
This is the figure caption.
Finally, you can reference its figure number using the :num:
directive, like this:
Refer to the main figure (Figure :num:`fig-main`).