为什么 TikZ 图形是用exams2pdf 渲染的,而不是用exams2moodle 渲染的? [英] Why are TikZ graphics rendered with exams2pdf but not with exams2moodle?

查看:46
本文介绍了为什么 TikZ 图形是用exams2pdf 渲染的,而不是用exams2moodle 渲染的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了

然而,使用 exams2pdf() 时的结果是最佳的,如下所示:

问题出在哪里?

解决方案

在将练习编译为 PDF 时,TikZ 代码由 pdfLaTeX 呈现,就像练习文本的其余部分一样.这部分适合您.

然而,当将练习编译为 Moodle 的 XML 时,TikZ 代码首先由 pdfLaTeX 渲染为 PDF(如上所示),然后使用 R 包 magick 转换为 PNG.然后将 Markdown 文本转换为 HTML,并将 PNG 图形嵌入到 HTML 中.显然,除了这些步骤中的一个之外,所有步骤都适合您.将 PDF 图形转换为 PNG 失败,因为您没有安装 magick.

如果您在安装 magick 时遇到问题,请参阅 介绍性小插图 了解更多详情.

I have used the R/exams exercise from http://www.R-exams.org/templates/automaton/, more specifically the automaton.Rmd version of the exercise with the aim of importing the exercise from a Moodle platform via exams2moodle().

Having used three different Moodle platforms, the result was always similar to the one shown in the following image:

Whereas, the results when using exams2pdf(), are optimal, as seen below:

Where can the fault be?

解决方案

When compiling the exercise to PDF, the TikZ code is rendered by pdfLaTeX, just like the rest of the exercise text. This part works for you.

However, when compiling the exercise to XML for Moodle, the TikZ code is first rendered to PDF by pdfLaTeX (like above) and subsequently converted to PNG using the R package magick. Then the Markdown text is converted to HTML and the PNG graphic embedded in the HTML. Apparently all but one of these steps work for you. The conversion of the PDF graphic to PNG fails because you don't have magick installed.

In case you have problems with the installation of magick, see the introductory vignette for more details.

这篇关于为什么 TikZ 图形是用exams2pdf 渲染的,而不是用exams2moodle 渲染的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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