r-exams包提供了使用\ url {some link}宏向问题添加url的可能性,但是我想隐藏该链接并显示一些文本,例如:\ command {www。 r-exams.org} {R / EXAMS}。有可能吗?
答案 0 :(得分:1)
在R / LaTeX(Rnw)练习中,您可以使用\href{...}{...}
命令执行此操作。在R / Markdown(Rmd)练习中,可以使用[...](...)
语法。分别参见以下rexams.Rnw
和rexams.Rmd
。
要生成要导入Moodle的Moodle XML文件,请使用
exams2moodle("rexams.Rnw")
并更快地预览HTML代码的外观
exams2html("rexams.Rnw")
在后一种情况下,您还可以添加参数converter = "pandoc-mathjax"
,以便您使用exams2moodle()
默认使用的相同HTML转换器。 rexams.Rmd
文件也一样。两个HTML转换器(ttm和pandoc)都支持这些语法以用于指定超链接。
仅当转换为PDF时,默认模板不起作用,但您需要执行类似的操作
exams2pdf("rexams.Rnw", template = "mytemplate.tex")
其中"mytemplate.tex"
必须是包含{hyperref}
软件包的合适LaTeX模板。有关更多详细信息,请参见vignette("exams", package = "exams")
中的第3节。 {hyperref}
未包含在默认模板中的原因是:(a){hyperref}
具有相当的“侵略性”,并且改变了文档格式的许多方面,并且(b)默认的PDF配置用于打印而不是超链接,因为基于HTML的格式更适合后者。
rexams.Rnw
\begin{question}
How many times do you see the logo on the
\href{http://www.R-exams.org/}{R/exams web page}?
\end{question}
\exname{R/exams logo}
\extype{num}
\exsolution{2}
rexams.Rmd
Question
========
How many times do you see the logo on the
[R/exams web page](http://www.R-exams.org/)?
Meta-information
================
exname: R/exams logo
extype: num
exsolution: 2