Skip to content

LaTeX: image using width set at 10% renders badly or inconsistently in table cell #13661

Open
@jfbu

Description

@jfbu

Describe the bug

I used :width: 10% in a table cell and got unsatisfactory results.

Image

How to Reproduce

===================
 FOO documentation
===================


image in table cell using width at 10%
======================================


+----------------------------+
|                            |
| .. image:: img.png         |
|    :width: 10%             |
|                            |
+----------------------------+


+---+------------------------+
| a | b                      |
+---+------------------------+
| c | .. image:: img.png     |
|   |    :width: 10%         |
|   |                        |
+---+------------------------+

+---+------------------------+
| a | b                      |
+---+------------------------+
| .. image:: img.png         |
|    :width: 10%             |
|                            |
+---+------------------------+

Environment Information

Platform:              darwin;
Python version:        3.13.3 (v3.13.3:6280bb54784, Apr  8 2025, 10:47:54) [Clang 15.0.0 (clang-1500.3.9.4)])
Python implementation: CPython
Sphinx version:        8.3.0+/e1bd9cb38
Docutils version:      0.21.2
Jinja2 version:        3.1.6
Pygments version:      2.19.1

Sphinx extensions

Additional context

Sphinx translates the 10% into 0.100\linewidth. But \linewidth may be zero at some times of processing of tables 1. In the first two cases tabulary fell back to its minium width of 10pt. In the third case (merged cell), Sphinx emitted a varwidth environment wrapper and seemingly \linewidth had a normal interpretation.

Footnotes

  1. it looks as I was going through a state of confusion here. It is not exactly clear what \linewidth is especially when tabulary tries to find dynamically the best choice of column width, but it is not set to zero. Apologies.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions