How to fix column width in reStructuredText tables?

一世执手 提交于 2019-12-07 01:45:00

问题


I am using Sphinx to create this table:

+---------------+---------------------+---------------------------+-------------------------------------+---------------------+
| Stakeholder   | Major Value         | Attitudes                 | Constraints                         | Major Interests     |
+===============+=====================+===========================+=====================================+=====================+
| Manager       | Reduce data entry.  | Strong commitment through | Cost, time and the required skill to| Google apps         |
|               | Improve ft          | release 4.                | develop this application.           | integration.        |
|               | productivity.       |                           |                                     |                     |
+---------------+---------------------+---------------------------+-------------------------------------+---------------------+
| Ft            | More efficient use  | Strong enthusiasm         | Training required to use       CRM. | Google apps         |
|               | of time. Less       |                           |                                     | integration.        |
|               | repetitive work.    |                           |                                     |                     |
|               |                     |                           |                                     |                     |
+---------------+---------------------+---------------------------+-------------------------------------+---------------------+

I want the column width to be fixed at a narrow size so this table can be displayed in one page. But Sphinx makes the ceil text into one long line. So the column width is the size of the ceil text. See the attached image.

Is there a way to fix the column width or make the ceil text displayed as the source table?

Thanks


回答1:


If your issue is with latex output, the tabularcolumns directive gives you the necessary flexibility.

Here is an example for forcing the width of the first 2 columns:

.. tabularcolumns:: |p{1.5cm}|p{1.5cm}|L|

For more information, see the reference documentation.



来源:https://stackoverflow.com/questions/27546728/how-to-fix-column-width-in-restructuredtext-tables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!