如何在 R/exams 中使用 LaTeX 包? [英] How to use a LaTeX package with R/exams?

查看:22
本文介绍了如何在 R/exams 中使用 LaTeX 包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I am using exams2moodle() to create exam quizzes. I would like to use some math symbols which require the LaTeX package amssymb. How should I proceed?

解决方案

TL;DR: amssymb LaTeX symbols are supported by MathJax which is the default renderer in a standard Moodle installation. So these symbols should work out of the box when using exams2moodle(..., converter = "pandoc-mathjax") which is the default sinc R/exams 2.3.3 (released in July 2019).

Details: As already pointed out by the answer of @Hack-R, there are various ways of including mathematical notation written in LaTeX in HTML-based exercises. An overview is given in this blog post: http://www.R-exams.org/tutorials/math/

It is important to note that in this case the LaTeX code is not actually processed by LaTeX itself. It can either be converted to MathML (using pandoc or ttm) or rendered in the browser by the MathJax JavaScript library. In any case it depends on the converter/renderer which LaTeX commands can be successfully displayed. All of them support basic LaTeX commands plus some extra commands from certain packages. Which additional commands from which packages are supported depends on the converter/renderer. In any case, the capabilities can not be extended by style files!

In a standard Moodle installation MathJax is enabled which suports the AMS LaTeX package (because MathJax was developed by/for the AMS!). So the best strategy is to simply keep the LaTeX in the HTML for Moodle. This can be done with exams2moodle(..., converter = "pandoc-mathjax") which is actually the default converter since R/exams 2.3.3 released in July 2019. In previous versions of R/exams, the default was converter = "ttm" which did not support all the amssymb symbols.

这篇关于如何在 R/exams 中使用 LaTeX 包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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