Search code examples
csvpython-sphinxrestructuredtextpdflatex

Ugly, broken table in pdf generated by sphinx latexpdf from rst


need some help with sphinx latexpdf output. Have an document version csv-table in rst file. In html looks perfect, in pdf terrible. my table:

.. csv-table:: 
:header: Version, Date, Description
:widths: 15, 20, 50

34343, 02/04/2015, "| Added *httsdfsdps* support"
3434, 14/11/2014, "| Added *folsdfsdlow* parameter to *hgfhfg*"
34343, 13/05/2014, "| Added *fdsf* parameter to *dfgdfgdfgdfgfdgdfgdfgdf*"
21321, 29/10/2013, "| Added *sdfsdf* parameter to *dfgsgfds*           
| Deprecated afsfsdf interface"
312321, 05/03/2013, "| Added *dsfsdfsddsfsd* parameter to *dfgdfgdfgdfgdfgdf*             
| Documented *dfgdgd*"
213211, 28/02/2013, "Added *!=* operator in *fghfghfg*"
2132132, 26/02/2013, "Added *dsfsdfsdfsdfsdfsd* in *fghf*"
213219, 07/02/2013, "| Added *jsonhash* event format
| Added *filter* parameter in event connection
| Added *group* and *map* parameter to *nph-muu-sf*"
21321321, 30/01/2013, "| Added *height* parameter in *dfgdfgdfdfg*
| Added *dfgdfgdfgdf* in dfgdfgdfgdf"

HTML 1

PDF 2

Table is not full in pdf. And this style with spaces at top, bottom near text in cells. Why latex does not take size from rst? Can i make it better? How? Thanks for help!


Solution

  • I know your question has been posted for a while, but in case it is still an issue, and for posterity who may come upon this here is how I fixed this issue in an rst doc of my own. I had the same issue, but using a standard rst table drawn out explicitly like so.

    +--------+--------+---------+
    |Column 1|Column 2| Column 3|
    +========+========+=========+
    |Value   |Value   |Value    |
    +--------+--------+---------+
    

    And so on with many cells that would show the same behavior of running over the page end. The solution was using the class: longtable argument, and then very carefully indenting the table so that the class was applied. Like so:

    .. table:: Table Title
      :class: longtable
      +--------+--------+---------+
      |Column 1|Column 2| Column 3|
      +========+========+=========+
      |Value   |Value   |Value    |
      +--------+--------+---------+
    

    This when rendered in pdf would properly break the table over multiple pages. You should be able to use the same class on a csv table.