* How to convert nested tables? | longtable vs tabular @ 2022-07-19 20:32 Richard Huntsinger [not found] ` <a477931c-2479-47f4-9cf7-d5880a429a38n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Richard Huntsinger @ 2022-07-19 20:32 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 911 bytes --] I’ve successfully converted Jupyter HTML-format simple tables to LaTex-format tables using pandoc.read(raw.text, ‘html’).blocks in a lua filter. The resulting LaTex is \begin(longtable} … That’s 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)? Or is there some other solution to converting nested tables? -- 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/a477931c-2479-47f4-9cf7-d5880a429a38n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 1216 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <a477931c-2479-47f4-9cf7-d5880a429a38n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: How to convert nested tables? | longtable vs tabular [not found] ` <a477931c-2479-47f4-9cf7-d5880a429a38n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2022-07-19 21:01 ` Richard Huntsinger 2022-07-20 21:36 ` BPJ 1 sibling, 0 replies; 6+ messages in thread From: Richard Huntsinger @ 2022-07-19 21:01 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 1352 bytes --] I found a filter on an old thread that attempts to produce tabular tables rather than longtable tables, but as noted in the thread it does seem to work for all of us: https://groups.google.com/g/pandoc-discuss/c/RUC-tuu_qf0/m/h-H3RRVt1coJ Perhaps someone can provide a new working lua filter to produce tabular tables? MUCH appreciated. On Tuesday, July 19, 2022 at 1:32:47 PM UTC-7 Richard Huntsinger wrote: > I’ve successfully converted Jupyter HTML-format simple tables to > LaTex-format tables using pandoc.read(raw.text, ‘html’).blocks in a lua > filter. The resulting LaTex is \begin(longtable} … That’s 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)? Or is there some other > solution to converting nested tables? > -- 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/f8c8c8fe-036e-41f0-a2cb-c744ca96176cn%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 1866 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to convert nested tables? | longtable vs tabular [not found] ` <a477931c-2479-47f4-9cf7-d5880a429a38n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-07-19 21:01 ` Richard Huntsinger @ 2022-07-20 21:36 ` BPJ [not found] ` <CADAJKhDM2Q0S_fSQx3kpFg0kv4r2gYqR-rSHEE=CWhry37jM-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 1 sibling, 1 reply; 6+ messages in thread From: BPJ @ 2022-07-20 21:36 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1: Type: text/plain, Size: 1702 bytes --] Last time I looked Pandoc's AST couldn't represent nested tables anyway. Den tis 19 juli 2022 22:33Richard Huntsinger <rhuntsinger-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> skrev: > I’ve successfully converted Jupyter HTML-format simple tables to > LaTex-format tables using pandoc.read(raw.text, ‘html’).blocks in a lua > filter. The resulting LaTex is \begin(longtable} … That’s 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)? Or is there some other > solution to converting nested tables? > > -- > 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/a477931c-2479-47f4-9cf7-d5880a429a38n%40googlegroups.com > <https://groups.google.com/d/msgid/pandoc-discuss/a477931c-2479-47f4-9cf7-d5880a429a38n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CADAJKhDM2Q0S_fSQx3kpFg0kv4r2gYqR-rSHEE%3DCWhry37jM-A%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 2468 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CADAJKhDM2Q0S_fSQx3kpFg0kv4r2gYqR-rSHEE=CWhry37jM-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: How to convert nested tables? | longtable vs tabular [not found] ` <CADAJKhDM2Q0S_fSQx3kpFg0kv4r2gYqR-rSHEE=CWhry37jM-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2022-07-21 8:33 ` William Lupton [not found] ` <CAEe_xxh5=xr8=N2BunXCihUHBFbsXUVaPQF4qwuLjq8jLqNsLg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: William Lupton @ 2022-07-21 8:33 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 3486 bytes --] > Last time I looked Pandoc's AST couldn't represent nested tables anyway. Surely a table cell <https://pandoc.org/lua-filters.html#type-cell>'s contents is a list of blocks (which can include tables). What about this markdown example (butchered from two of the examples in the manual)? +---------------+---------------+--------------------+ | Fruit | Price | Advantages | +===============+===============+====================+ | 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 <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> wrote: > Den tis 19 juli 2022 22:33Richard Huntsinger <rhuntsinger-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> > skrev: > >> I’ve successfully converted Jupyter HTML-format simple tables to >> LaTex-format tables using pandoc.read(raw.text, ‘html’).blocks in a lua >> filter. The resulting LaTex is \begin(longtable} … That’s 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)? Or is there some other >> solution to converting nested tables? >> >> -- >> 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/a477931c-2479-47f4-9cf7-d5880a429a38n%40googlegroups.com >> <https://groups.google.com/d/msgid/pandoc-discuss/a477931c-2479-47f4-9cf7-d5880a429a38n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > 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/CADAJKhDM2Q0S_fSQx3kpFg0kv4r2gYqR-rSHEE%3DCWhry37jM-A%40mail.gmail.com > <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDM2Q0S_fSQx3kpFg0kv4r2gYqR-rSHEE%3DCWhry37jM-A%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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/CAEe_xxh5%3Dxr8%3DN2BunXCihUHBFbsXUVaPQF4qwuLjq8jLqNsLg%40mail.gmail.com. [-- Attachment #1.2: Type: text/html, Size: 5120 bytes --] [-- Attachment #2: Screenshot 2022-07-20 at 23.36.36.png --] [-- Type: image/png, Size: 83221 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CAEe_xxh5=xr8=N2BunXCihUHBFbsXUVaPQF4qwuLjq8jLqNsLg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: How to convert nested tables? | longtable vs tabular [not found] ` <CAEe_xxh5=xr8=N2BunXCihUHBFbsXUVaPQF4qwuLjq8jLqNsLg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2022-07-21 20:38 ` Richard Huntsinger 2022-07-21 20:47 ` Richard Huntsinger 1 sibling, 0 replies; 6+ messages in thread From: Richard Huntsinger @ 2022-07-21 20:38 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 4764 bytes --] I've come to better solution for getting Jupyter-displayable tables to LaTex. Use kable to create an HTML representation and use kable again to create a LaTex representation. Build a “mimebundle” list with these two representations as elements. Use IRdisplay’s publish_mimebundle function to display. The HTML representation will be rendered when running Jupyter; the LaTex representation will be copied as-is by pandoc when converting from Jupyter-format to LaTeX-format. x = data.frame(a=c(1,2,3), b=c(10,20,30), c=c(100,200,300)) x.html = kable(x, format=“html”, escape=FALSE, align=rep(“r”, ncol(x)), caption=“This is from HTML”, row.names=FALSE, table.attr=“style="white-space: nowrap;"”) x.latex = kable_styling(latex_options=c(“hold_position”), kable(x, format=“latex”, escape=FALSE, align=rep(“r”, ncol(x)), caption=“This is from LaTex”, row.names=FALSE)) mbx = list(data=list(“text/html”=as.character(x.html), “text/latex”=as.character(x.latex)), metadata=NULL) 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 wrote: > > Last time I looked Pandoc's AST couldn't represent nested tables anyway. > > Surely a table cell <https://pandoc.org/lua-filters.html#type-cell>'s > contents is a list of blocks (which can include tables). What about this > markdown example (butchered from two of the examples in the manual)? > > +---------------+---------------+--------------------+ > | Fruit | Price | Advantages | > +===============+===============+====================+ > | 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 <b...-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> wrote: > > >> Den tis 19 juli 2022 22:33Richard Huntsinger <rhunt...-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> >> skrev: >> >>> I’ve successfully converted Jupyter HTML-format simple tables to >>> LaTex-format tables using pandoc.read(raw.text, ‘html’).blocks in a lua >>> filter. The resulting LaTex is \begin(longtable} … That’s 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)? Or is there some other >>> solution to converting nested tables? >>> >>> -- >>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/pandoc-discuss/a477931c-2479-47f4-9cf7-d5880a429a38n%40googlegroups.com >>> <https://groups.google.com/d/msgid/pandoc-discuss/a477931c-2479-47f4-9cf7-d5880a429a38n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDM2Q0S_fSQx3kpFg0kv4r2gYqR-rSHEE%3DCWhry37jM-A%40mail.gmail.com >> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDM2Q0S_fSQx3kpFg0kv4r2gYqR-rSHEE%3DCWhry37jM-A%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- 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/274c5feb-0e57-4290-ae73-85c22e6b6710n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 7504 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to convert nested tables? | longtable vs tabular [not found] ` <CAEe_xxh5=xr8=N2BunXCihUHBFbsXUVaPQF4qwuLjq8jLqNsLg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2022-07-21 20:38 ` Richard Huntsinger @ 2022-07-21 20:47 ` Richard Huntsinger 1 sibling, 0 replies; 6+ messages in thread From: Richard Huntsinger @ 2022-07-21 20:47 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 4631 bytes --] 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 rendered when running Jupyter; the LaTex representation will be copied as-is by pandoc when converting from Jupyter-format to LaTeX format. x = data.frame(a=c(1,2,3), b=c(10,20,30), c=c(100,200,300)) x.html = kable(x, format=“html”, escape=FALSE, align=rep(“r”, ncol(x)), caption=“This is from HTML”, row.names=FALSE, table.attr=“style="white-space: nowrap;"”) x.latex = kable_styling(latex_options=c(“hold_position”), kable(x, format=“latex”, escape=FALSE, align=rep(“r”, ncol(x)), caption=“This is from LaTex”, row.names=FALSE)) mbx = list(data=list(“text/html”=as.character(x.html), “text/latex”=as.character(x.latex)), metadata=NULL) 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 wrote: > > Last time I looked Pandoc's AST couldn't represent nested tables anyway. > > Surely a table cell <https://pandoc.org/lua-filters.html#type-cell>'s > contents is a list of blocks (which can include tables). What about this > markdown example (butchered from two of the examples in the manual)? > > +---------------+---------------+--------------------+ > | Fruit | Price | Advantages | > +===============+===============+====================+ > | 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 <b...-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> wrote: > > >> Den tis 19 juli 2022 22:33Richard Huntsinger <rhunt...-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> >> skrev: >> >>> I’ve successfully converted Jupyter HTML-format simple tables to >>> LaTex-format tables using pandoc.read(raw.text, ‘html’).blocks in a lua >>> filter. The resulting LaTex is \begin(longtable} … That’s 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)? Or is there some other >>> solution to converting nested tables? >>> >>> -- >>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/pandoc-discuss/a477931c-2479-47f4-9cf7-d5880a429a38n%40googlegroups.com >>> <https://groups.google.com/d/msgid/pandoc-discuss/a477931c-2479-47f4-9cf7-d5880a429a38n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDM2Q0S_fSQx3kpFg0kv4r2gYqR-rSHEE%3DCWhry37jM-A%40mail.gmail.com >> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDM2Q0S_fSQx3kpFg0kv4r2gYqR-rSHEE%3DCWhry37jM-A%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- 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/86743ae7-5d79-49be-becb-a1dac75e1ff9n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 7363 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-07-21 20:47 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-07-19 20:32 How to convert nested tables? | longtable vs tabular Richard Huntsinger [not found] ` <a477931c-2479-47f4-9cf7-d5880a429a38n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-07-19 21:01 ` Richard Huntsinger 2022-07-20 21:36 ` BPJ [not found] ` <CADAJKhDM2Q0S_fSQx3kpFg0kv4r2gYqR-rSHEE=CWhry37jM-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2022-07-21 8:33 ` William Lupton [not found] ` <CAEe_xxh5=xr8=N2BunXCihUHBFbsXUVaPQF4qwuLjq8jLqNsLg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2022-07-21 20:38 ` Richard Huntsinger 2022-07-21 20:47 ` Richard Huntsinger
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).