R -Markdown中未显示的桌子 - 考试2MOODLE
一旦我将R-Exams软件包生成的Moodle XML文件上传到Moodle时,我就会在Moodle中渲染表格。我正在使用以前教授助手交给我的.RMD格式的练习文件。这些.RMD文件包含大量使用乳胶语言的表。一旦我上传了Moodle XML文件,所有这些表都简直就是缺少。我试图查找解决方案,但找不到任何有用的东西。
有趣的是,当在R-Studio中使用“ awss2pdf”命令时,这些表被正确地渲染到PDF中。但是,当使用“考试2moodle”时,这些表根本没有在Moodle中显示。
我在下面的其中一个.rmd文件中显示了该表的示例:
我很感激是否有人能提供任何指导,因为我真的遇到了这个问题。
I have a serious problem with rendering tables in Moodle once I upload the Moodle XML file generated by R-exams package to Moodle. I am using exercise files in .Rmd format handed to me from a previous professor's assistant. These .Rmd files contain lots of tables using Latex language. Once I upload the Moodle XML file, all of these tables are simply missing. I have tried to look up a solution, but could not find anything helpful on this.
Interestingly, these tables are rendered properly into PDF when using "exams2pdf" command in R-studio. However, when using "exams2moodle", these tables are simply not shown in Moodle.
I am showing an example of the table in one of these .Rmd files below:
I would appreciate if anyone could provide any guidance, as I got really stuck with this issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
tl; dr:问题是,您将sarkdown格式的练习与乳胶含量混合。这仅在渲染通过乳胶时起作用(有关详细信息,请参见下文)。取而代之的是,您可以将问题从r/markdown(.rmd)转换为r/latex(.rnw),也可以将表格的格式从乳胶转换为markdown。在这种情况下,两者都是可行的。如果您需要帮助,请共享(链接)练习代码,而不仅仅是部分截图。
提示:如果您使用
考试>
的至少版本2.4-0, exam> exams2moodle()获得了一个参数table
table
您可以在其中设置一个类,以更加精心地格式化表格,例如,table =“ table_shade”
或“ table_rule”
或“ table_grid” 。
详细信息:您有一个r/markdown格式的问题,其中包含乳胶格式的表。当您使用
exam2pdf()
时,此功能是因为渲染在以下步骤中起作用:编织
r/markdown to markdown(保留乳胶表)。pandoc
将标记转换为乳胶(保存乳胶表)。texi2pdf
或latexmk
渲染乳胶(包括表)到PDF。因此,至关重要的是,您要执行从乳胶到输出格式的渲染步骤。尽管
exams2moodle()
或其他基于HTML输出的引擎并非如此。这些步骤仅为:编织
r/markdown至markdown(保存乳胶表)。pandoc
将标记转换为HTML(这不知道如何渲染乳胶表,因此将其删除)。因此,问题在于,在这种情况下,乳胶没有渲染或转换步骤。如果您进行了HTML内容的R/Markdown练习,也是如此。这些可以使用
exam2moodle()
渲染,因为HTML只需要保留 - 但不使用exam2pdf()
,因为HTML不会转换为乳胶。TL;DR: The problem is that you mix an exercise in Markdown format with LaTeX content. This only works if the rendering goes via LaTeX (see below for details). Instead you could convert your question from R/Markdown (.Rmd) to R/LaTeX (.Rnw) - or convert the formatting of the table from LaTeX to Markdown. Both would be feasible in this case. If you need help with this, please share (a link to) the code for the exercise and not just a screenshot of parts of it.
Hint: If you're using at least version 2.4-0 of
exams
,exams2moodle()
gained an argumenttable
where you can set a class for formatting the table a bit more nicely, e.g.,table = "table_shade"
or"table_rule"
or"table_grid"
.Details: You have a question in R/Markdown format which contains a table in LaTeX format. When you use
exams2pdf()
this works because rendering works in the following steps:knit
R/Markdown to Markdown (preserving the LaTeX table).pandoc
(preserving the LaTeX table).texi2pdf
orlatexmk
.Thus, it is crucial that you do a rendering step from LaTeX to the output format. This is not the case though for
exams2moodle()
or other engines based on HTML output. The steps are just:knit
R/Markdown to Markdown (preserving the LaTeX table).pandoc
(which does not know how to render the LaTeX table and hence drops it).Thus, the problem is that there is no rendering or transformation step from LaTeX in this case. The same would be true if you had R/Markdown exercises with HTML content. These could be rendered with
exams2moodle()
because the HTML would just need to be preserved - but not withexams2pdf()
because the HTML would not be converted to LaTeX.