使用考试包生成带有图像的 Moodle 练习
Generate Moodle exercises with images using the exams package
我正在使用 exams
包,我想用它生成一些包含一些图像的 Moodle 练习。尽管在 *rmd
文件中使用此代码:
```{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
在 Moodle 中产生这个结果:
另一个问题是,该软件包是否允许在 Moddle 练习中使用图像作为选项(即选择)?示例:
```{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[$.
已解决
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
结果(感谢@Achim):
当你使用R/Markdown(.Rmd)习题时,需要使用Markdown来包含静态图形文件:
Question text:
\
![](ae1_2_1e2.png)
可以包含 LaTeX,但仅适用于数学方程式 - 将 \includegraphics{}
置于数学模式在这里不合适。
包含静态 PNG 文件的示例模板位于: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
下面也是一个工作示例 (mice.Rmd
),将图像作为 Moodle 中的答案,将所有图像的宽度限制为相同的值:
```{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
在 Moodle 中,这是按以下方式呈现的:
我正在使用 exams
包,我想用它生成一些包含一些图像的 Moodle 练习。尽管在 *rmd
文件中使用此代码:
```{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
在 Moodle 中产生这个结果:
另一个问题是,该软件包是否允许在 Moddle 练习中使用图像作为选项(即选择)?示例:
```{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[$.
已解决
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
结果(感谢@Achim):
当你使用R/Markdown(.Rmd)习题时,需要使用Markdown来包含静态图形文件:
Question text:
\
![](ae1_2_1e2.png)
可以包含 LaTeX,但仅适用于数学方程式 - 将 \includegraphics{}
置于数学模式在这里不合适。
包含静态 PNG 文件的示例模板位于: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
下面也是一个工作示例 (mice.Rmd
),将图像作为 Moodle 中的答案,将所有图像的宽度限制为相同的值:
```{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
在 Moodle 中,这是按以下方式呈现的: