Skip to content

Commit

Permalink
pdf fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Dec 13, 2024
1 parent 15dbb6d commit 7b0087b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion R/save_tt.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ latex_standalone <- "
\\usepackage{rotating}
\\usepackage{float}
\\usepackage[normalem]{ulem}
\\usepackage[HTML]{xcolor}
\\usepackage[x11names, svgnames]{xcolor}
\\UseTblrLibrary{booktabs}
\\UseTblrLibrary{siunitx}
\\newcommand{\\tinytableTabularrayUnderline}[1]{\\underline{#1}}
Expand Down
13 changes: 0 additions & 13 deletions R/style_string.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,6 @@ style_string_typst <- function(n, styles) {
}



style_notes <- function(x) {
fun <- switch(x@output,
"typst" = style_string_typst,
"html" = style_string_html,
"html_portable" = style_string_html,
"latex" = style_string_latex,
function(k, ...) identity(k)
)
x@notes <- lapply(x@notes, fun, x@style_notes)
return(x)
}

style_notes <- function(x) {
fun <- switch(x@output,
"typst" = style_string_typst,
Expand Down
10 changes: 10 additions & 0 deletions inst/tinytest/test-pdf.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,15 @@ expect_warning(

expect_true("somelog.log" %in% list.files(dest_dir))

# Issue #395
x <- mtcars[1:4, 1:5]
fn <- tempfile(fileext = ".pdf")
cap <- "A simple \\texttt{tinytable} example."
not <- "Nullam odio est, ullamcorper scelerisque lectus a, eleifend luctus nisl. Etiam ullamcorper, nibh vel interdum auctor, odio nulla mollis tortor, vel fringilla ante quam quis est."
tt(x, caption = cap, notes = not, width = .5) |>
style_tt( i = 1:3, j = 1:2, background = "#1ecebf", bold = TRUE) |>
group_tt(j = list("Halloumi" = 1:2, "Tofu" = 4:5)) |>
save_tt(fn, overwrite = TRUE)

# Clean slate
suppressWarnings(invisible(file.remove(list.files(dest_dir))))

0 comments on commit 7b0087b

Please sign in to comment.