Skip to content
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

compiling the document #6

Closed
reyntjesr opened this issue Oct 15, 2014 · 6 comments
Closed

compiling the document #6

reyntjesr opened this issue Oct 15, 2014 · 6 comments
Assignees

Comments

@reyntjesr
Copy link

Hi,

I had some problems compiling the document.
First in the documentation it's said that we have to compile to markdown with the command knitr("example.Rmd") that command gave an error. I think the command should be knit("example.Rmd")

Second when I try to compile the markdown file with the command pandoc('example.md') I get the error messages:

executing pandoc --self-contained --webtex --template=include/report.html5 -c include/buttondown.css --default-image-extension=gif --filter=include/equation.py --include-in-header=include/equation.js --include-in-header=include/affiliation.js --standalone --smart --normalize --toc --highlight-style=tango -f markdown -t html5 -o example.html "example.utf8md"
pandoc.exe: Error running filter include/equation.py
terminateProcess: permission denied (Permission denied)
Error in (function (input, format, ext, cfg)  : conversion failed
In addition: Warning message:
running command 'pandoc --self-contained --webtex --template=include/report.html5 -c include/buttondown.css --default-image-extension=gif --filter=include/equation.py --include-in-header=include/equation.js --include-in-header=include/affiliation.js --standalone --smart --normalize --toc --highlight-style=tango -f markdown -t html5 -o example.html "example.utf8md"' had status 83 

With the command Pandoc.convert('example.md',format='pdf') however I was able to compile to pdf

R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Dutch_Netherlands.1252  LC_CTYPE=Dutch_Netherlands.1252   
[3] LC_MONETARY=Dutch_Netherlands.1252 LC_NUMERIC=C                      
[5] LC_TIME=Dutch_Netherlands.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] knitr_1.6    pander_0.3.8

loaded via a namespace (and not attached):
[1] animation_2.3   digest_0.6.4    evaluate_0.5.5  formatR_1.0     htmltools_0.2.6
[6] rmarkdown_0.3.3 stringr_0.6.2   tools_3.1.1     yaml_2.1.13

Great Tutorial by the way thank you very much!

Regards,
Robert

@humburg humburg self-assigned this Oct 15, 2014
@humburg
Copy link
Owner

humburg commented Oct 15, 2014

Hi Robert,

You are correct about the name of the function, it is knit not knitr. This typo has been fixed in master but I haven't released a new version yet.

The error message you are getting from pandoc sounds as if the script equation.py isn't executable. Could you check that for me and try running it again after changing permissions (if that is indeed the case)?

Cheers,
Peter

@humburg
Copy link
Owner

humburg commented Oct 15, 2014

While researching this error I came across this issue in the pandoc repo: jgm/pandoc#1096. This may or may not be related. Could you confirm that you are using a pandoc version that incorporates the fix for this? As far as I can see the first release of pandoc that includes this was 1.12.4.

@reyntjesr
Copy link
Author

I was already checking if I had the latest versions.
I did a python update and I have the latest pandoc version 1.13.11.
But I also looked if there were any python packages that used pandoc and I found 2:

  • pandocfilters-1.2.2.tar.gz
  • pypandoc-0.8.2.tar.gz

I installed these two with pip install. I don't know which one (or maybe both) was needed but the python error seems to be resolved.

Everything is not solved because when I now run knitr::pandoc('example.md') I get the following error:

pandoc.exe: Could not fetch figure/distributions2.ogg
figure/distributions2.ogg: openBinaryFile: does not exist (No such file or directory)
Error in (function (input, format, ext, cfg)  : conversion failed
In addition: Warning messages:
1: In readLines(con) : incomplete final line found on 'example.md'
2: running command 'pandoc --self-contained --webtex --template=include/report.html5 -c include/buttondown.css --default-image-extension=gif --filter=include/equation.py --include-in-header=include/equation.js --include-in-header=include/affiliation.js --standalone --smart --normalize --toc --highlight-style=tango -f markdown -t html5 -o example.html "example.utf8md"' had status 67 

I checked and there's no distributions2.ogg file in the figure folder.

@humburg
Copy link
Owner

humburg commented Oct 15, 2014

pandocfilters is the one I think. That is used by the filter script but I evidently forgot to add it to the requirements.

Regarding the missing distributions2.ogg file, do you have ffmpeg installed? There may be additional error messages from knitr hiding in example.md that could shed some light on what went wrong.

@reyntjesr
Copy link
Author

I solved it!
The ffmpeg problem was just a wrong path.
After that I ran into another problem that had to do with creating the dist3.gif image
I had installed the animation package but on windows the imagemagick program was also needed.
The saveGIF command still wouldn't work but I found this stackoverflow question that solved it. I created images in the figure folder. I changed the convert.exe command of ImageMagick to imConvert.exe and used the shell command in R instead of the system command. See the code below.

threeDists <- function(df, x=seq(-6,6, by=0.1)){
    yNorm <- dnorm(x)
    yCauchy <- dcauchy(x)
    yt <- dt(x, df=df)
    par(bg="white")
    plot(x, yNorm, type="l", ylab="Density")
    lines(x, yt, col=2)
    lines(x, yCauchy, col=4)
    legend("topright", legend=c("standard normal", paste0("t (df = ", df, ")"), "Cauchy"), 
       col=c(1,2,4), lty=1)
}

png(file="figure/threeDist%02d.png", width=500, heigh=500)
  lapply(1:20, threeDists)
dev.off()

shell("imConvert -delay 40 figure/threeDist*.png dist3.gif")

Now the html, docx and pdf files are created.
There's still something wrong with the html file. After the gif animation there are no more chapters displayed. The html code has all the chapters but they aren't displayed in google chrome and internet explorer. I wasn't planning on using html files so it's no problem for me.

@humburg
Copy link
Owner

humburg commented Oct 15, 2014

Thanks for working through these issues. I have closed this as you immediate problem seems to be resolved. If you have any additional information on the issues with the HTML version I'd be happy to try and resolve that as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants