-
Notifications
You must be signed in to change notification settings - Fork 218
Closed
Labels
Milestone
Description
It seems that specified column widths are not porting to longtable in LaTeX when knitting to PDF from gt.
Here's my sample code:
grades_table<-tribble(
~Minimum, ~Maximum, ~Grade,
#--|--|----
90,100,"A+",
85,89.99,"A",
80,84.99,"A-"
)
gt_test<-grades_table %>% gt()%>%
tab_header(
title = md("Grade mapping table"),
subtitle = "Percentages will correspond to letter grades as follows:"
) %>%
cols_width(
starts_with("M") ~ px(200),
everything() ~ px(200)
)%>% cols_align(align = "center")%>%
tab_source_note(md("NB: In the event that overall percentages are lower than expected, your grade may end up above those posted here, but will not end up below."))%>% as_latex()
gt_testWhen I look at the generated latex code, the cols_width specifications don't come through:
\captionsetup[table]{labelformat=empty,skip=1pt}
\begin{longtable}{ccc}
\caption*{
\large Grade mapping table\\
\small Percentages will correspond to letter grades as follows:\\
} \\
\toprule
Minimum & Maximum & Grade \\
\midrule
90 & 100.00 & A+ \\
85 & 89.99 & A \\
80 & 84.99 & A- \\
\bottomrule
\end{longtable}
\begin{minipage}{\linewidth}
NB: In the event that overall percentages are lower than expected, your grade may end up above those posted here, but will not end up below.\\
\end{minipage}
It seems that longtable is a bit fussy about alignments and widths, but it seems like the \begin{longtable} line should be something like:
\begin{longtable}{p{200px}p{200px}p{200px}}
paulsharpeY and caayala
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done