W dniu sobota, 3 maja 2014 07:37:19 UTC+2 użytkownik John MacFarlane napisał:
the LaTeX table model
only allows you to wrap when you know how wide the cell is.
We can get that kind of information from multiline and grid
tables, but not from pipe tables, precisely because pipe tables
are limited to one line per row in the source.
I understand that in multiline and grid tables we can know proportions of column widths (and compare them to the output page width and calculate the exact widths) just after reading the first row (typically a header) of the table but it seems to me that for pipe table it is also possible (while may require analysis of all rows of the table).
In the pipe tables a question arises - as columns width in each row may vary which cell's width in each column should we use to calculate columns width proportions. There might be many answers:

1. Use column widths from the table header (or the first row it the does not have a header)
  Benefits:
    - easy to predict column widths in the output (we know it depends only on the first row of a table in a markdown source)
    - easy to adjust column widths in the output (only the first row of a table in a markdown source has to be adjusted)
    - simple
  Drawbacks:
    - need to manually adjust a first row of a table to achieve a good-looking tables with sparse long cells

2. Calculate column widths in a more sophisticated way (e.g. like it is being done in browser when rendering HTML table).
An example algorithm can be: Calculate the maximum width of each column and a width of the longest word in each column (denote Wmin). Calculate the width of each column using proportions of their maximum widths. Compare it with the Wmin of each column - if it is lower than Wmin, assume column width of Wmin. Repeat calculation omitting columns which width was already set to Wmin until there are no columns left or no column was given a width of Wmin in the last step.
  Benefits:
    - good-looking tables out of the box;
  Drawbacks:
    - difficult to predict a table layout in the output from a markdown source
    - difficult to adjust (in a predictable way) a layout of the table in the output
    - more complicated to implement
 
Mateusz

W dniu sobota, 3 maja 2014 07:37:19 UTC+2 użytkownik John MacFarlane napisał:
Distinguish wrapping in input and wrapping in output.  In a grid
or multiline table, you may have to wrap lines in the markdown
source, but that is independent of wrapping in the output.  In
general, the lines will be wrapped differently in the output.

In a pipe table, you can't have wrapping in the input, but you
CAN get wrapping in the output, in some formats.  E.g. HTML -- try
a super-long line in a pipe table, and you'll see that it wraps
in HTML.  It won't wrap in LaTeX, because the LaTeX table model
only allows you to wrap when you know how wide the cell is.
We can get that kind of information from multiline and grid
tables, but not from pipe tables, precisely because pipe tables
are limited to one line per row in the source.

John

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/eaf98c55-d526-4bdd-b7b5-c4269f7d81c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.