SCM

Forum: support

Monitor Forum | Start New Thread Start New Thread
RE: embedding external png image into moodle xml [ reply ]
By: Arpad Rozsas on 2016-02-09 21:48
[forum:42891]
Thank you very much for your prompt reply! It works perfectly with the development version.

RE: embedding external png image into moodle xml [ reply ]
By: Achim Zeileis on 2016-02-09 21:30
[forum:42890]
Arpad,

this is a good question which didn't have a very elegant solution until recently. The reason why a simple \includegraphics{} does not work is that the corresponding file will not be processed as a supplementary file unless it is copied into the temporary directory where the .Rnw files are processed.

To do this by hand, you need to say
file.copy("/path/to/the/figure.png", "figure.png")

And then in the LaTeX part you just say
\includegraphics{figure.png}

In the current devel version of "exams" (2.2-0) which can be readily installed from R-Forge there is a more elegant command instead of the file.copy() now:
include_supplement("figure.png")
and the file will be searched (by default) in the same directory where the .Rnw/.Rmd exercises are.

For a worked example, install the most recent version of "exams"
install.packages("exams", repos = "http://R-Forge.R-project.org")

And then run:
library("exams")
exams2html("Rlogo.Rnw")

Hope that helps,
Z

embedding external png image into moodle xml [ reply ]
By: Arpad Rozsas on 2016-02-09 21:06
[forum:42889]
Hi,

Could someone provide a minimal working example or guidance on how to embed an external (not R generated) png image into moodle xml using exams2moodle()?

I am able to do this with pdf and html outputs by using \includegraphics{} within a sweave document, however it is not working with xml output: the file is generated without warning but the image is missing when I check it in moodle.

Since an R command generated plot is smoothly included in xml I guess I am missing something obvious here.
Thanks in advance and thanks for this great package.

Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge