1

Is there a way to reference Sphinx tables the following way:

.. table Supertable

    +--------+----+
    |Foo     |Bar |
    +--------+----+

And then:

:table:`Supertable`

And magic! The problem is, that there are certain tables, that could be referenced throughout one document and such linking could come very useful.

On a side note the approach I've illustrated my question with doesn't work.

Also, as another part of the same question, is there a way to automatically numerate the tables? I'm pretty positive I've seen one somewhere, but it could be something manual. I mean like in:

Table 11: Consumption of peanut butter by the state..

This functionality, if available at all, is eluding me.

wswld
  • 1,218
  • 15
  • 32

1 Answers1

2

OK, I've found an answer to the first part of my question. Actually it's a nobrainer:

.. _table:

.. table Supertable

    +--------+----+
    |Foo     |Bar |
    +--------+----+

And then:

:ref:`table`

As for enumerated tables I have actually seen enumerated figures, not tables and it gets done in LaTeX output. I looked around and haven't found any trace of automatically enumerated tables in Sphinx. It would probably make a good feature request, but for now there seems to be no such feature.

PS: I've checked and actually tables are also enumerated in LaTeX. There is also a related problem discussed in this question.

Community
  • 1
  • 1
wswld
  • 1,218
  • 15
  • 32
  • I kinda touched on this a while ago in this post. [http://stackoverflow.com/questions/8681236/csv-table-formatting-through-preamble/18519419#18519419](http://stackoverflow.com/questions/8681236/csv-table-formatting-through-preamble/18519419#18519419) – Cole Aug 02 '14 at 13:00
  • It requires extensions, which I'm personally trying to avoid, or at least fork it and make a portable version out of it to be distributed together with the project. But thanks. I'm gonna keep the link for future reference. – wswld Aug 03 '14 at 14:05