我使用 exsheets 课程进行练习和考试,一切都非常可配置,但我对按问题处理积分有一些问题......
\documentclass{scrartcl}
\usepackage{exsheets}
\begin{document}
\SetupExSheets[question]{print=true}
\SetupExSheets[solution]{print=true}
% Note in my version of exam : questions and solutions are not display in the same file => 2 pdf exam witch questions and corrections
% The solution with grading table is also not automatic...
\begin{question}% I want the total points computed automatically ?
\begin{enumerate}
\item \addpoints{1}
Question 1
\item \addpoints{2}
Question 2
\end{enumerate}
\currentpointssum*
\end{question}
\begin{solution}% I want the total points computed automatically ?
\begin{enumerate}
\item \points{1}
Question 1
\item \points{2}
Question 2
\end{enumerate}
\end{solution}
\begin{question}
\begin{enumerate}
\item \addpoints{3}
Question II.1
\item \addpoints{4}
Quesion II.2
\end{enumerate}
\currentpointssum*
\end{question}
\begin{solution}
\begin{enumerate}
\item \points{3}
Question II.1
\item \points{4}
Quesion II.2
\end{enumerate}
\currentpointssum*
\end{solution}
\end{document}
一个解决方案是您手动输入问题总数,但我确定有一个可以自动计算的解决方案?
提前谢谢你。
问候。
伯努瓦
答案1
使用最新版本的 ,这实际上相当容易exsheets
。想法是这样的:定义一个新的容器(l3 中的盒子或棺材)来保存问题的要点:
\DeclareExSheetsHeadingContainer{autopoints}{%
\points{\GetQuestionProperty{points}{\CurrentQuestionID}}%
}
\GetQuestionProperty
这里需要两次编译才能获取正确的值。
现在使用新容器(我称之为autopoints
)代替points
正在使用的标题实例中的预定义容器。对于下面的示例,我将标题的定义复制block
为myblock
并替换points
为autopoints
:
\DeclareInstance{exsheets-heading}{myblock}{default}{
join = { title[r,B]number[l,B](1ex,0pt) } ,
attach = {
main[l,vc]title[l,vc](0pt,0pt) ;
main[r,vc]autopoints[l,vc](\marginparsep,0pt)
}
}
现在您要做的就是使用新的标题:
\SetupExSheets{headings = myblock}
以下是完整的示例:
\documentclass{scrartcl}
\usepackage{exsheets}[2015/11/18]% need v0.20
% define a new heading container which fetches the points of a question:
\DeclareExSheetsHeadingContainer{autopoints}{%
\points{\GetQuestionProperty{points}{\CurrentQuestionID}}%
}
% define a variant of the `block' heading which uses the new container instead
% of the usual one for points:
\DeclareInstance{exsheets-heading}{myblock}{default}{
join = { title[r,B]number[l,B](1ex,0pt) } ,
attach = {
main[l,vc]title[l,vc](0pt,0pt) ;
main[r,vc]autopoints[l,vc](\marginparsep,0pt)
}
}
% setup exsheets to use the new heading:
\SetupExSheets{
headings = myblock ,
question/print=true ,
solution/print=true
}
\begin{document}
\begin{question}
\begin{enumerate}
\item \addpoints{1}
Question 1
\item \addpoints{2}
Question 2
\end{enumerate}
\end{question}
\begin{question}
\begin{enumerate}
\item \addpoints{3}
Question II.1
\item \addpoints{4}
Quesion II.2
\end{enumerate}
\end{question}
\end{document}