3

I used the exsheets class for my exercises and exams and everything is very configurable but I have some issues with the dealing of points by questions...

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

A solution is that you put manually the total by question but I am sure that there is a solution with automatic compute ?

Thanks you in advance.

Greetings.

Benoit

1

This is actually rather easy with an up to date version of exsheets. The idea is this: define a new container (a box or rather coffin in l3) which holds the points of a question:

\DeclareExSheetsHeadingContainer{autopoints}{%
  \points{\GetQuestionProperty{points}{\CurrentQuestionID}}%
}

\GetQuestionProperty here needs two compilations for fetching the correct value.

Now use the new container (I called it autopoints) instead of the predefined points container in the heading instance in use. For the example below I copied the definition of the block heading as myblock and exchanged points by 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)
   }
}

Now all you have to do is use the new heading:

\SetupExSheets{headings = myblock}

Here is the complete example:

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

enter image description here

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.