1
1

J'ai une liste d'exercices et je souhaite en afficher certains selon divers critères, en particulier :

  • en fonction de mots-clés,
  • en faisant un choix exhaustif des exercices

J'ai commencé à utiliser xsim qui m'a semblé pouvoir répondre à mes besoins mais j'ai un peu de mal avec la doc (et je ne sais d'ailleurs pas si je me sers correctement du package).

Dans l'exemple ci-dessous, je m'en sors avec tags et, en commentant/décommentant les lignes avec \xsimsetup, j'obtiens le résultat souhaité.

\documentclass{article}
\usepackage{fontspec}
\usepackage{xsim}
%\xsimsetup{tags={pomme}}
%\xsimsetup{tags={poire}}
\begin{document}
\begin{exercise}[tags={pomme}]
Exercice pomme
id : \GetExerciseProperty{id}
\end{exercise}
\begin{exercise}[tags={pomme,poire}]
Exercice pomme et poire
id : \GetExerciseProperty{id}
\end{exercise}
\begin{exercise}[tags={abricot}]
Exercice abricot
id : \GetExerciseProperty{id}
\end{exercise}
\begin{exercise}[tags={poire}]
Exercice poire
id : \GetExerciseProperty{id}
\end{exercise}
\begin{exercise}[tags={pomme}]
Autre exercice pomme
id : \GetExerciseProperty{id}
\end{exercise}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

J'aurais aussi aimé pouvoir faire une sélection moi-même en indiquant le numéro des exercices à imprimer (chaque exercice a un id unique). Malheureusement, je n'y arrive pas en procédant de la même façon (J'espérais que xsimsetup{id={2,4,5}} pourrait fonctionner).

Est-ce que je m'y prends mal ? Y a-t-il une façon de procéder ? Ou un autre package qui répond à ces besoins ?

Posée 28 Fév '23, 22:21

logamath's gravatar image

logamath
52316
Taux d'acceptation : 30%

La méthode est bonne. Une méthode est d'utiliser les collections des exos. Voir section 9 de la doc. Pour afficher les exos par id il suffit, par exemple, de taper \printexercise{exercise}{2,3,5}.

(02 Mar '23, 13:53) touhami touhami's gravatar image

J'ai un peu de mal à comprendre les collections...

Finalement, je m'en suis sorti de la façon suivante (merci @touhami pour \printexercise)

\documentclass{article}
\usepackage{fontspec}
\usepackage{xsim}
\xsimsetup{exercise/use=false,exercise/print=false}
\begin{document}
\begin{exercise}[tags={pomme}]
Exercice pomme
id : \GetExerciseProperty{id}
\end{exercise}
\begin{exercise}[tags={pomme,poire}]
Exercice pomme et poire
id : \GetExerciseProperty{id}
\end{exercise}
\begin{exercise}[tags={abricot}]
Exercice abricot
id : \GetExerciseProperty{id}
\end{exercise}
\begin{exercise}[tags={poire}]
Exercice poire
id : \GetExerciseProperty{id}
\end{exercise}
\begin{exercise}[tags={pomme}]
Autre exercice pomme
id : \GetExerciseProperty{id}
\end{exercise}
\printexercise{exercise}{2,4,5}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Lien permanent

Publiée 02 Mar '23, 17:00

logamath's gravatar image

logamath
52316
Taux d'acceptation : 30%

Votre réponse
[Masquer l'aperçu]

Suivre cette question

Par courriel :

Une fois que vous serez enregistré, vous pourrez souscrire à n'importe quelle mise à jour ici

Par flux RSS :

Réponses

Réponses et commentaires

Mots-clés de la question :

×4
×3

Question posée : 28 Fév '23, 22:21

Question vue : 2,147 fois

Dernière mise à jour : 02 Mar '23, 17:00