0

So I'm creating some tables with Kable that are compiled into a PDF form. My code is below.

 kable(df, "latex", booktabs = T, row.names = FALSE, format = "latex", valign = 't', linesep = "") %>%
        kable_styling(full_width = T, font_size = 14) %>% 
        column_spec(1, bold = T, border_right = T) %>%
        add_indent(c(2:7)) %>%
        add_indent(c(3,5,7)) %>%
          row_spec(c(1,3,5,7), background = "TableColorOne") %>%
          row_spec(0, background = "TableColorTwo")

Everything runs as normal, but some values in the last column become bottom justified. This table is generated dynamically so sometimes it has 3 or 4 columns.

3 column table, 3rd column, row 3 and 5 are bottom justified unexpectedly 3 column table, 3rd column, row 3 and 5 are bottom justified unexpectedly

4 column table, 4th column, row 3 and 5 are bottom justified unexpectedly 4 column table, 4th column, row 3 and 5 are bottom justified unexpectedly

This github issue seems relevant but modifying valign and position do not seem to have any impact on the text placement.

Is there any way that I can stop this unintended bottom justification?

Max Feinberg
  • 810
  • 1
  • 6
  • 21
  • Please make a minimal, self-contained, reproducible example as described here: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610 – jay.sf Mar 26 '20 at 08:08
  • I'm working on putting an example together! – Max Feinberg Mar 27 '20 at 15:09
  • What version of LaTeX are you running? What happens when you drop the use of `valign='t'`; don't know whether that points to alignment of the table, or each cell in the table? – Werner Mar 27 '20 at 22:36
  • Probably related: [Vertical alignment in table: m-column, row size - problem in last column](https://tex.stackexchange.com/q/68732/5764) – Werner Mar 27 '20 at 22:36

0 Answers0