reST image grid with captions?

2019-07-19 17:50发布

As an extension to this question: how can you add a description under each of the gridded images using Sphinx and reStructuredText?

For example, a table, three images across with a caption centered under each image.

1条回答
小情绪 Triste *
2楼-- · 2019-07-19 18:42

I am not sure if this is possible with just the figure directive, like it is with the image directive. However, whilst horrible to look at, you could wrap the three figures in a table. For example, the following reStructuredText

+-----------------------------------------+-----------------------------------------+-----------------------------------------+
| .. figure:: http://placehold.it/150x150 | .. figure:: http://placehold.it/150x150 | .. figure:: http://placehold.it/150x150 |
|   :alt: map to buried treasure          |   :alt: map to buried treasure          |   :alt: map to buried treasure          |
|                                         |                                         |                                         |
|   This is the caption of the figure (a  |   This is the caption of the figure (a  |   This is the caption of the figure (a  |
|   simple paragraph).                    |   simple paragraph).                    |   simple paragraph).                    |
+-----------------------------------------+-----------------------------------------+-----------------------------------------+

produces

Table of three figures in a row produced by the above reStructuredText

查看更多
登录 后发表回答