Can I avoid left-side indentation of the table footnote on a kableExtra table in an Rmarkdown pdf document?

Viewed 101

I am using R markdown with kableExtra for a PDF document. Whenever I use kableExtra::footnote() to add a note at the bottom of the table, the note renders indented a little. But I need the table footnote to appear in line with the table border on the left side. Is this possible?

Here's the code I'm using now:


mainfont: Times New Roman  
fontsize: 12pt   
geometry: "left=3cm,right=3cm,top=2cm,bottom=2cm"  
output:   
  pdf_document:  
      toc: false  
      latex_engine: xelatex  
header-includes:  
    - \usepackage{caption}  
---

\captionsetup[table]{labelformat=empty} 

\captionsetup{justification=centering}  
\renewcommand{\arraystretch}{2}    
{r results='asis',echo=FALSE}

library(data.table)
library(kableExtra)

a = c(3,    72.3,   67.9, NA, NA,   79.5)           
b = c(4,    73.2,   68.8,   68.5, 79.7, 76.3)

mytable = rbind(a,b)
row.names(mytable)=NULL
colnames(mytable) = c("Grade", "Mathematics", "Reading", "Writing", "Science", "Social Studies")
opts = options(knitr.kable.NA = "")

mytable %>%
  kbl(caption = '\\textbf{Table Title}',format='latex',booktabs=T,align='c') %>%

  kable_styling(latex_options = c("striped","HOLD_position","scale_down"),position='center',full_width = FALSE) %>%
  
  footnote(general_title="Notes: ",
    general= c("1. Consistency indicates the proportion of students that would be classified to the same performance   levels should they have been administered a parallel test form. The numbers are on 0-100% scale.", "2. Accuracy indicates the proportion of students that are accurately classified and the numbers are on a 0-100% scale."),threeparttable=T) %>%
  column_spec(6, width = "4em") %>%
  row_spec(0,bold=T) %>% 
  add_header_above(c(" ", "Design Consistency" = 2, "Design Accuracy" = 3),bold=TRUE,align='c',line=TRUE,line_sep=0)

1 Answers

I think this comes from the option threeparttable, if you set it equal to FALSE, the indent should go away (but it may not look that nice anymore)

Related