Navigation Menu

Skip to content

Commit

Permalink
Fix #1487 (#1519)
Browse files Browse the repository at this point in the history
* Fix #1487

* Add @haozhu233 as a ctb; Add a NEWS entry

* Fixes per yihui's comments
  • Loading branch information
haozhu233 authored and yihui committed Feb 27, 2018
1 parent 1e9a4d5 commit 0da648b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Expand Up @@ -28,6 +28,7 @@ Authors@R: c(
person("Garrick", "Aden-Buie", role = "ctb"),
person("Gregoire", "Detrez", role = "ctb"),
person("Hadley", "Wickham", role = "ctb"),
person("Hao", "Zhu", role = "ctb"),
person("Heewon", "Jeon", role = "ctb"),
person("Henrik", "Bengtsson", role = "ctb"),
person("Hiroaki", "Yutani", role = "ctb"),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
@@ -1,3 +1,9 @@
# CHANGES IN knitr VERSION 1.21 (unreleased)

## BUG FIXES

- `valign` in `kable_latex()` does not put the float alignment to the correct location (thanks, @haozhu233, #1487, #1519)

# CHANGES IN knitr VERSION 1.20

## NEW FEATURES
Expand Down
4 changes: 2 additions & 2 deletions R/table.R
Expand Up @@ -235,7 +235,7 @@ kable_latex = function(
sprintf('[%s]', valign)
} else ''
if (identical(caption, NA)) caption = NULL
env1 = sprintf('\\begin{%s}\n', table.envir)
env1 = sprintf('\\begin{%s}%s\n', table.envir, valign)
env2 = sprintf('\n\\end{%s}', table.envir)
if (caption.short != '') caption.short = paste0('[', caption.short, ']')
cap = if (is.null(caption)) '' else sprintf('\n\\caption%s{%s}', caption.short, caption)
Expand All @@ -254,7 +254,7 @@ kable_latex = function(

paste(c(
if (!longtable) c(env1, cap, centering),
sprintf('\n\\begin{%s}%s', tabular, valign), align,
sprintf('\n\\begin{%s}', tabular), align,
if (longtable && cap != '') c(cap, '\\\\'),
sprintf('\n%s', toprule), '\n',
if (!is.null(cn <- colnames(x))) {
Expand Down

0 comments on commit 0da648b

Please sign in to comment.