Skip to content

Commit

Permalink
Merge pull request #816 from haozhu233/issue815
Browse files Browse the repository at this point in the history
Stop row_spec() from adding extra linebreaks.
  • Loading branch information
dmurdoch authored Feb 8, 2024
2 parents 27e82f8 + ee91841 commit 500ec1b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
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 = '[email protected]', 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

0 comments on commit 500ec1b

Please sign in to comment.