imbi-heidelberg / DescrTab2

This package provides functions to create descriptive statistics tables for continuous and categorical variables.
https://imbi-heidelberg.github.io/DescrTab2/
9 stars 7 forks source link

LaTeX error "Misplaced omit" #2

Closed s-kilian closed 3 years ago

s-kilian commented 3 years ago

I tried to create a descriptive table within an imbiReport2::imbi_report_tex Markdown document with the following chunk:


# Create data frame with 20 variables
df <- data.frame(
  "x1" = 1:10
)

for(i in 2:20){
  df[[paste0("x", i)]] <- 1:10
}

# Print desription table
df %>%
  descr()

The dataset has 20 variables. When compiling the TeX document, it gives the following error:

! Misplaced \omit. \multispan ->\omit \@multispan l.296 ...erscript{tt1} Students one-sample t-test} \ \*

It seems to be caused by a double star (look for \\** in the TeX document) in the longtable environment. When deleting the second star manually in the TeX document, it can be compiled. Interestingly, this error only occurs for a certain amount of variables/size of table. With 19 and 21 variables, everything works fine. The problem occurs again for 40 variables.

jan-imbi commented 3 years ago

It's fixed now. Bug was probably due to a "feature" in kableExtra, don't really understand it though.