Raku / book

Using Raku – an unfinished book about Raku
https://perl6book.com/
283 stars 49 forks source link

Need automatic line breaking in tables. #41

Closed rassie closed 13 years ago

rassie commented 13 years ago

Table 11.6: String methods/functions is too wide because the text is not broken in lines.

jest commented 13 years ago

I was just taking a look at this.

The problem is in the default generating tables as LaTeX tabular with |l|l|...| format. The tabular just can't wrap the text. In fact, this is not a problem with the book, but rather with Pod::PseudoPod::LaTeX.

The best solution would be to switch to tabularx (that is a required package in LaTeX) and use its X format (see http://www.ctan.org/tex-archive/help/Catalogue/entries/tabularx.html), but I see no way to clearly specify in the POD the formatting options (i.e. which =cell's to format as X). Or maybe it should be an option to the Pod::PseudoPod::LaTeX's new() and used in all tables? Like:

Pod::PseudoPod::LaTeX->new(column_format => 'X');
rassie commented 13 years ago

Then it's probably a matter of defining proper start_table and end_table in Perl6BookLatex.pm. Care to try?

jest commented 13 years ago

Well, I tried, but the result is not to pleasant. The columns are a bit to wide, as I used the "dummy" replacement to: \begin{tabularx}{\columnwidth}{|X|X|}

and so all columns are of the same width, taking all possible horizontal space...

No idea, how to do it differently, can't even finde a LaTeX package to allow for "natural-width" tables with possibly "growing" columns.

jest commented 13 years ago

Also, this would require configuring which columns are l-formated and which are X-formated, from inside POD through Perl6BookLatex start_*. Is it doable?

rassie commented 13 years ago

There is something called tabulary, which is probably what we need? Could you look into it?

jest commented 13 years ago

Works great! Will commit soon.

jest commented 13 years ago

Nicely wrap long text in tables, due to tabulary.

Closed by 7be21205abff00338773cd70c6c77d240a894057