Reputation: 166
I'm preparing an R Markdown script to make a pdf (using tinytex).
I have a table from kableextra
with a footnote()
that I'd like to have the hyperlinked URL.
I know how to bold, italicize, strikethrough text in tex, but hyperlinked URLs?
Here is an example:
The footnote can be linked but does not appear blue and not inline with the "Source" title.
OK - since this is markdown I'll post differently:
YAML:
output: pdf_document
header-includes:
- \usepackage{hyperref}
- \hypersetup{
colorlinks=true,
urlcolor=cyan}
Setup
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
Section with kableextra
with a footnote()
URL
## URL in Text Chunk
This a URL <http://rmarkdown.rstudio.com>.
Section table and URL in footnote
## URL in `kableExtra()` Footnote
```{r, echo=FALSE, warning=FALSE}
library(kableExtra)
kable(head(mtcars),
booktabs = T,
linesep = "") %>%
footnote(general="http://rmarkdown.rstudio.com", general_title = "Source: ") %>%
kable_styling(latex_options = c("striped","hold_position"))
Upvotes: 1
Views: 659
Reputation: 166
I figured it out.
I needed to change:
footnote(general="http://rmarkdown.rstudio.com", general_title = "Source: ")
to:
footnote(general="\\\\url{http://rmarkdown.rstudio.com}", general_title = "Source: ", footnote_as_chunk = T, escape=F)
Thanks all
Upvotes: 3