public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Richard Huntsinger <rhuntsinger-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: How to convert nested tables? | longtable vs tabular
Date: Thu, 21 Jul 2022 13:47:32 -0700 (PDT)	[thread overview]
Message-ID: <86743ae7-5d79-49be-becb-a1dac75e1ff9n@googlegroups.com> (raw)
In-Reply-To: <CAEe_xxh5=xr8=N2BunXCihUHBFbsXUVaPQF4qwuLjq8jLqNsLg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>


[-- 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 --]

      parent reply	other threads:[~2022-07-21 20:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19 20:32 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86743ae7-5d79-49be-becb-a1dac75e1ff9n@googlegroups.com \
    --to=rhuntsinger-tvlzxgkolnx2fbvcvol8/a@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).