[Tex/LaTex] Unwanted white space with knitr+booktabs package


I want to include a table in my latex document that I create using knitr package. I "call" the table using:

<<r second part}>>=
kable(Per_cond, booktabs=F,row.names=F)
\protect\caption{Summary of plate}

The results is amazing as usual, but as you can see below, some white space is added after every 5 rows.

Booktabs ON table

When created with booktabs=F those withe spaces disappear (second image).

Booktabs OFF table

Do you know a way to get rid of those white spaces or (even better) to select where they appear (in this case if they would come after every 4 rows, they would nicely separate my conditions) ? Thank you for your help.

(RStudio 0.98.1062, knitr v 1.9, MikTex 2.9, booktabs packaged 2005-05-04)

Best Answer

This question was crossposted at Stack Overflow and got an answer from Gregor that helped the OP.

Looking at the source of kable, it calls knitr:::kable_latex if you're using LaTeX. Then, looking at that source, it has the following argument and default:

linesep = if (booktabs) c("", "", "", "", "\\addlinespace")

So, I'm guessing if you explicitly pass

linesep = c("", "", "", "\\addlinespace")

you'll get spaces every 4 lines as desired.

Related Question