Skip to content

Commit

Permalink
Merge pull request #789 from haozhu233/centering_fix
Browse files Browse the repository at this point in the history
Fix centering of three part table.
  • Loading branch information
dmurdoch committed Dec 4, 2023
2 parents 9cfbb7c + 81ec2fe commit d3e7953
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/kable_styling.R
Original file line number Diff line number Diff line change
Expand Up @@ -558,15 +558,16 @@ styling_latex_position <- function(x, table_info, position, latex_options,

styling_latex_position_center <- function(x, table_info, hold_position,
table.envir) {
if (!table_info$table_env & table_info$tabular == "tabular") {
if (!table_info$table_env && table_info$tabular == "tabular") {
x <- paste0("\\begin{", table.envir, "}\n\\centering", x,
"\n\\end{", table.envir, "}")
if (hold_position == "hold_position") {
x <- styling_latex_hold_position(x)
} else if(hold_position == "HOLD_position") {
x <- styling_latex_HOLD_position(x)
}
}
} else if (table_info$table_env)
x <- sub("^\\\\begin\\{table}", "\\\\begin{table}\n\\\\centering", x)
return(x)
}

Expand Down
1 change: 1 addition & 0 deletions inst/NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ should be supported.
* cell_spec() colors like "darkgoldenrod2" weren't
shown (issue #726).
* placement of collapsed row labels was incorrect (issue #719).
* centering of three part table wasn't working (issue #692)



Expand Down

0 comments on commit d3e7953

Please sign in to comment.