2

I'm using exsheets package. I want variations with different point values.

\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}

I want two different point value:

\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}

But it fails on changed line:

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

Is there any solutions without create two full question (the differences between questions only the numbers)?

  • 1
    That's not possible with the current implementation. I'll add something to the next release and will write an answer then – clemens Dec 13 '13 at 14:37
  • Oh, understand. Many-many thanks for your work! – uzsolt Dec 13 '13 at 19:12
1

Since v0.12 exsheets provides a possibility: a leading bang in the points argument to the question environment prevents parsing of the points:

\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}

enter image description here

This comes with a cost: the points are not added to the sum of points any more. Should that be needed one could define something like

\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}}%
}

and use it instead. (However, for the example this would sum both points from group A and group B – surely not what's wanted.

The easiest but maybe not safest way would be to define

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

and swap arguments between compilations...

  • Wow! Great work! Now we have summer vacation but I'll try it! Thanks again! – uzsolt Jul 4 '14 at 19:33
  • @uzsolt You're welcome! If you like the answer you can thank be by upvoting :) – clemens Jul 4 '14 at 19:37
  • Ooops, I've accepted but didn't upvote. – uzsolt Jul 5 '14 at 5:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.