-
-
Notifications
You must be signed in to change notification settings - Fork 978
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
PDF rendering failure due to absolute short path name on Windows for figures #2162
Comments
Unfortunatly I can't reproduce your issue by using the document you provided. I am also on Windows but using R 4.1.0. Not sure it changes anything. Can you try simplify it and see if it works ? For example: ---
title: Title Page
author: Author - Organization
output:
pdf_document:
latex_engine: pdflatex
keep_md: yes
keep_tex: yes
---
```{r chapter_4_plot3, fig.cap="cap", echo=F}
par(mar = c(4, 4, .2, .1))
plot(cars)
```
```{r chapter_4_plot4, fig.cap="cap", echo=F, out.width='70%'}
par(mar = c(4, 4, .2, .1))
plot(cars)
``` Does this above works ? Also can you add Thanks |
@cderv Thank you so much for the help. I think I figured it out. Apparently there was a white space somewhere in However, what I don't quite get: Why does it work seamlessly when hitting |
Yes whitespace in file path could be the issue.
I don't know either. Usually, figure path are relative to the document and in your example error it seems to be an absolute path. You may have encounter this issue: #2024 To really try to understand the difference, it would be great to have an example that reproduce the issue. I would try not to set |
Hi, sorry for the delay, I attached a small reprex including the folder structure that I am currently using. In particular, the folder on the highest level contains a whitespace in its name which triggers the error. Alternatively, commenting out What I find interesting when looking at the generated \begin{figure}
\centering
\includegraphics{C:/Users/.../test test/test-test/outputs/de_report_template_files/figure-latex/chapter_4_plot3-1.pdf}
\caption{cap}
\end{figure}
\begin{figure}
\includegraphics[width=0.7\linewidth]{C:\Users\...\test test\test-test\outputs\de_report_template_files/figure-latex/chapter_4_plot4-1} \caption{cap}\label{fig:chapter_4_plot4}
\end{figure} Are these information sufficient? Thanks in advance! |
Hi @simonschoe, That helps a lot ! Thank you very much. I think this comes from knitr ways of handling figure environment in special case, and the filepath on Windows not being properly escape or having backslash instead of forward slash. This is a combinaison of things activated that lead to this unexpected behavioir. Let me explain:
Because of this above you see differences in the filepath. The main difference is not the extension but the This is also combined with another issue:
I need to look deeper to see if we can safely fix this or not. Let's just be reminded that:
I look into this ! Thanks for the report and the reproducible example, that helps a looooooottttt!! 😉 |
This is definitely related to #2024. The backslashes are added by rmarkdown in It seems that LaTeX does not like this. We need to see why we do this transformation for Pandoc, and how we make both Pandoc and LaTeX happy in this case. (if possible) The current workaround is to not use Hopefully we'll be able to fix this for next version. |
Hey @cderv thank you so much for the context!
The reason I was using |
Hi there,
I encountered the abovementioned issue when running the following code:
And the contents of
_render22.R
:And finally the pandoc error message:
Strangely, the error does not occur if I use the
knit
button instead ofrender()
and it does not occur if I refrain from usingout.width
in the plot's chunk options. Any idea what might be the cause and remedy?Output from
xfun::session_info('rmarkdown')
:The text was updated successfully, but these errors were encountered: