问题分值的变化

问题分值的变化

我在用着外层封装。我想要具有不同点值的变体。

\documentclass[a4paper]{article}
\usepackage[magyar]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{t1enc}
\usepackage{lipsum}
%
\usepackage{titlesec}
\usepackage[load-headings,load-tasks,]{exsheets}
\begin{filecontents}{\jobname-example.inc}
    \begin{question}{2}
        What is the result of \vary{$2+3$}{$1231+4431$}?
    \end{question}
\end{filecontents}
\begin{document}
%
%
\SetVariations{2}
\variant{1}
\section{Group A}
\includequestions{\jobname-example.inc}
\newpage
\variant{2}
\section{Group B}
\includequestions{\jobname-example.inc}
\end{document}

我想要两个不同的点值:

\documentclass[a4paper]{article}
\usepackage[magyar]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{t1enc}
\usepackage{lipsum}
%
\usepackage{titlesec}
\usepackage[load-headings,load-tasks,]{exsheets}
\begin{filecontents}{\jobname-example.inc}
    \begin{question}{\vary{2}{4}} % <<<==== CHANGE =======
        What is the result of \vary{$2+3$}{$1231+4431$}?
    \end{question}
\end{filecontents}
\begin{document}
%
%
\SetVariations{2}
\variant{1}
\section{Group A}
\includequestions{\jobname-example.inc}
\newpage
\variant{2}
\section{Group B}
\includequestions{\jobname-example.inc}
\end{document}

但它在改变的行上失败了:

! You can't use `\long' after \the.

有没有不创建两个的解决方案满的问题(问题之间的区别仅在于数字)?

答案1

由于 v0.12exsheets提供了一种可能性:环境中 points 参数中的前导感叹号question会阻止对点的解析:

\documentclass{article}

\usepackage{exsheets}
\SetVariations{2}

\begin{document}

\variant{1}
\section{Group A}
\begin{question}{!\vary{2}{4}}
  What is the result of \vary{$2+3$}{$1231+4431$}?
\end{question}

\variant{2}\setcounter{question}{0}
\section{Group B}
\begin{question}{!\vary{2}{4}}
  What is the result of \vary{$2+3$}{$1231+4431$}?
\end{question}

\end{document}

在此处输入图片描述

这需要付出代价:积分不再计入总积分。如果需要,可以定义类似

\newcommand*\varypoints[2]{%
  % \addpoints*{} only adds the points to the sum
  % \points*{} only prints them (without `unit')
  \vary
    {\addpoints*{#1}\points*{#1}}
    {\addpoints*{#2}\points*{#2}}%
}

并用它来代替。(但是,对于示例,这将把 A 组中的两个点相加B 组——肯定不是我们想要的。

最简单但可能不是最安全的方法是定义

\newcommand*\varypoints[2]{%
  % \addpoints*{} only adds the points to the sum
  % \points*{} only prints them (without `unit')
  \vary
    {\addpoints*{#1}\points*{#1}}
    {}%
}

并在编译之间交换参数......

相关内容