From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31059 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Richard Huntsinger Newsgroups: gmane.text.pandoc Subject: Re: How to convert nested tables? | longtable vs tabular Date: Thu, 21 Jul 2022 13:47:32 -0700 (PDT) Message-ID: <86743ae7-5d79-49be-becb-a1dac75e1ff9n@googlegroups.com> References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_508_498461192.1658436453000" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35430"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCFYNC6M64FBBVX25GLAMGQEVSWXSHY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri Jul 22 12:35:06 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-yw1-f191.google.com ([209.85.128.191]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oEpzt-00091S-Nf for gtp-pandoc-discuss@m.gmane-mx.org; Fri, 22 Jul 2022 12:35:06 +0200 Original-Received: by mail-yw1-f191.google.com with SMTP id 00721157ae682-31cb93cadf2sf36265767b3.11 for ; Fri, 22 Jul 2022 03:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=ugD3OYD2LRnWG725AZukjARE4rBLnhQh19Sg7Fq/V5s=; b=DrdXYthSIRnsPojtQW3LApID+kSd/zzL1sXuFOOIehvfPn2589kvdyT4ysnvaZqZTz eqoAgg9GQWl1CZCjopwtcjN43dU67WRwd0PYbytTUahrNEIxTSHl2Dz6wvRyW+wc2y1y 7JtZ8ksnW5T/ZxNnARSoMfw2viJ8CiLAwf+M65wIIDUaTtuM7tqAV93p6A103Mq76naW 3QIvh2zOvEXkk2DoxmZcsNORaSkOctIA39DhscWoreLmA5xMOXsJ0z3TnDsaNqyZ9jvK IfU6YwBpH9g6ZL93XZ1/jxQJYqNElitH7phISUTZTGbrUSuTHqij9ud8ZgA7rwqIyMK3 9hjQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=berkeley.edu; s=google; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=ugD3OYD2LRnWG725AZukjARE4rBLnhQh19Sg7Fq/V5s=; b=NzWyDf88OJ4KE8v+0Vt5PUEHTYgos33AZ5TtSCuG/PQUI5JQEInViJrBUlS7bSV+3X RzvU95ctnLLpfknIOKrvZxkaOr+5s1KjXtMbK8MvpUUsHHVmVjetk8rcKfiKAIdIA8iJ FnfGd/SGJd6PaI4RUtuF4MAcFMioZgc9yf0mRP6jfbCCUD+Ry+dRqrDYhojRiKjboiRt f5aKRQ4UKXFZTkF4RobXptCIWSZrkKvbp/i8RWvljHcS7zYjl5cQB/qsa8iHkxbnRvbc +fFuVFd8l4bDq0zx6hPBzfenUrAaDlYKZD7CIlACr8IWw4IX3CsbGjqCE272dJSEtaoc nu4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=ugD3OYD2LRnWG725AZukjARE4rBLnhQh19Sg7Fq/V5s=; b=ISCfZagGx3c/W+WVlw75ZtkG/uOiWuYMg8IZftIYbYPs7+o9wOAZ5iPdC2EfaLNxZ8 TspTZz0bjO6DdSMtZp31agdus2d2JShbeNy80F2FvlWfuqk4D/7gwzq1R0OY8oedAbrp tpxgs5+cFWWtLTcsIdz9kLRpMPapwE0uen6GSd8MHSdrreWbm8VTe4mrclsBC5y35XUD R79LaYTjag9QNlJfd6CPbaVdAEAqNHEhrd9Ds+60RmJi/+6aKDa/8Ant8aqkiLxw/jGv HV2kOHBKdlrA4fWgiGy1sGJ8KVZWk5N5Hb41cO5OrLkqP+svaVqszzi34FykCtMuSh2+ UkIw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AJIora9e9+mouyh0k5u56FBvcmO5VbKKN6TLoj9TVSj0/ahn0IMj0EFT 4+8LFHKFHXZFOiO/r9i7M1s= X-Google-Smtp-Source: AGRyM1sS/Tgxemheg+TS8t7ra2l/P+wy07DnNytv0E4X8yRLokTCwPJJY0WQhFVdhWeW4x0cR+FL2g== X-Received: by 2002:a81:19d0:0:b0:31e:73d2:53f8 with SMTP id 199-20020a8119d0000000b0031e73d253f8mr2508267ywz.493.1658486104542; Fri, 22 Jul 2022 03:35:04 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:690c:39e:b0:2fe:dfec:f7d8 with SMTP id bh30-20020a05690c039e00b002fedfecf7d8ls2611055ywb.5.-pod-prod-gmail; Fri, 22 Jul 2022 03:35:02 -0700 (PDT) X-Received: by 2002:a81:7bd4:0:b0:31e:725c:d853 with SMTP id w203-20020a817bd4000000b0031e725cd853mr2484768ywc.8.1658486102306; Fri, 22 Jul 2022 03:35:02 -0700 (PDT) Original-Received: by 2002:a81:ac65:0:b0:31c:86a0:d566 with SMTP id 00721157ae682-31e9b03407cms7b3; Thu, 21 Jul 2022 13:47:34 -0700 (PDT) X-Received: by 2002:a5b:982:0:b0:63e:7d7e:e2f2 with SMTP id c2-20020a5b0982000000b0063e7d7ee2f2mr319791ybq.549.1658436453731; Thu, 21 Jul 2022 13:47:33 -0700 (PDT) In-Reply-To: X-Original-Sender: rhuntsinger-TVLZxgkOlNX2fBVCVOL8/A@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.io gmane.text.pandoc:31059 Archived-At: ------=_Part_508_498461192.1658436453000 Content-Type: multipart/alternative; boundary="----=_Part_509_759363919.1658436453000" ------=_Part_509_759363919.1658436453000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I've come to better overall solution. Rather than have pandoc convert HTML= =20 tables to LaTex tables, I've coded the tables in both HTML and LaTex format= =20 within the Jupyter notebook. The HTML representation will be rendered when= =20 running Jupyter; the LaTex representation will be copied as-is by pandoc=20 when converting from Jupyter-format to LaTeX format. x =3D data.frame(a=3Dc(1,2,3), b=3Dc(10,20,30), c=3Dc(100,200,300)) x.html =3D kable(x, format=3D=E2=80=9Chtml=E2=80=9D, escape=3DFALSE, align= =3Drep(=E2=80=9Cr=E2=80=9D, ncol(x)),=20 caption=3D=E2=80=9CThis is from HTML=E2=80=9D, row.names=3DFALSE,=20 table.attr=3D=E2=80=9Cstyle=3D"white-space: nowrap;"=E2=80=9D) x.latex =3D kable_styling(latex_options=3Dc(=E2=80=9Chold_position=E2=80=9D= ), kable(x, format=3D=E2=80=9Clatex=E2=80=9D, escape=3DFALSE, align=3Drep(=E2= =80=9Cr=E2=80=9D, ncol(x)),=20 caption=3D=E2=80=9CThis is from LaTex=E2=80=9D, row.names=3DFALSE)) mbx =3D list(data=3Dlist(=E2=80=9Ctext/html=E2=80=9D=3Das.character(x.html)= ,=20 =E2=80=9Ctext/latex=E2=80=9D=3Das.character(x.latex)), metadata=3DNULL) publish_mimebundle(mbx$data, mbx$metadata) On Thursday, July 21, 2022 at 1:33:34 AM UTC-7 wlu...-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org= =20 wrote: > > Last time I looked Pandoc's AST couldn't represent nested tables anyway= . > > Surely a table cell 's=20 > contents is a list of blocks (which can include tables). What about this= =20 > markdown example (butchered from two of the examples in the manual)? > > +---------------+---------------+--------------------+ > | Fruit | Price | Advantages | > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D+ > | Bananas | $1.34 | - built-in wrapper | > | | | - bright color | > +---------------+---------------+--------------------+ > | Oranges | $2.10 | - cures scurvy | > | | | - tasty | > +---------------+---------------+--------------------+ > | Apple (pi) | $3.14 | | One | Two | | > | | | |-----+-------| | > | | | | my | table | | > | | | | is | nice | | > +---------------+---------------+--------------------+ > > [image: Screenshot 2022-07-20 at 23.36.36.png] > > On Wed, 20 Jul 2022 at 22:37, BPJ wrote: > =20 > >> Den tis 19 juli 2022 22:33Richard Huntsinger =20 >> skrev: >> >>> I=E2=80=99ve successfully converted Jupyter HTML-format simple tables t= o=20 >>> LaTex-format tables using pandoc.read(raw.text, =E2=80=98html=E2=80=99)= .blocks in a lua=20 >>> filter. The resulting LaTex is \begin(longtable} =E2=80=A6 That=E2=80= =99s okay for simple=20 >>> tables, but longtable does not support nested tables, which I do need. >>> >>> How to convert to LaTex tabular tables (which supports nested tables)= =20 >>> rather than to longtable tables (which does not)? Or is there some oth= er=20 >>> solution to converting nested tables?=20 >>> >>> --=20 >>> You received this message because you are subscribed to the Google=20 >>> Groups "pandoc-discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send= =20 >>> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To view this discussion on the web visit=20 >>> https://groups.google.com/d/msgid/pandoc-discuss/a477931c-2479-47f4-9cf= 7-d5880a429a38n%40googlegroups.com=20 >>> >>> . >>> >> --=20 >> You received this message because you are subscribed to the Google Group= s=20 >> "pandoc-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send a= n=20 >> email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > To view this discussion on the web visit=20 >> https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDM2Q0S_fSQx3kpFg= 0kv4r2gYqR-rSHEE%3DCWhry37jM-A%40mail.gmail.com=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 view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/86743ae7-5d79-49be-becb-a1dac75e1ff9n%40googlegroups.com. ------=_Part_509_759363919.1658436453000 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I've come to better overall solution.  Rather than have pandoc convert= HTML tables to LaTex tables, I've coded the tables in both HTML and LaTex = format within the Jupyter notebook.  The HTML representation will be r= endered when running Jupyter; the LaTex representation will be copied as-is= by pandoc when converting from Jupyter-format to LaTeX format.

x = =3D data.frame(a=3Dc(1,2,3), b=3Dc(10,20,30), c=3Dc(100,200,300))
x.html= =3D kable(x, format=3D=E2=80=9Chtml=E2=80=9D, escape=3DFALSE, align=3Drep(= =E2=80=9Cr=E2=80=9D, ncol(x)), caption=3D=E2=80=9CThis is from HTML=E2=80= =9D, row.names=3DFALSE, table.attr=3D=E2=80=9Cstyle=3D"white-space: nowrap;= "=E2=80=9D)
x.latex =3D kable_styling(latex_options=3Dc(=E2=80=9Chold_po= sition=E2=80=9D),
kable(x, format=3D=E2=80=9Clatex=E2=80=9D, escape=3DFA= LSE, align=3Drep(=E2=80=9Cr=E2=80=9D, ncol(x)), caption=3D=E2=80=9CThis is = from LaTex=E2=80=9D, row.names=3DFALSE))
mbx =3D list(data=3Dlist(=E2=80= =9Ctext/html=E2=80=9D=3Das.character(x.html), =E2=80=9Ctext/latex=E2=80=9D= =3Das.character(x.latex)), metadata=3DNULL)
publish_mimebundle(mbx$data,= mbx$metadata)


On Thursday, July 21, 2022 at 1:33:34 AM UTC-7 wlu...@br= oadband-forum.org wrote:
> Last time I looked Pand= oc's AST couldn't represent nested tables anyway.

Surely a table cell&= #39;s contents is a list of blocks (which can include tables). What about t= his markdown example (butchered from two of the examples in the manual)?

+---------------+---------------+--------------------+
| Fruit =C2=A0 = =C2=A0 =C2=A0 =C2=A0 | Price =C2=A0 =C2=A0 =C2=A0 =C2=A0 | Advantages =C2= =A0 =C2=A0 =C2=A0 =C2=A0 |
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+
| Bananas =C2=A0 =C2=A0 =C2=A0 | $= 1.34 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | - built-in wrapper |
| =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 | - bright color =C2=A0 =C2=A0 |
+---------------+-----------= ----+--------------------+
| Oranges =C2=A0 =C2=A0 =C2=A0 | $2.10 =C2=A0= =C2=A0 =C2=A0 =C2=A0 | - cures scurvy =C2=A0 =C2=A0 |
| =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 | - tasty =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|
+-------= --------+---------------+--------------------+
| Apple (pi)=C2=A0 =C2=A0= | $3.14 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | | One | Two =C2=A0 | =C2=A0 =C2=A0|<= br>| =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | |-----+-------| =C2=A0 =C2=A0|
| =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 | | my =C2=A0| table | =C2=A0 =C2=A0|
| =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 | | is =C2=A0| nice =C2=A0| =C2=A0 =C2=A0|
+-------------= --+---------------+--------------------+


3D"Screenshot

<= /div>
On Wed, 20 Jul 2022 at 22:37, BPJ <b...-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> wrote:
=C2=A0=
Den tis 19 juli 2022 22:33Richard Huntsinger <= ;rhunt...-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> s= krev:

I=E2=80= =99ve successfully converted Jupyter HTML-format simple tables to LaTex-format tables using pandoc.read(raw.text, =E2=80=98html=E2=80=99).= blocks in a lua filter.=C2=A0 The resulting LaTex is \begin(longtable} =E2=80=A6=C2=A0 That=E2=80=99s okay for simple tables, but longtable does not support nested tables, which I do need.

How to convert to LaTex tabular tables (which supports nested tables) rather than to longtable tables (which does not)?=C2=A0 Or is there= some other solution to converting nested tables?=C2=A0

--
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 pandoc-discus= ...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/a= 477931c-2479-47f4-9cf7-d5880a429a38n%40googlegroups.com.

--
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 pandoc-discus...@googleg= roups.com.

--
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 view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/86743ae7-5d79-49be-becb-a1dac75e1ff9n%40googlegroups.= com.
------=_Part_509_759363919.1658436453000-- ------=_Part_508_498461192.1658436453000--