2012-11-02 62 views
0

我希望能够在表格内生成内容表格。例如。它应该 有边框,看起来像这样:在表格内创建表格

.. tabularcolumns:: |p{10.5cm}|p{1.1cm}|p{1.4cm}|p{1.1cm}| 
+----------------------------------------------------+-------+---------+-----+ 
|             | hw1 | hw2 | hw3 | 
+====================================================+=======+=========+=====+ 
| heading 1           |  |   |  | 
+----------------------------------------------------+-------+---------+-----+ 
| heading 2           |  |   |  | 
+----------------------------------------------------+-------+---------+-----+ 
| heading 3           |  |   |  | 
+----------------------------------------------------+-------+---------+-----+ 

我想从像自动生成表:

.. toctree:: 
    :maxdepth: 2 

file 1 
file 2 

输出为HTML和PDF。

可以这样做吗?或者我必须使用docutils解析器或类似的?

回答

1

您可以编辑basic.css给你toc边框:

1步:从您的狮身人面像建目录cp _build/html/_static/basic.css _static/

第2步:添加以下行来basic.css

div.toctree-wrapper { 
    border-collapse: collapse; 
} 

div.toctree-wrapper li { 
    padding: 1px 8px 1px 5px; 
    border:1px solid black; 
} 

第3步:编辑你的第一个文件中的一个,这样建立,当你执行make html

在踢..一个nd你应该看到你的目录周围的边界...像这样 enter image description here

+0

感谢您的回答。不幸的是我需要输出html页面和pdf文档。 –