cgnieder/xsim

Collections don't work correctly

RomanFox opened this issue · 1 comments

I used xsim package before, and I did not touch my files since January. I recently updated my computer and recompiled. I then noted that something is broken when using collections. Moreover, I could not figure out how to print the solutions by sections although it is described in the package documentation.

I also noticed that xsim was updated; however I couldn't figure differences nor running it in the current version.

Here is a minimal working example. The first section (foo) uses a collection, wheres the second (bar) does not. I notice the following issues:

  • Exercises are not numbered in the collection (foo), but they are numbered outside (bar)
  • Although \printallsolutions is used, it only shows the latter solutions.
\documentclass{article}

%\usepackage[utf8]{inputenc}
%\usepackage[T1]{fontenc}
%\usepackage[ngerman]{babel}

%\usepackage{color}
%\definecolor	{mygray}{rgb}{0.5,0.5,0.5}

%\usepackage{listings}
%\lstset{
%language=Matlab,
%basicstyle=\footnotesize\ttfamily,
%numbers=left,
%numberstyle=\tiny\color{mygray},
%frame=single
%}

\usepackage[]{xsim}
\xsimsetup{%
exercise/print=true,
solution/print=true,
}

\DeclareExerciseCollection{foo}
\DeclareExerciseCollection{bar}

\begin{document}

\section{Foo}
\collectexercises{foo}

\begin{exercise}
Is the world flat?
%\lstinputlisting{codeListing.m}
\end{exercise}

\begin{solution}
No.
\end{solution}

\begin{exercise}
Really?
\end{exercise}

\begin{solution}
Yes.
\end{solution}


\collectexercisesstop{foo}
\printcollection{foo}

\noindent
Show solutions of group foo
\printsolutions[collection=foo]

\noindent
Show all solutions
\printallsolutions

\section{Bar}
%\collectexercises{bar}

\begin{exercise}
How about the moon?
\end{exercise}

\begin{solution}
I don't know about the moon.
\end{solution}

%\collectexercisesstop{bar}

%\printcollection{bar}

\printsolutionstype{exercise}

\end{document}

latex-test.pdf

Any support and/or confirmation appreciated!

You need to add the option collect.
Please reread the section about collections in the manual. The collection mechanism has changed quite a bit between version 0.19 and 0.20.