Closed iciarfernandez closed 4 years ago
@sciclic Do you have MiKTex installed? I think i solved this issue by setting the path to the .exe file in environmental variables: the path should look smth like that if you are on windows: C:\Users\egoro\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64
@yuliaUU I installed it and kept it in that same directory in my computer, but this is the error that is showing now:
And this is what I see in the path:
After setting a path, have you restarted rstudio?
You dont have \bin\x64 in your folder for miktext you need to change the path then
Where do I get that \bin\x64 though? That's all that showed up after finishing installation
Yes, very weird. Trying to figure out!
@sciclic is there a sub-folder "bin" anywhere in MiKTeX folder?
No, I've opened all the folders and nothing :( @yuliaUU
Does it have to do anything with me running these lines of code yesterday since that's the solution I found online?
install.packages('tinytex')
tinytex::install_tinytex()
I think tinytex is alternative, should not interfeere with the otehr program
what about this path?MiKTeX\2.9\bin\ do you have it?
You can try using tinytex and set up a path to the tiny text files
@yuliaUU This is what MikTeX\2.9\ looks like.
The issue is that I don't know what went wrong with my TinyTeX installation but I tried like 3 times and it just showed up errors with those two lines above. Is there other way to install tinytex or any others?
try from r studio: packages => install => tinytex
will it help? also quit /restart r session
@yuliaUU Still trying. I was having issues with installing dash as well so I followed Firas recommendation to update RStudio and my R version. I will let you know once I figure it out & thank you so much for all the help, it's been really frustrating haha.
yep: updating should solve it!
Okay, there's been progress - it seems to run until the very end and then I get this different error:
!LaTeX Error: Unknown graphics extension: .png)
@yuliaUU
I am not sure what you are trying to dunno but It looks like the issues is when you inserting images like ![pic name](path to the file)
Two ways I found to solve it:
![test caption](Maps_are_hard.png)
here
package, you have to include it as an inline R expression):![test caption](r here::here("Maps_are_hard.png")
)
Not visible because of editing, but you need ` before r and after .png")
Without the inline R expression, you meant the character string here::here("Maps_are_hard.png")was literally the file path, but there isn't such a file.
Also, may be this will work?
{r, echo=FALSE} knitr::include_graphics("./Maps_are_hard.png")
Thank you @yuliaUU!
So, I was using knitr::include_graphics(here::here("images", "nameofimage.png"), auto_pdf = getOption("knitr.graphics.auto_pdf", FALSE))
For some reason when I write![test caption](path/nameofimage.png)
it says 'no image found' although I am specifying the same path that I specify when I use knitr.
I don't quite understand how to write the inline R expression for the second one, could you attach a screenshot? I'm trying to run it like this:
![]`r here::here("images", "logisticregression2.png")`
But it's still not working.
What about knitr::include_graphics("./images/picname.png")?
I may be wrong but
`
only can work if images are put in the same place where rmd file is
@yuliaUU When I try that knitr:: with the path instead, it gives me this error.
Error in knitr::include_graphics("./images/logisticregression.png") : Cannot find the file(s): "./images/logisticregression.png"
I don't understand it because why can it find it with here::here but not with the path?
Yeah I can see that! That's why I wanted to avoid the ![test caption] because in my repo I've been saving all plots generated from all scripts to the images folder, so I would have to move them all.
Or, remove quotations for the picture path knitr::include_graphics(./images/ logisticregression.png)
Nope, error now is Error in Encoding(x) : object '.' not found
, and if I add ../ instead of ./ it gives me the same, if I remove . it says Error: unexpected '/' in "knitr::include_graphics(/"
, and if I remove ./ it says Error in Encoding(x) : object 'images' not found
Pfaff...knitr::include_graphics("images/ logisticregression.png") This one?
No, I restarted RStudio and finally got it to knit using this ![](r here::here("images", "logisticregression2.png")
) syntax. Thank you so much for your help!
Hi @yuliaUU @firasm,
I'm running the knit.R script to knit my final report R Markdown into an HTML file and a PDF, but I'm having issues with LaTEX, I remember I never figured it out in STAT545 either.
I was googling a solution & found that I should run these lines in my console install.packages('tinytex') tinytex::install_tinytex()
It took a long time but then I started getting an error and now I have a window popping up constantly on my laptop that says "cmd.exe - Application Error
The application was unable to start correctly(0xc0000142). Click OK to close the application" - but regardless of whether I click OK or close the window, it keeps popping up.
Meanwhile, RStudio error when knitting is "no LaTEX installation detected", but the HTML file is knitted just fine.
Please let me know what I should do.
Thank you, Iciar