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

Indentation for footnote #141

Closed
Rednose22 opened this issue Feb 10, 2023 · 1 comment
Closed

Indentation for footnote #141

Rednose22 opened this issue Feb 10, 2023 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@Rednose22
Copy link

Rednose22 commented Feb 10, 2023

Hi there, recently we tried to add indentation for footnote in the rtf_footnote function with the combination of text_indent_left argument and text_indent_first argument. But it didn't work. Since it's included in one cell.

col_indent_first <- c(-250, rep(0, 6))
style_indent_footer <- matrix(c(250, rep(0, 6)),  byrow = T, nrow = length(end_notes), ncol = 7)

r2rtf::rtf_footnote(
   footnote = end_notes,
   text_indent_left = style_indent_footer,
   text_indent_first = col_indent_first,
   as_table = TRUE
 )

Then the indentation would be like screenshot below.
image

After looking into the codes, I guess it's caused by as_rtf_footnote function. In the encode process, the footnote section is treated as one cell so that the indentation only work on one footnote.

text_matrix <- matrix(paste(text_matrix, collapse = "\\line "), nrow = 1, ncol = 1)

attr(text, "text_convert") <- matrix(FALSE, nrow = 1, ncol = 1)

So one solution but not perfect is converting the endnote as a matrix and

foot.matrix <- matrix(c(end_notes, rep(rep('', length(end_notes),), 6)), byrow = F, nrow = length(end_notes), ncol = 7)
footer_style_indent_left <- matrix(c(250, rep(0, 6)),  byrow = T, nrow = length(end_notes), ncol = 7)

 r2rtf::rtf_footnote(
      footnote = foot.matrix,
      text_indent_left = footer_style_indent_left,
      text_indent_first = col_indent_first,
      as_table = FALSE
    )

Then the indentation could be as below:
image

The imperfect point is obviously since footnote is not a part of table and no border around. So I'm wondering if as_rtf_footnote function could be updated.

@fb-elong
Copy link
Collaborator

The bug should be fixed in #142. Thanks!

nanxstats added a commit that referenced this issue Feb 19, 2023
#141 display proper indentation for footnote and data source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants