You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am rendering a table in a PDF file using Quarto. If there is text is a row that is collapsed, it doesn't wrap properly when the column_spec width is specified. The table that I am trying to create has several columns and will overflow the page if the text in the first column is not wrapped.
Below is an example - I hope I have provided it in a useful way.
---
title: "test"
format:
html:
theme: cosmo
pdf:
documentclass: scrreprt
include-in-header:
text: |
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{array}
\usepackage{multirow}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{colortbl}
\usepackage{pdflscape}
\usepackage{tabu}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage[normalem]{ulem}
\usepackage{makecell}
\usepackage{xcolor}
docx: default
editor: visual
---
```{r, echo = F, message = F, warning=F}
text_tbl <- data.frame(
Items = c("Really really really really long column item here 1", "Really really really really long column item here 1", "Item 2"), Features = c(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vehicula tempor ex.",
"In eu urna at magna luctus rhoncus quis in nisl. Fusce in velit varius, posuere risus",
"Vivamus venenatis egestas eros ut tempus. Vivamus id est nisi. Aliquam molestie erat"
))
kbl(text_tbl, booktabs = T) %>% collapse_rows(columns = 1) %>%
kable_styling(full_width = T) %>%
column_spec(1, width = "10em")
Running the above in Quarto creates:
Thanks in advance for any insight
The text was updated successfully, but these errors were encountered:
\documentclass{article}
\usepackage{tabu}
\usepackage{booktabs}
\usepackage{multirow}
\begin{document}
\begin{tabu} to \linewidth {>{\raggedright\arraybackslash}p{10em}>{\raggedright}X}
\toprule
Items & Features\\\midrule
& Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vehicula tempor ex.\\\cmidrule{2-2}
\multirow{-2}{*}{\raggedright\arraybackslash Really really really really long column item here 1} & In eu urna at magna luctus rhoncus quis in nisl. Fusce in velit varius, posuere risus\\\cmidrule{1-2}
Item 2 & Vivamus venenatis egestas eros ut tempus. Vivamus id est nisi. Aliquam molestie erat\\\bottomrule\end{tabu}
\begin{tabu} to \linewidth {>{\raggedright\arraybackslash}p{10em}>{\raggedright}X}
\toprule
Items & Features\\\midrule
& Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vehicula tempor ex.\\\cmidrule{2-2}
\multirow{-2}{=}{\raggedright\arraybackslash Really really really really long column item here 1} & In eu urna at magna luctus rhoncus quis in nisl. Fusce in velit varius, posuere risus\\\cmidrule{1-2}
Item 2 & Vivamus venenatis egestas eros ut tempus. Vivamus id est nisi. Aliquam molestie erat\\\bottomrule\end{tabu}
\end{document}
Hello,
I am rendering a table in a PDF file using Quarto. If there is text is a row that is collapsed, it doesn't wrap properly when the column_spec width is specified. The table that I am trying to create has several columns and will overflow the page if the text in the first column is not wrapped.
Below is an example - I hope I have provided it in a useful way.
Running the above in Quarto creates:
Thanks in advance for any insight
The text was updated successfully, but these errors were encountered: