cgnieder / xsim

eXercise Sheets IMproved
67 stars 23 forks source link

Grading table with collections #85

Closed ParticuleAlpha closed 2 years ago

ParticuleAlpha commented 3 years ago

Hi! I've updated the package this morning as I was working on building a new document I've noticed that the grading table does not work properly with collections since then.

Here is a minimal (non-)working example (that I got from issue #40 ):

\documentclass{article}
\usepackage{xsim}

\DeclareExerciseCollection{test}
\xsimsetup{print-solutions/headings=false}

\begin{filecontents*}{testproblems.tex}
\begin{exercise}[ID=one,points=3]
  Exercise one.
\end{exercise}
\begin{solution}
  Answer one.
\end{solution}

\begin{exercise}[ID=two,points=7]
  Exercise two.
\end{exercise}
\begin{solution}
  Answer two.
\end{solution}

\begin{exercise}[ID=three,points=1]
  Exercise three.
\end{exercise}
\begin{solution}
  Answer three.
\end{solution}
\end{filecontents*}

\begin{document}

\gradingtable

\collectexercises{test}
  \input{testproblems.tex}
\collectexercisesstop{test}

\printexercise{exercise}{one,three}

\end{document}

And here is the result I have: image

It looks kind of like it does not "see" the exercises.

Can you help me figuring out what I'm doing wrong?

PS: when exercises are included directly in the document body, without using collections, it works perfectly fine.

cgnieder commented 3 years ago

I suggest to read the current manual carefully again. The long announced changed to the collection mechanism finally took place with version 0.20 and is documented. This version works:

\documentclass{article}
\usepackage{xsim}

\DeclareExerciseCollection{test}
\xsimsetup{
  print-solutions/headings=false ,
  collect % <<<<<
}

\begin{document}

\gradingtable

\begin{exercise}[ID=one,points=3]
  Exercise one.
\end{exercise}
\begin{solution}
  Answer one.
\end{solution}

\begin{exercise}[ID=two,points=7]
  Exercise two.
\end{exercise}
\begin{solution}
  Answer two.
\end{solution}

\begin{exercise}[ID=three,points=1]
  Exercise three.
\end{exercise}
\begin{solution}
  Answer three.
\end{solution}

\printexercise{exercise}{one,three}

\end{document}

image

ParticuleAlpha commented 3 years ago

Thank you very much for your answer, I somehow managed to totally miss it in the manual even if I read it more than once, sorry about that!

I have a supplementary question about it. If you add the second exercise in the printed exercises ( using \printexercise{exercise}{one,three,two} in your MWE), it gives you a grading table with numbers ordered by id instead of by counter (as it should per the definition of functions in the grading table template) and exercise 2 is at the end of the table instead of being between exercise 1 and exercise 3.

image

I've tried to change the grading table template without success so far. Is there a build-in (or an easy) way to do so that I overlooked?

cgnieder commented 3 years ago

cf. https://tex.stackexchange.com/q/588043/