public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Mixed zero and non-zero table column widths
@ 2019-08-06  9:32 BPJ
       [not found] ` <CADAJKhC5C0Jneasd5rBrB28Xn2cOviw+qNOfxQo3GT68M1sxuw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: BPJ @ 2019-08-06  9:32 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 1503 bytes --]

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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhC5C0Jneasd5rBrB28Xn2cOviw%2BqNOfxQo3GT68M1sxuw%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 2038 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Mixed zero and non-zero table column widths
       [not found] ` <CADAJKhC5C0Jneasd5rBrB28Xn2cOviw+qNOfxQo3GT68M1sxuw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2019-08-06 17:31   ` John MacFarlane
       [not found]     ` <yh480k8ss6w68u.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: John MacFarlane @ 2019-08-06 17:31 UTC (permalink / raw)
  To: BPJ, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhC5C0Jneasd5rBrB28Xn2cOviw%2BqNOfxQo3GT68M1sxuw%40mail.gmail.com.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Mixed zero and non-zero table column widths
       [not found]     ` <yh480k8ss6w68u.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2019-08-06 19:05       ` BPJ
       [not found]         ` <CADAJKhCAnGbkC3EO_CxD9owf-MJ8q4HwhbucY-vshBTBh04zqw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: BPJ @ 2019-08-06 19:05 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 3693 bytes --]

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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.

[-- Attachment #2: Type: text/html, Size: 5198 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Mixed zero and non-zero table column widths
       [not found]         ` <CADAJKhCAnGbkC3EO_CxD9owf-MJ8q4HwhbucY-vshBTBh04zqw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2019-08-08  9:22           ` 山本一貴
  0 siblings, 0 replies; 4+ messages in thread
From: 山本一貴 @ 2019-08-08  9:22 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

I was about to raise a bug report around this but seems not.

I am trying to specify column widths by a Lua filter for
HTML/Docx/latex outputs.

In my experience with HTML and Docx outputs, when widths contain zero
and non-zero values, pandoc honors given list for HTML.
But for Docx output it *drops* precessed table without any error
message. Latex output has not been tested.

Maybe a writer matter?

2019年8月7日(水) 4:05 BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>
> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.

-- 
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAPBn7nqOiH0xknndH58jhFp1BYLU4e-3KXywWssE1G8FTj0nHw%40mail.gmail.com.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-08  9:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-06  9:32 Mixed zero and non-zero table column widths BPJ
     [not found] ` <CADAJKhC5C0Jneasd5rBrB28Xn2cOviw+qNOfxQo3GT68M1sxuw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-08-06 17:31   ` John MacFarlane
     [not found]     ` <yh480k8ss6w68u.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2019-08-06 19:05       ` BPJ
     [not found]         ` <CADAJKhCAnGbkC3EO_CxD9owf-MJ8q4HwhbucY-vshBTBh04zqw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-08-08  9:22           ` 山本一貴

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).