# How to add exercise points to package exercisebank?

Exercisebank has in version 0.2.0 no build-in way of handling points. How do you add a point system to the part problems in exercisebank? E.g. In an exercise-file, I would like to do

\begin{problem}
problem description
\end{problem}


and now it should show in the part problem header. E.g. (1c) 2p:.

I'd also like a command that could be used at the end that shows the accumulated points. E.g.

\totalpoints

Works fine here. I modified the code a bit, so you have the points on the right side with a small rule like in xsim. Needs \usepackage{marginnote}.

The changed part of the code looks like this:

.....
\leavevmode%
\smash{%
\llap{%
{\large\textbf{\theproblemcounter\alph{partproblemcounter})}}%
% if \currentPoints contains 0, \currentPoints aren't printed.
%\ifnum\currentPoints=\z@\else\currentPoints p\fi~}}\ignorespaces%
\ifnum\currentPoints=\z@\else\marginnote{\rule{1cm}{.5pt}~/\currentPoints P.}
\fi}}\ignorespaces%
}
....


The only thing is, that \totalpoints has to run at last. My exams start usually with a titlepage showing the total points sum (\totalpoints). But this does not work here.

Edit: Point system is now implemented in exercisebank:

### In your exercisefile, say testexercise.tex:

\begin{problem}
\nextproblem{points=2}
Problem containing \makeatletter\exb@currentPoints\makeatother~points
\end{problem}
\begin{problem}
Problem containing \makeatletter\exb@currentPoints\makeatother~points
\end{problem}
\begin{problem}
Problem containing no points
\end{problem}


You can access the total number of points in the \totalpoints macro.

This is an upcoming feature, but I don't know exactly when I'll get around to do it. Here I'll present a workaround that would not work if you're using e.g. \select or \exclude. I'll write below how you'd make that work:

This code makes a counter and a placeholder for the points:

### main.tex:

\documentclass{article}
\usepackage{exercisebank}
\usepackage{filecontents}
\makeatletter
% Make a counter for accumulating points
\newcounter{problempoints}
\let\totalpoints\theproblempoints
% \currentPoints is a placeholder for
% the number of points the current part problem has
\gdef\currentPoints{0}
% Make a new command to insert part problem header
% (inspired by the default found on page 10 in the manual):
\leavevmode%
\smash{%
\llap{%
{\large\textbf{(\theproblemcounter\alph{partproblemcounter})}}%
% if \currentPoints contains 0, \currentPoints aren't printed.
\ifnum\currentPoints=\z@\else\currentPoints p\fi~}}\ignorespaces%
}
% Reset \currentPoints, so that if no points are set in the next, nothing would be added
\At\EndPartproblem{\gdef\currentPoints{0}}
% Make a new command that sets the current points and increases the total-counter
\gdef\currentPoints{#1}%
}
\makeset{test}{testexercise}
\makeatother
\begin{document}
\buildset{test}
\end{document}


### Now, the testexercise.tex:

\begin{problem}
Problem containing \currentPoints~points
\end{problem}
\begin{problem}