kableExtra: Hyperlink in footnote of a table

898 views Asked by At

I looked this question but the given method does not seem work with footnotes (See MWE). I wonder how to add hyperlink in table footnotes using kableExtra package.

knitr::kable(
              x       = mtcars[1:4, 1:5]
            , format  = "latex"
            , caption = "Table Caption with hyperlink[note]"
            , escape  = FALSE
            ) %>%
  kableExtra::add_footnote("\\href{https://github.com/haozhu233/kableExtra}{kableExtra}")
1

There are 1 answers

1
Hao On BEST ANSWER

With kableExtra > 0.5.0, you can use escape in footnote.

library(kableExtra)
knitr::kable(mtcars[1:4, 1:5], 
         format  = "latex", 
         caption = "Table Caption with hyperlink[note]", 
         escape  = FALSE
        ) %>%
  add_footnote("\\href{https://github.com/haozhu233/kableExtra}{kableExtra}",
                       escape = F)