-
-
Notifications
You must be signed in to change notification settings - Fork 872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using URL for image when converting to PDF output #2274
Comments
I don't think this is the special character. Using URL in Easier reprex: ---
title: "Image URL"
output:
beamer_presentation:
keep_tex: true
pdf_document:
keep_tex: true
---
# test
![](https://github.com/raw/rstudio/hex-stickers/main/PNG/knitr.png)
This is more a rmarkdown limitation I would say. Fonction @yihui How is that suppose to work in R Markdown using url for image and PDF output ?
Shouldn't a fonction like I think we should try to do something (download image?), somewhere (knitr or rmarkdown), somehow (Lua filter in rmarkdown to catch all images ? Or extenting |
Right. Pandoc will download images when compiling to PDF, but R Markdown doesn't. This is due to the fact that R Markdown only uses Pandoc to render the intermediate We can certainly try to download images inside Personally I don't prefer images being downloaded again every time the PDF is generated. That can be slow and wastes the bandwidth. I'd cache the download like this: https://stackoverflow.com/a/46333724/559676 It's easy to make a function out of this solution if desired. web_image = function(url, path = xfun::url_filename(url)) {
if (!file.exists(path)) xfun::download_file(url, path)
knitr::include_graphics(if (knitr::pandoc_to('html')) url else path)
} Then you call
|
Yes I would do something like that do. A new function seems good for this ! |
@bayeslearner Are you okay with using the |
Seems to be what we need. |
I've added it as a new function |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
The following doc works fine in html but fails beamer. The generated latex file contains special characters. Should it be wrapped in url package or something?
By filing an issue to this repo, I promise that
xfun::session_info('knitr')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('yihui/knitr')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: