Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\DeclareExerciseCollection works not as expected #94

Closed
mschneiderwng opened this issue Jan 20, 2022 · 4 comments
Closed

\DeclareExerciseCollection works not as expected #94

mschneiderwng opened this issue Jan 20, 2022 · 4 comments
Assignees
Labels
bug error in the code

Comments

@mschneiderwng
Copy link

From the example in the manual, I would expect that

\DeclareExerciseCollection[topics=algebra,level=1]{easy-algebra}

selects all exercises which have the topic algebra and are level 1 questions. However, it seems that algebra or are level 1 questions are selected. Is there a way to make the former work such that one the first question is printed in the example below?

\documentclass[a4paper]{article}
\usepackage{xsim}

\begin{filecontents}{exercises.tex}
\begin{exercise}[topics=algebra, level=1]
	algebra question 1 level=1
\end{exercise}
\begin{exercise}[topics=calculus, level=1]
	calculus question 1 level=1
\end{exercise}
\begin{exercise}[topics=algebra, level=2]
	algebra question 2 level=2
\end{exercise}
\end{filecontents}

\xsimsetup{collect}
\DeclareExerciseTagging{level}
\DeclareExerciseCollection[topics=algebra,level=1]{easy-algebra}

\begin{document}
\section{Exercises}
\input{exercises.tex}

\printcollection{easy-algebra}

\end{document}
@cgnieder cgnieder added the bug error in the code label Jan 20, 2022
@cgnieder
Copy link
Owner

This is probably the same bug as #95

@cgnieder cgnieder self-assigned this Jan 20, 2022
@cgnieder
Copy link
Owner

Currently, the optional argument filters exercises with or. This means an exercise is added if any of the tags match.

I admit that this behaviour is not intuitive and not clearly documented. Also, I think a user should have a choice whether any or all conditions should match.

cgnieder added a commit that referenced this issue Feb 12, 2022
@cgnieder
Copy link
Owner

In the next release the following code:

\documentclass[a4paper]{article}
\usepackage[use-aux]{xsim}

\DeclareExerciseTagging{level}
\DeclareExerciseCollection[topics=algebra,level=1]{easy-algebra}

\xsimsetup{
  collection/easy-algebra/match-all ,
  collect
}

\begin{document}

\section{Exercises}

\collectexercises{easy-algebra}
\begin{exercise}[topics=algebra, level=1]
  algebra question 1 level=1
\end{exercise}
\begin{exercise}[topics=calculus, level=1]
  calculus question 1 level=1
\end{exercise}
\begin{exercise}[topics=algebra, level=2]
  algebra question 2 level=2
\end{exercise}
\collectexercisesstop{easy-algebra}

\printcollection{easy-algebra}

\end{document}

will give

grafik

@cgnieder
Copy link
Owner

BTW: match-all will be the default behaviour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug error in the code
Projects
None yet
Development

No branches or pull requests

2 participants