0

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}
  \addpoints{2}
  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

2

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:

.....
\def\ppheader{%
    \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.

|improve this answer|||||
1

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}
    \addpoints{points=1}
    Problem containing \makeatletter\exb@currentPoints\makeatother~points
\end{problem}
\begin{problem}
    \ppheader
    Problem containing no points
\end{problem}

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


Previous answer:

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}
% For readability, defining
\let\totalpoints\theproblempoints
% \currentPoints is a placeholder for
% the number of points the current part problem has
\gdef\currentPoints{0}
% Disable the default part problem header made by exercisebank
\exercisebanksetup{part problem header={\relax}}
% Make a new command to insert part problem header
% (inspired by the default found on page 10 in the manual):
\def\ppheader{%
  \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
\newcommand\addpoints[1]{%
  \gdef\currentPoints{#1}%
  \addtocounter{problempoints}{#1}%
  \ppheader
}
\makeset{test}{testexercise}
\makeatother
\begin{document}
  \buildset{test}
\end{document}

Now, the testexercise.tex:

\begin{problem}
    \addpoints{2}
    Problem containing \currentPoints~points
\end{problem}
\begin{problem}
    \addpoints{1}
    Problem containing \currentPoints~points
\end{problem}
\begin{problem}
    \ppheader
    Problem containing no points
\end{problem}

Which would produce what you


This is a Q&A-question. I've gotten multiple inquiries in regards to this on github and email, so I decided to make a Q&A here.

|improve this answer|||||

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.