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

Allow printcollection to filter by tags #105

Open
mschneiderwng opened this issue Jun 18, 2022 · 0 comments
Open

Allow printcollection to filter by tags #105

mschneiderwng opened this issue Jun 18, 2022 · 0 comments

Comments

@mschneiderwng
Copy link

I have exercises about some topic. Some are optional, some are mandatory. I would like to print the mandatory first, then the optional. The current workflow is as follows:

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

\DeclareExerciseTagging{optional}
\DeclareExerciseCollection[topics=algebra, optional=true]{algebra-optional}
\DeclareExerciseCollection[topics=algebra, optional=false]{algebra-mandatory}

\xsimsetup{collect}

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


\begin{document}
% collect
\collectexercises{algebra-mandatory}
\input{exercises.tex}
\collectexercisesstop{algebra-mandatory}
\collectexercises{algebra-optional}
\input{exercises.tex}
\collectexercisesstop{algebra-optional}

\section{Mandatory}
\printcollection{algebra-mandatory}

\section{Optional}
\printcollection{algebra-optional}

\end{document}

Would it be possible to add a filter to \printcollection, such that the interface something like in the following example?

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

\DeclareExerciseTagging{optional}
\DeclareExerciseCollection[topics=algebra]{algebra}

\xsimsetup{collect}

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


\begin{document}
\collectexercises{algebra}
\input{exercises.tex}
\collectexercisesstop{algebra}

\section{Mandatory}
\printcollection[filter={optional=false}]{algebra}

\section{Optional}
\printcollection[filter={optional=true}]{algebra}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant