-
Notifications
You must be signed in to change notification settings - Fork 404
Description
Bug description
Originally raised here and possibly related but it was suggested to open a new issue. That problem was related to pandoc's handling of docx files and was fixed by pandoc for that format. This maybe a similar problem, IDK.
I was trying to control the overall table width of a kable-generated html table in a website project. I tried to specify tbl-colwidths in the chunk but this was ignored. Then I tried the kable_styling(full_width = FALSE) which normally does a good job of adjusting overall width and individual column width, but this was also ignored.
It appears the settings are ignored or perhaps overridden. At least in the case of tbl-colwidths I can see the information passed to the html in the page source but it looks like it is echoed there and not really used (my best guess).
Steps to reproduce
_quarto.yml
project:
title: "test"
type: "website"
test.qmd
---
title: "Two Ways to Handle Table Width Using kable; Neither Works"
---
@tbl-results1 shows how to control the table column widths; however, the settings seem to be ignored. At the same time, another way to control this with `kable` doesn't work either, see @tbl-results2.
```{r}
#| echo: false
library("kableExtra")
library("magrittr")
```
```{r}
#| label: tbl-results1
#| tbl-cap: "mtcars using colwidths doesn't work."
#| tbl-colwidths: [15, 15, 15, 15]
kable(mtcars[,1:3]) %>%
kable_styling(c("striped", "bordered"))
```
```{r}
#| label: tbl-results2
#| tbl-cap: "mtcars with full_width = FALSE doesn't work."
kable(mtcars[,1:3]) %>%
kable_styling(c("striped", "bordered"), full_width = FALSE)
```
Expected behavior
I want the table column widths to shrink to contain the contents w/o a lot of white space, and in turn, this will make the table overall narrower.
Actual behavior
Right now the table occupies the full width with a lot of white space.
Your environment
-IDE: command line
-OS: MacOS 12.6.7
Quarto check output
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.1.2: OK
Dart Sass version 1.55.0: OK
Deno version 1.33.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 99.9.9
Path: /Users/bryanhanson/Documents/Professional/Research/R_Pkgs/quarto-cli/package/dist/bin
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.11.2
Path: /usr/local/opt/python@3.11/bin/python3.11
Jupyter: (None)
Jupyter is not available in this Python installation.
Install with python3 -m pip install jupyter
[✓] Checking R installation...........OK
Version: 4.3.0
Path: /Library/Frameworks/R.framework/Resources
LibPaths:
- /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library
knitr: 1.43
rmarkdown: 2.22
[✓] Checking Knitr engine render......OK