New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table counter is overrided by code-block's in LaTeX #2319

Closed
tk0miya opened this Issue Feb 14, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@tk0miya
Member

tk0miya commented Feb 14, 2016

In Sphinx-1.3.5, the counter of tables is overrided by code-block's in latex output.
You can see the caption of table starts with 'Listings ...' in following screenshot:
2016-02-14 14 06 36

The screenshot above is generated from following reST:

.. list-table:: hello-table
   :header-rows: 1

   * - Hello
     - World
   * - Hello
     - World

.. code-block:: python
   :caption: hello-world

   print('Hello world')

.. code-block:: python
   :caption: hello-world

   print('Hello world')

.. list-table:: hello-table
   :header-rows: 1

   * - Hello
     - World
   * - Hello
     - World

This behavior comes from the combination of threeparttable and captionof.
As a test, I wraped the threeparttable in table environment. Then the problem was fixed.

@tk0miya tk0miya added the latex label Feb 14, 2016

jfbu added a commit to jfbu/sphinx that referenced this issue Feb 14, 2016

Fix #2262 (latex): avoid pagebreaks after captions of literal blocks
This could fix sphinx-doc#2262
and also perhaps sphinx-doc#2319

As now the caption is set in an environment it appears to possibly solve
also issue #2319 Table counter is overrided by code-block's in LaTeX

The parent commit used only \FirstFrameCommand of latex package
framed, but \FrameCommand also must be customized in case the
framed contents fit on a single page. This is fixed here.

	modified:   sphinx/texinputs/sphinx.sty
@jfbu

This comment has been minimized.

Show comment
Hide comment
@jfbu

jfbu Feb 14, 2016

Contributor

Screenshot if using jfbu@59de4bf
(commit branch on top of 1.3.5 Sphinx release)

capture d ecran 2016-02-14 a 10 08 24

Contributor

jfbu commented Feb 14, 2016

Screenshot if using jfbu@59de4bf
(commit branch on top of 1.3.5 Sphinx release)

capture d ecran 2016-02-14 a 10 08 24

@jfbu

This comment has been minimized.

Show comment
Hide comment
@jfbu

jfbu Feb 14, 2016

Contributor

This does not change the fact that indeed threeparttable environment should better be used from inside a table environment with suitable caption therein.

Contributor

jfbu commented Feb 14, 2016

This does not change the fact that indeed threeparttable environment should better be used from inside a table environment with suitable caption therein.

@tk0miya

This comment has been minimized.

Show comment
Hide comment
@tk0miya

tk0miya Mar 6, 2016

Member

Fixed by #2297.

Member

tk0miya commented Mar 6, 2016

Fixed by #2297.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment