Open sjgenco opened 3 years ago
This is certainly something I would like to improve but I'm fairly short with time. For HTML table, a temporary solution is provided here: https://stackoverflow.com/questions/46531571/how-do-i-format-an-r-table-in-an-r-jupyter-notebook/46532394#46532394 (note that not all features are available because it won't load css)
For latex, jupyter's latex engine isn't as flexible as rmarkdown's engine. I haven't got a chance to look closer though.
Description
I posted this yesterday as a JupyterLab issue (https://github.com/jupyterlab/jupyterlab/issues/10290#issue-901554910), but I thought I should post it here as well. I don't think this is a Kable problem, but wanted to cover both bases.
I'm trying to generate nice-looking tables in JupyterLab using
library(kableExtra)
All the simple examples from theknitr::kable
site work fine in RStudio but only producexmlhtml output in JupyterLab. I haven't found anything here in 'Issues' or elsewhere on the web that hints at a solution. Surprising to me, since this seems pretty fundamental.Reproduce
To reproduce, run this code snippet used for examples on the KableExtras site (after
install.packages("kableExtra")
of course ...If you run this in RStudio, you get this result in the Viewer.
But if you run it in JupyterLab (versions & environment are described in the original post), you get this result (truncated here). It's just outputting the html, not converting it into a formatted table, as it should.
That's the issue.
Expected behavior
I expected the table to format properly in JupyterLab, like in RStudio
Context
I've read that this problem may relate to the problem with trying to export a JupyterLab notebook to PDF. I had that problem too. Read a lot about
pandoc
andnbconvert
andxelatex
and gettingxelatex
into the$PATH
. Just want to note that I have installed latest versions of MacTex and all those pkgs, and xelatex IS in my PATH:By the way, the 'Export Notebook as ... PDF' still doesn't work inside JupyterLab, giving the familiar (and apparently incorrect) error:
nbconvert failed: xelatex not found on PATH, if you have not installed xelatex you may need to do so.
But I can get that export to work when I run it from the command line in terminal:jupyter nbconvert --to PDF notebook.ipynb
which is another indication that all the pieces are in place, JupyterLab is simply not doing the expected conversions.Thanks for any ideas you might have!