reST image grid with captions?

2019-07-19 18:23发布

问题:

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:

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