title: kableExtra::pack_rows() - grouping not working for last row in long table and no indentation for wrapped text
body: <p>I use the <code>kableExtra</code> package to generate a long table in an R markdown documents knitted to PDF.</p>
  
  <p>Sets of rows of the table are grouped together using <code>kableExtra::pack_rows()</code> (formerly <code>kableExtra::group_rows()</code>)</p>
  
  <p>Two issues arise:</p>
  
  <ol>
  <li><p>If the last row forms a set, its grouping is not displayed if one</p>
  
  <ul>
  <li><p>sets <code>longtable = TRUE</code> to allow the long table to span across multiple pages </p>
  
  <p><em>and</em> at the same time</p></li>
  <li><p>uses <code>kable_styling(..., latex_options = c("repeat_header"))</code> to repeat the header of the table on each page.</p></li>
  </ul></li>
  <li><p>The text in some rows of my first column is too long for the column width (which needs to be fixed). It is thus wrapped into the next line. However, any wrapped text is no longer indented. 
  Increasing the column width such that the text is unfortunately not an option in my use case. </p></li>
  </ol>
  
  <p>I tried the minipage solution proposed in <a href="https://stackoverflow.com/questions/50859270/indentation-when-line-break-in-group-rows-command-kableextra-package-in-r-ma">this SO post</a> to solve issue 2).
  It works if the first column is set sufficiently wide via <code>column_spec(1, width = "XXXem")</code>). However, in my use case, I can not set it soooo wide as to make it work this way.</p>
  
  <p>If there is no other to indent the content of the wrapped line, could one alternatively remove the indentation in general?</p>
  
  <p>An MWE and illustrations are provided below.</p>
  
  <p>Either <code>longtable = FALSE</code> or no <code>latex_options = c("repeat_header"))</code> ==> Pack-rows is working</p>
  
  <p><a href="https://i.stack.imgur.com/knFty.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/knFty.png" alt="Longtable-FALSE_Pack-rows-WORKING"></a></p>
  
  <p><code>longtable = TRUE</code> AND <code>latex_options = c("repeat_header"))</code> ==> Pack-rows is not working</p>
  
  <p><a href="https://i.stack.imgur.com/XeuRt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XeuRt.png" alt="Longtable-TRUE_Pack-rows-NOT-WORKING"></a></p>
  
  <pre><code>---
  title: "MWE"
  output:
    pdf_document: default
    html_document: default
  ---
  ```{r echo=FALSE}
  library(knitr)
  library(kableExtra)
  
  dt &lt;- mtcars[1:3, 1:2]
  
  kable(dt, 
    escape = FALSE, # to be able to include latex commands
    booktabs = T, 
    longtable = TRUE, # allow long table to span multiple pages
    ) %&gt;% 
    kable_styling(full_width = F,
                  latex_options = c(
                    "repeat_header"  # repeat header of long table
                  )
    ) %&gt;% 
    # column characteristics: set widths
    column_spec(1, width = "2cm") %&gt;%
    # group rows together and give these groups labels
    pack_rows("Mazda Cars", 1, 2) %&gt;%
    pack_rows("Datsun Cars", 3, 3)
  ```
  </code></pre>