我是R的新手,几乎不了解R考试的基础知识。我已经成功地使用它来进行打印(exams2pdf)和上载到画布的考试,但是当我尝试运行exams2pandoc时,却不断出现以下错误:
Error in make_exams_write_pandoc(name = name, type = type, template = template, :
invalid template: exactly 9 '#-' lines required (and 0 found)
我不明白它在告诉我什么,需要一点指导。
[注意-在我试图找出问题的过程中,exams2pandoc确实在其中一个示例文件(例如switzerland.Rmd)上成功输出了docx文件,也许一次或两次,但是现在我不断收到错误消息上面的消息与文件无关。
我不确定目前要尝试什么(例如,调整一个模板文件),我也不知道该怎么做。在此先感谢您的协助。
您的问题听起来像包装中附带的exams2pandoc()
模板已被修改/损坏。我建议重新安装exams
软件包。之后,exams2pandoc(c("swisscapital.Rmd", "deriv.Rmd"))
应该再次工作并生成文件pandoc1.docx
。
如果要修改模板,可以这样做,但是文档记录不充分。此外,模板格式在将来的版本中可能会更改,但仍是临时的。默认模板是LaTeX文件plain.tex
:
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{a4wide,color,Sweave,url,amsmath,booktabs,longtable}
\begin{document}
%% Exam ##ID##
%% ##Date##
\begin{enumerate}
#-
\item
#-
\textbf{##Questionheader##}\\
#-
##Question##
#-
\begin{enumerate}[(a)]
\item ##Questionlist##
\end{enumerate}
#-
\textbf{##Solutionheader##}\\
#-
##Solution##
#-
\begin{enumerate}[(a)]
\item ##Solutionlist##
\end{enumerate}
#-
#-
\end{enumerate}
\end{document}
[您看到#-
行用于定义模板文件中包含某些占位符的几个部分。如果要省略问题标题,则最简单的方法是创建一个文件,例如说myplain.tex
,并在此行加上注释:
%% \textbf{##Questionheader##}\\
类似地,其他部分可以被注释或修改。然后您可以呼叫exams2pandoc(..., template = "myplain.tex")
。