Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page breaks resulting in open borders when rendering as quarto PDF book #569

Open
jonpeake opened this issue Sep 11, 2023 · 0 comments
Open
Labels
bug pdf related to pdf output

Comments

@jonpeake
Copy link

Unfortunately I can't seem to reproduce as a minimal example as there are a lot of moving parts, but I'm working on a quarto book and have a few long tables that break across multiple pages. Occasionally when I render to PDF, I get a break in a table prior to the inner border, rather than after the inner border. I've tried changing the size of the cells, switching from border_inner to hline and vline, changing font size, and it still happens consistently in at least a couple spots (see screenshot below for example). Any ideas as to what might be causing this?

  App2_ft <- data %>%
    filter(!Species %in% c("Effort")) %>%
    mutate_if(is.character, str_trim) %>%
    flextable(col_keys = colnames(data)[!str_detect(colnames(data),'spp')]) %>%
    set_table_properties(opts_pdf = list(caption_repeat = FALSE)) %>%
    compose(j = 'Species', value = as_paragraph(as_i(Species), ' ',spp)) %>%
    set_header_df(
      mapping = TB_App2_header,
      key = "col_keys"
    ) %>%
    merge_v(part = "header") %>%
    merge_at(i = 1, j = 2:(dim(data)[2]-2), part = "header") %>%
    #add  borders
    border_inner(part = "all", fp_border(color = "black", width = 1)) %>%
    border_outer(part = "all", fp_border(color = "black", width = 1)) %>%
    fontsize(part = "all", size = 7) %>%
    bold(bold = TRUE, part = "footer") %>%
    align(j = 2:dim(data)[2], align = "right", part = "footer") %>%
    #make the entire header row bold
    bold(bold = TRUE, part = "header") %>%
    #make totals and selecteds bold
    bold(bold = TRUE, i = bold_rows, part = 'body') %>%
    #text alignments
    align(align = "center", part = "header") %>%
    width(j = 1, width = 1.5) %>%
    width(j = 2:(dim(data)[2]-1), width = 0.45) %>%
    #align all numbers to the right
    align(j = 2:(dim(data)[2]-1), align = "right", part = "body") %>%
    align(j = 1, align = "left", part = "body") %>%
    set_table_properties(layout = "fixed", width = 1) %>%
    #to fix the right-alignment between the body and footer, include some white space padding
    padding(padding.right = 2, j = 2:dim(data)[2]-1, part = 'body') %>%
    #increase row height (specified in inches)
    height(height = 0.25, part = "header") %>%
    height(height = 0.25, part = "body") %>%
    height(height = 0.25, part = "footer") %>%
    #need hrule to actually make the above heights apply to the rows when rendered
    hrule(rule = "at least", part = "all") %>%
    #add bottom line of the footer and header
    hline_top(border = fp_border(color = "black", width = 2), part = "footer") %>%
    hline_bottom(border = fp_border(color = "black", width = 2), part = "header")  %>%
    fix_border_issues() %>%
    add_footer_lines("Effort, or total number of hauls, is labeled 'E'. Taxa are arranged alphabetically. Selected taxa are highlighted in bold.")

image

@davidgohel davidgohel added the bug label Oct 20, 2023
@davidgohel davidgohel added the pdf related to pdf output label Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug pdf related to pdf output
Projects
None yet
Development

No branches or pull requests

2 participants