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

latex: Keep using linesep when pack_rows is used #820

Open
jobrachem opened this issue Feb 14, 2024 · 0 comments
Open

latex: Keep using linesep when pack_rows is used #820

jobrachem opened this issue Feb 14, 2024 · 0 comments

Comments

@jobrachem
Copy link

I think an example explains it best. Take the following minimal data frame:

df <- data.frame(Col1 = c("val1", "val2", "val3"), Col2 = c("val4", "val5", "val6"))

The following code yields the expected output

df |> kbl(format = "latex", linesep = c("\\addlinespace"))
% output of the R code above
\begin{tabular}[t]{l|l}
\hline
Col1 & Col2\\
\hline
val1 & val4\\
\addlinespace
val2 & val5\\
\addlinespace
val3 & val6\\
\hline
\end{tabular}

When I use pack_rows() however, the \addlinespace commands are omitted:

df |> kbl(format = "latex", linesep = c("\\addlinespace")) |> 
    pack_rows("Packed rows", 1, 2)
% output of the R code above
\begin{tabular}[t]{l|l}
\hline
Col1 & Col2\\
\hline
\multicolumn{2}{l}{\textbf{Packed rows}}\\
\hline
\hspace{1em}val1 & val4\\
\hspace{1em}val2 & val5\\
val3 & val6\\
\hline
\end{tabular}

However, in the table I am currently building, I would really like to add space between the rows within a group, not only between the groups of packed rows (which is possible using the argument latex_gap_space). So my desired output would allow for something like this:

% desired output
\begin{tabular}[t]{l|l}
\hline
Col1 & Col2\\
\hline
\multicolumn{2}{l}{\textbf{Packed rows}}\\
\hline
\hspace{1em}val1 & val4\\
\addlinespace % space between rows within a group
\hspace{1em}val2 & val5\\
\addlinespace % space between two groups
val3 & val6\\
\hline
\end{tabular}

If this is possible already, I apologize and would welcome a hint. Thank you so much for the awesome package! 😊

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

No branches or pull requests

1 participant