Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

row_spec arguments hline_after and extra_latex_after inserting space between rows in package version 1.4.0 #815

Closed
k96nb01 opened this issue Feb 6, 2024 · 1 comment · Fixed by #816

Comments

@k96nb01
Copy link

k96nb01 commented Feb 6, 2024

Describe the bug
The row_spec arguments to introduce lines in a table now also insert space in version 1.4.0

library(kableExtra)

kbl(mtcars[1:5, 1:5], "latex", booktabs = TRUE) %>% row_spec(2, extra_latex_after = "\\cline{2-6}") %>% row_spec(4, hline_after = TRUE)

Output version 1.3.4:

image

Output version 1.4.0:

image
@dmurdoch
Copy link
Collaborator

dmurdoch commented Feb 6, 2024

The problem is that the output Latex looks like this:

\begin{tabular}[t]{lrrrrr}
\toprule
  & mpg & cyl & disp & hp & drat\\
\midrule
Mazda RX4 & 21.0 & 6 & 160 & 110 & 3.90\\
Mazda RX4 Wag & 21.0 & 6 & 160 & 110 & 3.90\\
\cline{2-6}\\
Datsun 710 & 22.8 & 4 & 108 & 93 & 3.85\\
Hornet 4 Drive & 21.4 & 6 & 258 & 110 & 3.08\\
\midrule\\
Hornet Sportabout & 18.7 & 8 & 360 & 175 & 3.15\\
\bottomrule
\end{tabular}

Those \\ line breaks in \cline{2-6}\\ and \midrule\\ shouldn't be there, and weren't there in 1.3.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants