R -Markdown中未显示的桌子 - 考试2MOODLE

发布于 2025-02-11 08:48:14 字数 515 浏览 1 评论 0原文

一旦我将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:

enter image description here

I would appreciate if anyone could provide any guidance, as I got really stuck with this issue.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情深已缘浅 2025-02-18 08:48:14

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()时,此功能是因为渲染在以下步骤中起作用:

  1. 编织 r/markdown to markdown(保留乳胶表)。
  2. 通过pandoc将标记转换为乳胶(保存乳胶表)。
  3. 使用texi2pdflatexmk渲染乳胶(包括表)到PDF。

因此,至关重要的是,您要执行从乳胶到输出格式的渲染步骤。尽管exams2moodle()或其他基于HTML输出的引擎并非如此。这些步骤仅为:

  1. 编织 r/markdown至markdown(保存乳胶表)。
  2. 通过pandoc将标记转换为HTML(这不知道如何渲染乳胶表,因此将其删除)。
  3. 将HTML嵌入XML中以获取Moodle。

因此,问题在于,在这种情况下,乳胶没有渲染或转换步骤。如果您进行了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 argument table 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:

  1. knit R/Markdown to Markdown (preserving the LaTeX table).
  2. Convert Markdown to LaTeX via pandoc (preserving the LaTeX table).
  3. Render LaTeX (including the table) to PDF using texi2pdf or latexmk.

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:

  1. knit R/Markdown to Markdown (preserving the LaTeX table).
  2. Convert Markdown to HTML via pandoc (which does not know how to render the LaTeX table and hence drops it).
  3. Embed HTML in XML for Moodle.

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 with exams2pdf() because the HTML would not be converted to LaTeX.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文