From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/11833 Path: news.gmane.org!not-for-mail From: zozlak Newsgroups: gmane.text.pandoc Subject: Re: markdown table to latex Date: Mon, 26 Jan 2015 02:22:00 -0800 (PST) Message-ID: References: <20130418160530.GD14449@protagoras.phil.berkeley.edu> <20130418210736.GA23171@protagoras.phil.berkeley.edu> <01591b2e-0778-4ce2-92de-054017d7167c@googlegroups.com> <13B734F7F04528837D331704@[192.168.1.50]> <6c489635-2188-4c98-91f5-e1c88c24fddc@googlegroups.com> <20140110044025.GA30115@Johns-MacBook-Pro.local> <713e18de-0001-41d3-96c3-befb77f34cba@googlegroups.com> <20140503053719.GA24787@berkeley.edu> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_214_1083301891.1422267720580" X-Trace: ger.gmane.org 1422267732 1393 80.91.229.3 (26 Jan 2015 10:22:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 Jan 2015 10:22:12 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCX4RVUGZEERBSNKTCTAKGQEMVZQE2Y-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Jan 26 11:22:11 2015 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-yh0-f61.google.com ([209.85.213.61]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YFgny-0004ds-DA for gtp-pandoc-discuss@m.gmane.org; Mon, 26 Jan 2015 11:22:02 +0100 Original-Received: by mail-yh0-f61.google.com with SMTP id 29sf1611822yhl.6 for ; Mon, 26 Jan 2015 02:22:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :content-type:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe; bh=Ozy5CWpLQHXnhqayk9alWTEAK/KSZDsPsbZkzbu10iY=; b=nH5GL/q7YLTjfWCxgAh8TRiRojc69aPFhDZxqc42DLqX9O52ck+4rH+n2ADZhZbM+f neWMFKs82UE4EhhN7y9BbIWpyOp+cYjPIy59aBDXPEIsglaGTdjzc7J9A0f2+gm+xi44 qzM/V0bO3WE0gy/HoegkEG7lK++TDr8ZAxTj5w1BzoCdqV+q8BIZ3CxA14l+M32QAh6S 1HJhhZb6AmJM6CbDO2snQTQs82UDR7BJjTM2tgT2V0JiqCsU+l72EizX5+7yxg41PSbM ItR8OsBmKA55DTHXqchruBWeQnWbM/LmERUE1df8x6zsjH6hU3T7SSqDORxLUZ3vnJP4 20xA== X-Received: by 10.140.83.41 with SMTP id i38mr67076qgd.11.1422267721342; Mon, 26 Jan 2015 02:22:01 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.140.104.15 with SMTP id z15ls295683qge.24.gmail; Mon, 26 Jan 2015 02:22:00 -0800 (PST) X-Received: by 10.140.21.146 with SMTP id 18mr126585qgl.28.1422267720951; Mon, 26 Jan 2015 02:22:00 -0800 (PST) In-Reply-To: <20140503053719.GA24787-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> X-Original-Sender: zozlak-UeUFTVLdLX0dnm+yROfE0A@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:11833 Archived-At: ------=_Part_214_1083301891.1422267720580 Content-Type: multipart/alternative; boundary="----=_Part_215_688522771.1422267720580" ------=_Part_215_688522771.1422267720580 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable W dniu sobota, 3 maja 2014 07:37:19 UTC+2 u=C5=BCytkownik John MacFarlane= =20 napisa=C5=82:=20 > the LaTeX table model=20 > only allows you to wrap when you know how wide the cell is.=20 > We can get that kind of information from multiline and grid=20 > tables, but not from pipe tables, precisely because pipe tables=20 > are limited to one line per row in the source.=20 > I understand that in multiline and grid tables we can know proportions of= =20 column widths (and compare them to the output page width and calculate the= =20 exact widths) just after reading the first row (typically a header) of the= =20 table but it seems to me that for pipe table it is also possible (while may= =20 require analysis of all rows of the table). In the pipe tables a question arises - as columns width in each row may=20 vary which cell's width in each column should we use to calculate columns= =20 width proportions. There might be many answers: 1. Use column widths from the table header (or the first row it the does=20 not have a header) Benefits: - easy to predict column widths in the output (we know it depends only= =20 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= =20 table in a markdown source has to be adjusted) - simple Drawbacks: - need to manually adjust a first row of a table to achieve a=20 good-looking tables with sparse long cells 2. Calculate column widths in a more sophisticated way (e.g. like it is=20 being done in browser when rendering HTML table). An example algorithm can be: Calculate the maximum width of each column and= =20 a width of the longest word in each column (denote Wmin). Calculate the=20 width of each column using proportions of their maximum widths. Compare it= =20 with the Wmin of each column - if it is lower than Wmin, assume column=20 width of Wmin. Repeat calculation omitting columns which width was already= =20 set to Wmin until there are no columns left or no column was given a width= =20 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=20 source - difficult to adjust (in a predictable way) a layout of the table in= =20 the output - more complicated to implement =20 Mateusz W dniu sobota, 3 maja 2014 07:37:19 UTC+2 u=C5=BCytkownik John MacFarlane= =20 napisa=C5=82: > > Distinguish wrapping in input and wrapping in output. In a grid=20 > or multiline table, you may have to wrap lines in the markdown=20 > source, but that is independent of wrapping in the output. In=20 > general, the lines will be wrapped differently in the output.=20 > > In a pipe table, you can't have wrapping in the input, but you=20 > CAN get wrapping in the output, in some formats. E.g. HTML -- try=20 > a super-long line in a pipe table, and you'll see that it wraps=20 > in HTML. It won't wrap in LaTeX, because the LaTeX table model=20 > only allows you to wrap when you know how wide the cell is.=20 > We can get that kind of information from multiline and grid=20 > tables, but not from pipe tables, precisely because pipe tables=20 > are limited to one line per row in the source.=20 > > John=20 > --=20 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 e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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. ------=_Part_215_688522771.1422267720580 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
W dniu sobota, 3 maja 2014 07:37:19 UTC+2 u=C5=BCytko= wnik John MacFarlane napisa=C5=82:
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=20 can know proportions of column widths (and compare them to the output=20 page width and calculate the exact widths) just after reading the first=20 row (typically a header) of the table but it seems to me that for pipe=20 table it is also possible (while may require a= nalysis of all rows of the table).=
In the pipe tables a question arises - as columns width in each row may=20 vary which cell's width in each column should we use to calculate=20 columns width proportions. There might be many answers:

1. Use colum= n widths from the table header (or the first row it the does not have a hea= der)
  Benefits:
    - easy to predict column wid= ths 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 t= he output (only the first row of a table in a markdown source has to be adj= usted)
    - simple
  Drawbacks:
  &= nbsp; - need to manually adjust a first row of a table to achieve a good-lo= oking tables with sparse long cells

2. Calculate column widths in a = more sophisticated way (e.g. like it is being done in browser when rend= ering HTML table).
An example algorithm can be: Calculate the maximum width of each column=20 and a width of the longest word in each column (denote Wmin). Calculate=20 the width of each column using proportions of their maximum widths.=20 Compare it with the Wmin of each column - if it is lower than Wmin,=20 assume column width of Wmin. Repeat calculation omitting columns which=20 width was already set to Wmin until there are no columns left or no=20 column was given a width of Wmin in the last step.
  Benefits:
&= nbsp;   - 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 p= redictable 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=C5=BCytkownik John MacFarlane nap= isa=C5=82:
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 &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-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.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_215_688522771.1422267720580-- ------=_Part_214_1083301891.1422267720580--