Using gt tables in PDF #6074
Replies: 2 comments 1 reply
-
CSS is for HTML, so very unlikely someone will ever translate all the specs into LaTeX. Regarding the remaining of your "question", providing a reproducible example would help. Could you share a small self-contained "working" (reproducible) example to work with, i.e., a complete Quarto document or a Git repository? Thanks. You can share a Quarto document using the following syntax, i.e., using more backticks than you have in your document (usually four ````qmd
---
title: "Reproducible Quarto Document"
format: html
---
This is a reproducible Quarto document using `format: html`.
It is written in Markdown and contains embedded R code.
When you run the code, it will produce a plot.
```{r}
plot(cars)
```
The end.
```` |
Beta Was this translation helpful? Give feedback.
-
Just a note that this could be considered as an issue to be reported in gt - cc @rich-iannone |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Is there any way to include a gt table in a PDF generated by Quarto that preserves the inline css formatting? The gt tables display beautifully when rendered as an HTML file, but when rendering to PDF, I get a LaTeX compilation error about "Misplaced \noalign" for \midrule. If I output the gt table as raw html, it will display in the PDF without any errors but it also loses the css formatting of the lines, the text bolding and colors, etc. I have tried turning on and off various Quarto options, deleting the tables.tex file, changing knitr options, etc, but nothing fixes the problem. I have had to resort to saving the gt table as an image and then displaying the image as a figure, but that prevents long tables from printing across multiple pages. (If I output the gt table as raw html, the LaTeX code uses \longtable and that works, but then the table formatting that is stored as css is gone.) I have looked for other discussions about this and I've seen references to gt not working well in pdfs, but I can't tell if there is a solution somewhere that I could use.
Beta Was this translation helpful? Give feedback.
All reactions