readthedocs / readthedocs.org

The source code that powers readthedocs.org
https://readthedocs.org/
MIT License
8.04k stars 3.58k forks source link

Issues with :numref: and numfig #1236

Closed Gabriel-p closed 9 years ago

Gabriel-p commented 9 years ago

I'm trying to have figures in my RTD project referenced by number. To do this I use:

:numref:`my-image`

as stated in the numref description (where mi-image is the image's label).

To have the images referenced by number I set:

numfig = True

in the conf.py file, as stated in the numfig description. Here it also says that "For now, it works only with the HTML builder" which I'm not really sure what it means (what will happen with the PDF then? not compile? compile with this setting turned off?)

After doing this, I get in the local build the following:

captura de pantalla de 2015-04-28 09 36 14

Notice that the figure is labeled 5.1 and linked.

This is what I get after pushing the changes to RTD:

captura de pantalla de 2015-04-28 09 37 16

see that now the figure is labeled 1 and the link is lost.

If I check the PDF build I get a notice of successful build with the following errors showing in the compilation:

Build Standard Error

/var/build/user_builds/asteca/checkouts/latest/docs/center.rst:36: ERROR: Unknown interpreted text role "numref".
/var/build/user_builds/asteca/checkouts/latest/docs/center.rst:62: ERROR: Unknown interpreted text role "numref".
/var/build/user_builds/asteca/checkouts/latest/docs/center.rst:67: ERROR: Unknown interpreted text role "numref".
/var/build/user_builds/asteca/checkouts/latest/docs/center.rst:87: ERROR: Unknown interpreted text role "numref".
/var/build/user_builds/asteca/checkouts/latest/docs/likelihood.rst:11: ERROR: Unknown interpreted text role "numref".
This is makeindex, version 2.15 [TeX Live 2013] (kpathsea + Thai support).
Scanning style file ./python.ist......done (6 attributes redefined, 0 ignored).
Scanning input file ASteCA.idx...done (0 entries accepted, 0 rejected).
Nothing written in ASteCA.ind.
Transcript written in ASteCA.ilg.

which makes the PDF look like:

captura de pantalla de 2015-04-28 09 41 41

which I guess is related to the "For now, it works only with the HTML builder" notice in numfig.

Why are the local build and the live version different (local has link to figure, live does not)? And, is there a way to at least disable the numfig option when compiling the PDF or some fix to make both the HTML and the PDF look reasonably well?

Gabriel-p commented 9 years ago

Now numref is being completely ignored by RTD, not even the HTML site is picking it up.

If I compile locally, everything works fine (using Sphinx v1.3.1), but after pushing the changes to my Github repo RTD shows in the build:

Build Standard Error

html
-----

/var/build/user_builds/asteca/checkouts/latest/docs/center.rst:36: ERROR: Unknown interpreted text role "numref".
/var/build/user_builds/asteca/checkouts/latest/docs/center.rst:63: ERROR: Unknown interpreted text role "numref".
/var/build/user_builds/asteca/checkouts/latest/docs/center.rst:68: ERROR: Unknown interpreted text role "numref".
/var/build/user_builds/asteca/checkouts/latest/docs/center.rst:88: ERROR: Unknown interpreted text role "numref".
/var/build/user_builds/asteca/checkouts/latest/docs/likelihood.rst:11: ERROR: Unknown interpreted text role "numref".

even though it reports a "successful build".

Gabriel-p commented 9 years ago

Not sure if I was messing things up or if something got fixed on that end, but this is working fine now. Referencing using numfig works both in the HTML and the PDF version.

Closing.