Skip to content

Commit

Permalink
Fix: grid tables
Browse files Browse the repository at this point in the history
  • Loading branch information
alterat committed Mar 19, 2018
1 parent 243be04 commit aa8cacb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions csv-table.rst
@@ -1,13 +1,13 @@
Long tables
===========

You might be dealing with a large table, one that would be difficult to write as a `regular table <regular-table.html>`_ described before.
You might be dealing with a large table, one that would be difficult to write as a `grid table <grid-table.html>`_ described before.

One possibility is to use CSV files. You can store your data in a CSV table, without the need to worry about misplacing an equal sign in your table.

If your table is really long, however, it might sometimes break in the PDF output. Take for example the table below.

In order to make it look good in the PDF, you should use some LaTeX magic, disguised in RST directives. Using the :code:`:class: longtable` parameter in the table definition allows to nicely break long tables into several pages. You can also control the width of the individual columns with the :code:`tabularcolumns` directive: this will be familiar to you if you used LaTeX before.
In order to make it look good in the PDF, you should use some LaTeX magic, disguised as RST directives. Using the :code:`:class: longtable` parameter in the table definition allows to nicely break long tables into several pages. You can also control the width of the individual columns with the :code:`tabularcolumns` directive: this will be familiar to you if you used LaTeX before.

Finally, the :code:`:widths: 1 1` parameter controls how the columns look in the HTML page. As you can see, this is independent on the way columns behave in the PDF.

Expand Down
11 changes: 5 additions & 6 deletions regular-table.rst → grid-table.rst
@@ -1,11 +1,7 @@
Regular tables
Grid tables
==============

Normal tables in RST can be obtained by simply "drawing" their structure with a combination of symbols, as in the following code snippet (it's easier seen than explained!).

A row of equal signs separates the first row from the rest, if you want it to be the label of your table.

This type of tables is well rendered in the PDF output.
Tables in RST can be obtained by simply "drawing" their structure with a combination of symbols, as in the following code snippet (it's easier seen than explained!). These are called `grid tables <http://www.sphinx-doc.org/en/master/rest.html#tables>`_ in the documentation.

.. code-block:: rst
Expand All @@ -17,6 +13,9 @@ This type of tables is well rendered in the PDF output.
| 2 | Cinderella |
+------+---------------+
A row of equal signs separates the first row from the rest, if you want it to be the label of your table.

Grid tables are well rendered in the PDF output. This is the output from the snippet above.

.. table:: Regular table

Expand Down
2 changes: 1 addition & 1 deletion index.rst
Expand Up @@ -11,7 +11,7 @@ Types of table
.. toctree::
:maxdepth: 1

regular-table
grid-table
html-table
csv-table

Expand Down

0 comments on commit aa8cacb

Please sign in to comment.