Error with pandoc in R - r

Occasionally, I'm getting this error while running code in order to produce output in pdf. I can not figure out why it is to. The code below works but occasionally getting this kind of error. I have to close and re-open RStudio to fix this issue.
Error:
system(paste("pandoc -V geometry:margin=0.7in -o", Reports, "/report", ".pdf ",
"report", ".md" ,sep=""))
pandoc.exe: Error producing PDF from TeX source.
!pdfTeX error: pdflatex (file C:/Users/RM/Desktop/figure
/unnamed-chunk-4.png): reading image file failed
==> Fatal error occurred, no output PDF file produced!
Warning message:
running command 'pandoc -V geometry:margin=0.7in -o C:/Users/RM/Desktop/report.pdf
report.md' had status 43
EDIT:
The error is hardly reproducible. So I wonder if someone would be able to help simply only from the error message itself.

Related

Knit in R studio - Error message - File not found in directory

I just completed a project in RMD and my script wont knit. First I get an error message saying file not in directory.
Then in the render console it as the error message
Line 535 Error in check_for_XqQuartz()
X11 library is missing: install XQuartz.macosforge.org
The problem is the app won't download on my mac.
Please see three attached screenshots for more information

How to solve Failed to run "xelatex .\notebook.tex -quiet" command: notebook.tex:373:?

I am trying to convert my jupyterlab into pdf but I am getting this error server.
nbconvert failed: PDF creating failed, captured latex output:
Failed to run "xelatex .\notebook.tex -quiet" command:
notebook.tex:373:
and here is the code that I am using:
\documentclass{article}
\begin{documentation}
\begin{equation}
f(x) = x^2
\end{equation}
\end{documentation}
I want to precise that I have downloaded all the updates in MikTeX, and the same code when I keep only the equation part, does work fine. I also tried to change the location of \end by placing it at the end of the fist block, and it's still giving me the same error.
PS: nbconvert: Convert Notebooks to other formats
Can anyone help please?

Could not Publish (TypeError): null is not and object (evaluating b.g.) - Rmarkdown

I'm trying to publish an RMarkdown document to my RPubs account, but I get the next error when clicking on "Publish":
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
cannot open file 'C:/Users/.../File.Rmd': No such file or directory
It also pops up a window saying the next two warnings:
First pop up: "Could not Publish - Error ocurred while executing method"
Second pop up: "Could not Publish - (TypeError): null is not an object evaluating 'b.g.')
My R version is 3.4.2, RStudio version is 1.1.383, knitr version is 1.17.
I have also checked is the working directory contains the files I'm using at the script, and all seems properly set.
This error only happens when I click on Publish. If I try to knit to HTML or to PDF it works. I have tried to restart and reinstall also both R and RStudio but the error persists.
Has anyone had the same error and knows how to solve it?
Thank you very much!
Is the file saved? Are you in the correct directory?
Please check getwd().
I managed to solve it. The problem was that the path of the working directory contained an accent. I changed the path to another folder without accents and it worked.

Pandoc error - turning HTML document to PDF. Error Code 127

I'm working with code to try to convert html to pdf using pandocs
# Load packages
require(knitr)
require(markdown)
# Create .md, .html, and .pdf files
knit("Data Analysis - Quant.Rmd")
markdownToHTML('Data Analysis - Quant.md', 'dat.html', options=c("use_xhml"))
system("pandoc -s dat.html -o dat.pdf")
I get the following inexplicable error code:
Warning message:
running command 'pandoc -s dat.html -o dat.pdf' had status 127
I can't find anything about this warning online, and no pdf output is produced in the working directory. Any ideas?

Error with knitr on texmaker

I am trying for the first time to get knitr running on texmaker, I followed this documentation and I am on Windows 7. However, when I compile, I get the following error stack:
Process started
Error in readLines(if (is.character(input2)) { : cannot open the connection Calls: <Anonymous> -> knit -> readLines
In addition: Warning message: In readLines(if (is.character(input2)) { : cannot open file 'try_easy.Rnw': No such file or directory
Execution halted
Process exited with error(s)
I tried to google it, but only found references to linux/unix, which were not helpful for my case. Following is my short test document:
\documentclass[a4paper]{article}
\begin{document}
<<a>>=
x=rnorm(100)
<<b>>=
<<a>>
mean(x)
#
\end{document}
It's my first time on stackoverflow, so please tell me if you need more information or I did something wrong. Thank you very much.
Update
Hello everyone,
I managed to find out my mistake. For the sake of future google-searchers, I had saved the file as a .tex instead as .rnw. Saving as rnw solved it. Since I cannot answer my own questions, I edit it here.
This error happens when the file is saved as a .tex instead of a .Rnw, as the compiler does not know that he should "knitr-compile" files that have the .tex handle, unless you specifically set him up like that.

Resources