With a current version of exsheets
the package provides a possibility for this. exsheets
has a command \addpoints
that prints and saves the points for the current {question}
environment. The sum of points of a question is available as a question property named points
that can be retrieved via \GetQuestionProperty{<property>}{<question ID>}
In combination with exsheets
' possibility to create custom headings instances and the command \CurrentQuestionID
it is possible to define a heading type that prints the sum of the points saved with \addpoints
in the {question}
body.
\documentclass{article}
\usepackage{exsheets}
% custom headings instance:
\DeclareInstance{exsheets-heading}{custom}{default}{
% write the sum of points after the title of the question:
title-post-code =
\bfseries~(\GetQuestionProperty{points}{\CurrentQuestionID} Points) ,
% print the title:
attach = { main[l,vc]title[l,vc](0pt,0pt) }
}
% use the newly defined heading instance:
\SetupExSheets{
headings = custom ,
points/name = Point/s
}
\begin{document}
\begin{question}[name=Java]
\begin{enumerate}
\item Hello World (\addpoints{2})
\item for-each (\addpoints{1})
\end{enumerate}
\end{question}
\begin{question}[name=C++]
\begin{enumerate}
\item Bla bla (\addpoints{2})
\item Blub blub (\addpoints{4})
\end{enumerate}
\end{question}
\begin{question}[name=\LaTeX]
\begin{enumerate}
\item Foo foo (\addpoints{2})
\item bar bar (\addpoints{2})
\end{enumerate}
\end{question}
\end{document}

The spacing looks a bit weird but that could be adjusted, e.g., by adding below = .5\baselineskip
to the definition of the headings instance.
With an even more recent version of exsheets
(v0.14 2014/06/28, it's already on CTAN and in TeX Live 2014) it is possible with a little bit of effort to define a grading table. The trick is to use question properties. For this I use the properties subtitle
, counter
and points
that are already defined by exsheets
. The commands \GetQuestionProperty{<property>}{<question id>}
and \ForEachQuestion{<code where #1 refers to the question id>
} I loop through all questions and retrieve the needed data:
\documentclass{article}
\usepackage{exsheets}[2014/06/28]
% a custom headings instance that uses the `subtitle' property:
\DeclareInstance{exsheets-heading}{custom}{default}{
subtitle-format = \bfseries ,
subtitle-post-code =
\bfseries~(\GetQuestionProperty{points}{\CurrentQuestionID} Points) ,
join = {
title[r,B]number[l,B](.333em,0pt) ;
title[r,B]subtitle[l,B](.333em,0pt)
} ,
attach = { main[l,vc]title[l,vc](0pt,0pt) } ,
below = .5\baselineskip
}
% use the new instance, other settings:
\SetupExSheets{
question/name = Task ,
headings = custom ,
points/name = Point/s
}
% define a grading table that retrieves subtitles and points:
\newcommand*\gradingtable{%
\begin{tabular}{|l|*{3}{c|}c|}\hline
Task &
\ForEachQuestion{%
\GetQuestionProperty{counter}{##1}
\GetQuestionProperty{subtitle}{##1}\iflastquestion{}{&}%
}
& Total \\ \hline
Points &
\ForEachQuestion{\GetQuestionProperty{points}{##1}\iflastquestion{}{&}} &
\pointssum* \\ \hline
Reached &
\ForEachQuestion{\iflastquestion{}{&}} &
\\ \hline
\end{tabular}%
}
\begin{document}
\begin{center}
\gradingtable
\end{center}
\begin{question}[subtitle=Java,ID=Java]
\begin{enumerate}
\item Hello World (\addpoints{2})
\item for-each (\addpoints{1})
\end{enumerate}
\end{question}
\begin{question}[subtitle=C++,ID=C++]
\begin{enumerate}
\item Bla bla (\addpoints{2})
\item Blub blub (\addpoints{4})
\end{enumerate}
\end{question}
\begin{question}[subtitle=\LaTeX,ID=LaTeX]
\begin{enumerate}
\item Foo foo (\addpoints{2})
\item bar bar (\addpoints{2})
\end{enumerate}
\end{question}

exsheets
package.exsheets
doesn't provide a possibility to add points within the environment and have the sum printed in the title automatically. Until now you have to sum them up yourself. v0.14 will provide a possibility but it is not quite ready to be published (in a few days...)exsheets
be used with the template (that we know nothing about...)