# How to have auto-numbered figures with ReST to LaTeX [closed]

Currently I'm using ReST like

see Figure 2.1__.

__
.. figure:: images/first_figure
:width: 80%
:align: center

First Figure

to add in linked figures. Unfortunately this requires hard-coded figure numbers and generates LaTeX like

see \hyperref[id1]{Figure 2.1}.
\begin{figure}
\phantomsection\label{id1}
\noindent\makebox[\textwidth][c]{\includegraphics[width=0.800\linewidth]{images/first_figure}}
\caption{First Figure}
\end{figure}

Does anyone know of a way to get rst2latex.py to generate a first line more like

see \hyperref[id1]{Figure \ref*{id1}}.

or something similar so that the numbers are auto-generated instead of being hard-coded.

-
You might want to ask this question in a Python or ReST forum. BTW: The quality of the generated LaTeX code could be improved. – Martin Scharrer Feb 13 '11 at 22:49
From what I see in rst2latex.py, the deficiency is really in the latex2e parser in docutils. One way to do it would be to write a script to replace the float names after the fact, if there's some relation between the autogenerated labels and the figure names. But that of course is just an ugly hack that will probably not work 100% reliably. – Martin Tapankov Mar 9 '11 at 6:22

## closed as off topic by lockstep, Andrey Vihrov, Joseph Wright♦Sep 3 '11 at 21:39

Questions on TeX - LaTeX Stack Exchange are expected to relate to TeX, LaTeX or related typesetting systems within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.