使用考试包生成带有图像的 Moodle 练习 [英] Generate Moodle exercises with images using the exams package

查看:47
本文介绍了使用考试包生成带有图像的 Moodle 练习的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 exams 包,我想用它生成一些包含一些图像的 Moodle 练习.尽管在 *rmd 文件中使用此代码:

```{r, echo = FALSE, results = 隐藏"}考试::包括_补充(ae1_2_1e2.png")``问题========问题正文:\定心$\includegraphics[width=0.55 \textwidth] {ae1_2_1e2.png}$答案列表----------* 回答一个* 回答 b* 答案 c* 回答 d解决方案========答案列表----------* 真的* 错误的* 错误的* 错误的元信息================姓名:ae1_2_1extype:选择溶解度:1000洗牌:4

在 Moodle 中产生的结果:

另一个问题是,该软件包是否允许在 Moddle 练习(即选择)中使用图像作为选项?示例:

```{r, echo = FALSE, results = hide", out.width = 20%"}考试::包括_补充(c(ae4_3_2_1e2.png",ae4_3_2_3e4.png"))``问题========对于右尾检验(使用 Neyman-Pearson 标准),哪个是 t 检验(独立样本)的拒绝域?答案列表----------* \ ![](ae4_3_2_1e2.png) $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1+n_2-2)}\bigg] \cup \bigg[t_{1-\frac{\alpha}{2};(n_1+n_2-2)};+\infty\bigg[$.* \ ![](ae4_3_2_1e2.png) $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1-n_2)}\bigg] \cup \bigg[t_{1-\frac{\alpha}{2};(n_1-n_2)};+\infty\bigg[$.* \ ![](ae4_3_2_3e4.png) $\bigg[t_{1-\alpha;(n_1-n_2)};+\infty\bigg[$.* \ ![](ae4_3_2_3e4.png) $\bigg[t_{1-\alpha;(n_1+n_2-2)};+\infty\bigg[$.

已解决

您不能在不同的选项中使用相同的图像文件.如果您想使用相同的图像,您必须制作它的副本并使用不同的名称.所以新代码:```{r, echo = FALSE, results = 隐藏",out.width = 20%"}考试::包括_补充(c(ae4_3_2_1.png",ae4_3_2_3.png",ae4_3_2_2.png",ae4_3_2_4.png"))``问题========对于右尾检验(使用 Neyman-Pearson 标准),哪个是 t 检验(独立样本)的拒绝域?答案列表----------* \ ![](ae4_3_2_1.png){width=20%} $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1+n_2-2)}\bigg]\cup \bigg[t_{1-\frac{\alpha}{2};(n_1+n_2-2)};+\infty\bigg[$.* \ ![](ae4_3_2_2.png){width=20%} $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1-n_2)}\bigg] \cup\bigg[t_{1-\frac{\alpha}{2};(n_1-n_2)};+\infty\bigg[$.* \ ![](ae4_3_2_3.png){width=20%} $\bigg[t_{1-\alpha;(n_1-n_2)};+\infty\bigg[$.* \ ![](ae4_3_2_4.png){width=20%} $\bigg[t_{1-\alpha;(n_1+n_2-2)};+\infty\bigg[$.元信息================姓名:RTTextype:选择排除:0001洗牌:真

结果(感谢@Achim):

解决方案

当你在使用 R/Markdown (.Rmd) 练习时,那么 Markdown 应该用于包含静态图形文件:

问题文本:\![](ae1_2_1e2.png)

包含 LaTeX 是可能的,但仅适用于数学方程 - 将 \includegraphics{} 置于数学模式在这里是不合适的.

包含静态 PNG 文件的示例模板位于:

I am using the exams package, I want to generate some Moodle exercises with it which incorporate some images. Although using this code in a *rmd file:

```{r, echo = FALSE, results = "hide"}
exams::include_supplement("ae1_2_1e2.png")
```
Question
========
Question text:

\centering
$\includegraphics[width=0.55 \textwidth] {ae1_2_1e2.png}$

Answerlist
----------
* answer a
* answer b
* answer c
* answer d


Solution
========


Answerlist
----------
* True
* False
* False
* False


Meta-information
================
exname: ae1_2_1
extype: schoice
exsolution: 1000
exshuffle: 4

Which produces this results in Moodle:

Another question is, does the package allows to use images as options in the Moddle exercises (i.e. schoice)? Example:

```{r, echo = FALSE, results = "hide", out.width = "20%"}
exams::include_supplement(c("ae4_3_2_1e2.png","ae4_3_2_3e4.png"))
```
Question
========
For a right-tailed test (using the Neyman-Pearson criteria), which would be the rejection region for a t-test (independent samples)?

Answerlist
----------
* \ ![](ae4_3_2_1e2.png) $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1+n_2-2)}\bigg] \cup \bigg[t_{1-\frac{\alpha}{2};(n_1+n_2-2)};+\infty\bigg[$.
* \ ![](ae4_3_2_1e2.png) $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1-n_2)}\bigg] \cup \bigg[t_{1-\frac{\alpha}{2};(n_1-n_2)};+\infty\bigg[$.
* \ ![](ae4_3_2_3e4.png) $\bigg[t_{1-\alpha;(n_1-n_2)};+\infty\bigg[$.
* \ ![](ae4_3_2_3e4.png) $\bigg[t_{1-\alpha;(n_1+n_2-2)};+\infty\bigg[$.

SOLVED

You cannot have the same image file in different options. If you want to use the same image, you have to produce a copy of it and use a different name.

So the new code:

```{r, echo = FALSE, results = "hide", out.width = "20%"}
exams::include_supplement(c("ae4_3_2_1.png","ae4_3_2_3.png","ae4_3_2_2.png","ae4_3_2_4.png"))
```
Question
========
For a right-tailed test (using the Neyman-Pearson criteria), which would be the rejection region for a t-test (independent samples)?

Answerlist
----------
* \ ![](ae4_3_2_1.png){width=20%} $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1+n_2-2)}\bigg] \cup \bigg[t_{1-\frac{\alpha}{2};(n_1+n_2-2)};+\infty\bigg[$.
* \ ![](ae4_3_2_2.png){width=20%} $\bigg]-\infty;-t_{1-\frac{\alpha}{2};(n_1-n_2)}\bigg] \cup \bigg[t_{1-\frac{\alpha}{2};(n_1-n_2)};+\infty\bigg[$.
* \ ![](ae4_3_2_3.png){width=20%} $\bigg[t_{1-\alpha;(n_1-n_2)};+\infty\bigg[$.
* \ ![](ae4_3_2_4.png){width=20%} $\bigg[t_{1-\alpha;(n_1+n_2-2)};+\infty\bigg[$.

Meta-information
================
exname: RTT
extype: schoice
exsolution: 0001
exshuffle: TRUE

And the result (thanks to @Achim):

解决方案

When you are using R/Markdown (.Rmd) exercises, then Markdown should be used for including static graphic files:

Question text:
\
![](ae1_2_1e2.png)

Inclusion of LaTeX is possible but only for mathematical equations - putting the \includegraphics{} into math mode is not appropriate here.

An example template that includes a static PNG file is available at: http://www.R-exams.org/templates/Rlogo/. Note that the backslash embeds the image in such a way that no caption is added here. See the pandoc documentation for more details: https://pandoc.org/MANUAL.html#images

Below is also a worked example (mice.Rmd) for images as answers in Moodle, restricting the width to the same value for all images:

```{r, include=FALSE}
download.file("https://i.pinimg.com/originals/f7/7b/17/f77b173fb104d07130697c9d3a024e75.png", "a.png")
download.file("https://upload.wikimedia.org/wikipedia/en/thumb/f/fe/Speedy_Gonzales.svg/1200px-Speedy_Gonzales.svg.png", "b.png")
download.file("https://www.disneyclips.com/images3/images/basil-great-mouse-detective.png", "c.png")
```

Question
========
Which of these cartoon mice belongs to the Disney franchise?

Answerlist
----------
* ![](a.png){width=20%}
* ![](b.png){width=20%}
* ![](c.png){width=20%}

Meta-information
================
exname: Mice
extype: schoice
exsolution: 001
exshuffle: TRUE

In Moodle this is rendered in the following way:

这篇关于使用考试包生成带有图像的 Moodle 练习的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆