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

Stop row_spec() from adding extra linebreaks. #816

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: kableExtra
Type: Package
Title: Construct Complex Table with 'kable' and Pipe Syntax
Version: 1.4.0.1
Version: 1.4.0.2
Authors@R: c(
person('Hao', 'Zhu', email = 'haozhu233@gmail.com', role = c('aut', 'cre'),
comment = c(ORCID = '0000-0002-3386-6076')),
Expand Down
8 changes: 4 additions & 4 deletions R/row_spec.R
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ row_spec_latex <- function(kable_input, row, bold, italic, monospace,
underline, strikeout,
color, background, align, font_size, angle,
hline_after, extra_latex_after)
temp_sub <- ifelse(i == 1 & (table_info$tabular == "longtable" |
!is.null(table_info$repeat_header_latex)),
gsub, sub)
temp_sub <- if (i == 1 && (table_info$tabular == "longtable" ||
!is.null(table_info$repeat_header_latex)))
gsub else sub
if (length(new_row) == 1) {
# fixed=TRUE is safer but does not always work
regex <- paste0("\\Q", target_row, "\\E")
Expand All @@ -230,7 +230,7 @@ row_spec_latex <- function(kable_input, row, bold, italic, monospace,
table_info$contents[i] <- new_row
} else {
# fixed=TRUE is safer but does not always work
regex <- paste0("\\Q", target_row, "\\E")
regex <- paste0("\\Q", target_row, "\\E(\\\\\\\\)?")
if (any(grepl(regex, out))) {
out <- temp_sub(regex,
paste(new_row, collapse = ""), out, perl = TRUE)
Expand Down
4 changes: 3 additions & 1 deletion inst/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
kableExtra 1.4.0.1
kableExtra 1.4.0.2
--------------------------------------------------------------------------------

Bug Fixes:

* Fixed a bug in `collapse_rows()`, which failed on tables
that had no header (#812).
* Fixed a bug in `row_spec()` which added extra
line breaks when `extra_latex_after` was specified (#815).


kableExtra 1.4.0
Expand Down
Loading