Thanks, that's what I thought. My filter converts back and forth between tables and lists of lists. Currently I have column widths default to 1 divided by the number of columns, or if some column widths are specified (through  an attribute on an enclosing div) the last specified width is repeated as needed. I'll stick to that since cells sometimes do have block content; in fact that and making it easier to (re)move and inserting columns is the main rationale for editing tables as lists of lists.

I actually convert between percentages and floats, so the width attribute the user sees is actually a "list" of integers which I divide by 100 when generating the table. When going in the opposite direction I multiply the floats by 100 and floor the result. When looking at the table widths in the serialized AST the floats often have very many decimals. Do the writers actually care about all those decimals? I guess not but I wouldn't want columns to get significantly narrower for each conversion, as they might do if the `original_width * 100` is floored many times. Perhaps I should take the trouble to round to the nearest integer (i.e. add 0.5 before flooring)?

Den tis 6 aug. 2019 19:31John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> skrev:

Yes, that's right; it's implemented in pandoc.
The auto-width thing only works when the table cells
are "simple" (containing no block elements that need
to wrap), and all the widths must be 0.  (I'm actually
not sure what happens when only some are; the types allow
that but they really shouldn't.)

BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> I'm trying to build tables programmatically in a filter.
>
> It seems as if all column widths are specified as 0.0 Pandoc will calculate
> optimal column widths based on the length of cell contents and the
> available space. Is this correct?
>
> It also seems that if a column width is an explicit non-zero float Pandoc
> will set the width of that column as specified so that the width of the
> column is the available space multiplied by the specified float, such that
> if the float is e.g. 0.4 the width of the column is 40% of the available
> width and if the sum of the specified widths is greater than 1 the table
> will be wider than the available width. Is this correct?
>
> Is the above behavior, assuming I have understood it correctly, implemented
> in Pandoc or in LaTeX?
>
> What happens, specifically to the columns for which a zero value is
> specified, if some of the specified column widths are zero and some are
> non-zero? I guess that the available space if any remains after subtracting
> the non-zero widths is distributed among the zero-width columns, or do they
> become truly zero-width?
>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhC5C0Jneasd5rBrB28Xn2cOviw%2BqNOfxQo3GT68M1sxuw%40mail.gmail.com.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhCAnGbkC3EO_CxD9owf-MJ8q4HwhbucY-vshBTBh04zqw%40mail.gmail.com.