title: ERROR: "Extra alignment tab has been changed to \cr." in R-Markdown to PDF
body: <p>I am using a Rmarkdown with KableExtra to create an Invoice table with collapse_rows and pack_rows. Executing this chunk locally generates the wished table layout:</p>
  <p><a href="https://i.stack.imgur.com/mummv.png" rel="nofollow noreferrer">example table layout</a></p>
  <p>As soon I try to render this markdown with: <code>rmarkdown::render()</code>
  I receive the following error:</p>
  <pre><code>output file: billing.knit.md
  
  /usr/bin/pandoc +RTS -K512m -RTS billing.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc6d77420b47ac.tex --self-contained --highlight-style tango --latex-engine pdflatex --variable graphics --include-in-header /tmp/RtmpoyiqX9/rmarkdown-str6d777c393955.html
  ! Extra alignment tab has been changed to \cr.
  &lt;recently read&gt; \endtemplate
  </code></pre>
  <p>I can only prevent this error by skipping the <code>collapse_rows</code> &amp; <code>pack_rows</code>.</p>
  <pre><code>kbl(tot_cost3[,2:ncol(tot_cost3)], format = &quot;latex&quot;, booktabs = TRUE, longtable = TRUE, col.names = c(&quot;&quot;, &quot;analysis type&quot;, &quot;samples&quot;, &quot;unit price&quot;, &quot;sum&quot;, &quot;sub total in CHF&quot;), align = &quot;lllcccc&quot;) %&gt;%
    kable_styling(latex_options = c(&quot;repeat_header&quot;)) %&gt;%
    collapse_rows(columns = 6, valign = &quot;bottom&quot;, latex_hline = &quot;major&quot;, longtable_clean_cut = T) %&gt;%
    pack_rows(index = table(tot_cost$User_name)) %&gt;%
    row_spec(nrow(tot_cost3), bold=TRUE) %&gt;%
    kable_paper(full_width = T)
  </code></pre>
  <p>I don't really understand what is going on here, because also a rollback to an earlier, working version of the *.Rmd didn't help. - Still it seems to be somehow related to the <strong>pack_rows</strong> and <strong>collapse_rows</strong> function...</p>
  <p>Any hint towards a potential solution is highly appreciated!</p>