jterrace / sphinxtr

The Sphinx Thesis Resource
http://jterrace.github.com/sphinxtr
Other
153 stars 50 forks source link

Issue when using numfig extension: can't compile HTML #33

Open Gabriel-p opened 9 years ago

Gabriel-p commented 9 years ago

(Issue brought over from https://github.com/sphinx-doc/sphinx/issues/1864)

I'm using the numfig extension from the https://github.com/jterrace/sphinxtr package to generate proper numbering when referencing figures.

I reference figures using the code:

See Fig. :num:`fig-2dhisto`.

.. _fig-2dhisto:

.. figure:: _static/2d-histo.png
   :scale: 80 %
   :align: center

   Approximate center coordinate values....

In my system the HTML compiles, but the numbers are off as seen in the image below:

captura de pantalla de 2015-04-23 19 05 57

When I push the code to my repo (https://github.com/asteca/asteca-docs) the PDF compiles properly with the images perfectly numbered (see https://media.readthedocs.org/pdf/asteca/latest/asteca.pdf) .

The HTML on the other hand fails with the following output (accesible here: https://readthedocs.org/builds/asteca/2620960/):

html
-----

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/sphinx/cmdline.py", line 254, in main
    app.build(force_all, filenames)
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/sphinx/application.py", line 212, in build
    self.builder.build_update()
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 214, in build_update
    'out of date' % len(to_build))
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 276, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 320, in write
    self._write_serial(sorted(docnames), warnings)
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 333, in _write_serial
    self.write_doc(docname, doctree)
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/html.py", line 433, in write_doc
    self.docwriter.write(doctree, destination)
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/docutils/writers/__init__.py", line 80, in write
    self.translate()
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/sphinx/writers/html.py", line 51, in translate
    self.document.walkabout(visitor)
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout
    if child.walkabout(visitor):
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout
    if child.walkabout(visitor):
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout
    if child.walkabout(visitor):
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout
    if child.walkabout(visitor):
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/docutils/nodes.py", line 166, in walkabout
    visitor.dispatch_visit(self)
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/docutils/nodes.py", line 1882, in dispatch_visit
    return method(node)
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/sphinx/writers/html.py", line 588, in unknown_visit
    raise NotImplementedError('Unknown node: ' + node.__class__.__name__)
NotImplementedError: Unknown node: num_ref

Exception occurred:
  File "/home/docs/checkouts/readthedocs.org/user_builds/asteca/envs/latest/local/lib/python2.7/site-packages/sphinx/writers/html.py", line 588, in unknown_visit
    raise NotImplementedError('Unknown node: ' + node.__class__.__name__)
NotImplementedError: Unknown node: num_ref
The full traceback has been saved in /tmp/sphinx-err-w7S3WI.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!
jterrace commented 9 years ago

These looks like two separate issues?

I know I had issues with readthedocs before not registering the appropriate extensions from the conf.py file.

The numbering issue I'm not sure about. Do you get any errors when you compile the HTML on your own machine?

Gabriel-p commented 9 years ago

I'm also using your numsec extension and that one is working just fine (see for example: http://asteca.readthedocs.org/en/latest/center.html#precise-center-value, paragraph above Fig 3)

I get no issues when compiling on my system, here's an example output of make html:

sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v1.3b1
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: [extensions changed] 14 added, 0 changed, 0 removed
reading sources... [100%] synth_clust                                                                                  
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] synth_clust                                                                                   
generating indices... genindex
writing additional pages... search
copying images... [100%] _static/center.png                                                                            
copying static files... done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded.