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'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  |    |
+---------------+---------------+--------------------+


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