On 05/30/2012 07:14 AM, Borsuk Euroazjatycki wrote:
> Since I learned Docutils, I *like* writting documentation.
> In recent days, I converted another document into reStructuredText
> format. It's a Readme file of a mod for a very old game - Master of
> Magic. The document features LOTS of tables.
> It turns out Docutils is not very good at fitting text into tables.
> HTML output is just fine, it reflows as you resize the window. .odt
> output is more problematic - 9999 in Table of Contents (can't be
> fixed, I'm afraid) and tables have trouble fitting between margins.
> But not too bad. The real problem shows up with rst2pdf. Look here:
> And this is with manual tweaking - breaking lines manually in
> 'Specials' column. Note that even though text doesn't fit, there's
> still abundance of unused room to the right. It's as if rst2pdf
> doesn't calculate horizontal space correctly. For reference, the reST
> for the column is here:
After some little research I know what's happening here.
First thing to keep in mind is that the width of the columns in the
restructured text source MATTERS.
rst2pdf will try to make columns proportional to that. So, in your
original text, the last column is 26 characters wide, out of 104, so
it's roughly 25% of the page. The same happens for every column.
The other problem, which is what shows in the pdflatex output is that
*that table is very very wide!* It's about 96 characters wide, when you
count the widest cell on each column. That will work in HTML, where
pages can often be 200 characters, but it will *not* work
on paper in most cases.
Even then, by adjusting the column widths on the sources, you can get
better results. Example:
Which is not perfect, because even the headers are hard to fit in a
page, but is improved.