Using knitr generated video with pandoc & slidy - slideshow

I am writing a slide-show in Rmd (markdown) using Rstudio & Knitr (Ubuntu 12-04). I generated some videos with the chunk option fig.show='animate' that can be seen well with the knitr generated HTML.
Then I use pandoc to generate the slidy HTML code but then the videos are not displayed and the following message is shown:
Could not find the video format and MIME type supported
Does anyone know how to make these videos work with slidy?

Related

Conversion from ttf to type 2 CID font (type 42 base font)

I have ttf font files for Indian languages such as Tamil, Telugu, Malayalam, etc.
In order to access ttf files through a postscript program, I have to convert them to Type 2 CIDfont (Type 42 base font).
I tried online conversion (as well as utilities from GitHub) but unfortunately they all failed to convert.
Is there any conversion utility available?
As I could not proceed further with my work due to font conversion issue, so I decided to take up conversion task by myself.
Since I was neither a font programmar nor a font designer, I had to learn the internals of ttf (Apple Computers) and
Type 0 composite fonts (Adobe Corporation), just enough to write a conversion program, with the help of the following documents.
Microsoft OpenType® Specification Version 1.9
Fonts - TrueType Reference Manual - Apple Developer
PostScript Language Reference, third edition - Adobe Corporation (912 pages PDF, 7410K) Feb/1999
The Type 42 Font Format Specification #5012 (28 pages PDF, 159k) 31/Jul/1998
Adobe CMap and CID Font Files Specification #5014 (102 pages PDF, 541k) 11/Jun/1996 Version 1.0
In order to benefit others, I have just released this conversion utility through GitHub on the following platforms.
Windows 10 Platform (Github Public Repository for Conversion Utility on Windows 10)
Open up DOS command line and issue the following clone command to download source code:
git clone https://github.com/marmayogi/TTF2PostscriptCID-Win
Or execute the following curl command to download source code release in zip form:
curl -o TTF2PostscriptCID-Win-3.0.zip -L https://github.com/marmayogi/TTF2PostscriptCID-Win/archive/refs/tags/v3.0.zip
Or execute the following wget command to download source code release in zip form:
wget -O TTF2PostscriptCID-Win-3.0.zip https://github.com/marmayogi/TTF2PostscriptCID-Win/archive/refs/tags/v3.0.zip
Linux Platform (Github Public Repository for Conversion Utility on Linux)
Issue the following clone command to download source code:
git clone https://github.com/marmayogi/TTF2PostscriptCID-Linux
Or execute the following curl command to download source code release in tar form:
curl -o TTF2PostscriptCID-Linux-3.0.tar.gz -L https://github.com/marmayogi/TTF2PostscriptCID-Linux/archive/refs/tags/v3.0.tar.gz
Or execute the following wget command to download source code release in tar form:
wget -O TTF2PostscriptCID-Linux-3.0.tar.gz https://github.com/marmayogi/TTF2PostscriptCID-Linux/archive/refs/tags/v3.0.tar.gz
Note:
This utility converts ttf file to t42 file which is readily accessible through a postscript program. This conversion program also generates a ps file (a postscript program) which will display all the glyphs associated with the character set of ttf file.
The two program files (main.cpp and ttf.h) are 100% portable. i.e. the contents of two files are same and identical across platforms.
A README Document in Markdown format has been included with the release.
This conversion software has been tested for the following Indian Languages successfully whose number of Glyphs exceed 256 characters with horizontal writing.
Tamil
Malayalam
Telugu
Kannada
Gujarati
Gurmukhi (Punjabi)
Oriya
Bengali (Assamese)
Devanagari (Sanskrit, Hindi and Marathi)

"Unable to load picture or PDF file" ONLY when knitting rmd in one system

With a colleague, we are working on this github repo. When I knit manuscript.Rmd, I get an error "Unable to load picture or PDF file 'nwr.by.freq.ITEM'." as in this commit. When she knits it, it works fine, as in this commit.
The error comes after all chunks have been done, so it's not a problem within R/RStudio. (Plus, we are using renv, and I already checked for discrepancies between versions of our R, Rstudio, and packages.) The problem must come from knitting, so in the pandoc stage or thereabouts.
Given that we have some phonetic symbols (which is why we need to generate the figure in a png, and then read it back in), we are using xelatex as our engine, as recommended here. I don't think these symbols are the problem -- but I do suspect the issue is a divergence between her latex engine and mine. I'm not totally sure how to check for that...
(I'll be trying to answer my own question, so you can just wait and see if I crack this alone!)
To begin with, I updated xelatex, which led to a missing apa6.cls error. Following papaja install instructions, I would ideally re-install mactex -- but while it downloads (since it takes 1h), I just installed tinytex with tinytex::install_tinytex(). At my first attempt to knit the document after that, tinytex downloaded many things. And then the knit went through! Problem solved.

I can't knit my rmarkdown files - pandoc error

My university provided laptop was recently replaced and now when I try to knit my Rmd files if get the following error:
pandoc.exe: \\: openBinaryFile: invalid argument (Invalid argument)
Error: pandoc document conversion failed with error 1
Execution halted
These files used to knit perfectly on my old laptop and all of the code blocks within the file still run without errors.
The pandoc_available() function returns TRUE
The answers to similar questions that I have searched suggest it is something to do with the file paths but I am not familiar enough with this to make sense of what I should do. I tried mapping a network drive (Z:) to the folder where the Rmd file is stored and then changing the working directory in RStudio to that drive but it hasn't helped (and now I don't know how to change it back to ~ or what that referred to in the first place)
I have also tried downloading the latest version of Pandoc and a search on Windows Explorer shows that has installed in my user directory but I also have a version in C:\Program Files\RStudio\bin. That has also not helped.
I'm not sure if this is relevant but here is the information on the R version that I am running:
R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
Can you tell me what other information is required to diagnose the problem and I will edit to include.
I am sorry this question is so poorly specified and would appreciate any help to improve it.
**** UPDATE ****
I have found that if I
(i) specify that I want a .md file in the YAML header,
(ii) create an .md file by knitting the markdown file,
(iii) copy that .md file manually to the Pandoc directory
(iv) run pandoc.exe -s -o test.knit.md test.html from the MSDOS command prompt within the Pandoc directory,
then I can create the html output file.
However, changing the working directory for RStudio to the Pandoc directory and running
x <- rmarkdown::render("test.Rmd", run_pandoc = FALSE, clean = FALSE)
knit_meta <- attr(x, "knit_meta")
rmarkdown::render( input = 'test.knit.md' , knit_meta = knit_meta )
as per https://stackoverflow.com/questions/38908766/how-to-generate-an-md-file-from-a-rmarkdown-file-containing-an-htmlwidget gives the same error as shown in my original post.
Does this prompt any thoughts that might lead to a solution to my problem?
The university IT people were able to solve my problem by uninstalling R and RStudio from the network drive and installing it on the C: drive and I am now able to knit successfully.

rmarkdown error: "myfile.tex"' had status 1

I am trying to compile an RMarkdown document from an R script. This is the code I am running:
setwd("C:/Users/me/me_VN02_5676/myfolder")
rmarkdown::render("myrmd.Rmd",
output_file = "mypdf.pdf")
This results in the error:
Error: Failed to compile mypdf.tex.
In addition: Warning message:
running command '"pdflatex" -halt-on-error -interaction=batchmode "mypdf.tex"' had status 1
Does anyone know what is happening?
Additional Notes
The PDF file is created when I use the Knit button in RStudio
This code does produce the .Tex file and when I run that it produces the pdf but render() does not produce the pdf
When I run the .R file via the command line it works! The PDF is created but why doesn't it work in R studio?
It would help to provide a Minimal Working Example so that we can attempt to replicate the problem. However, there may be two potential causes:
File Paths Look Incorrect
In R, they should be specified with a single forward slash: https://stat.ethz.ch/R-manual/R-devel/library/base/html/file.path.html
setwd("C:/Users/me/me_VN02_5676/myfolder")
rmarkdown::render("myrmd.Rmd",
output_file = paste0("mypdf.pdf")
)
PDF Output File May be Open
Another potential cause of this is that the PDF file is open, and therefore pandoc cannot save the output PDF. Try closing the PDF and render the document again.
Link to previous issue in Knitr which relates to this: https://github.com/yihui/knitr/issues/1209

Inkscape export from PDF to EMF with the command line (output is blank)

I'm trying to convert a PDF file (of only one page) to EMF. If I do it from the Inkscape GUI with the default options the outcome is perfect.
But if I do it with command line the outcome is a blank page.
I'm using this command:
inkscape -f=test.pdf --export-emf=test.emf
Can anybody help?
Inkscape is working. I was trying to open the file with paint.exe