Feat: listsectionexercise and printsectionexercise

This commit is contained in:
Bertrand Benjamin 2022-01-15 14:13:28 +01:00
parent e4b798bb30
commit d1319d34c8

View File

@ -13,9 +13,10 @@
\DeclareExerciseTagging{tribe}
\DeclareExerciseTagging{difficulty}
\DeclareExerciseTagging{origin}
\DeclareExerciseTagging{mode}
\DeclareExerciseTranslations{total}{
French = total ,
French = total,
}
\DeclareExerciseEnvironmentTemplate{exo}{%
@ -23,30 +24,31 @@
{%
\color{exercise}{\XSIMmixedcase{\GetExerciseName}}\nobreakspace
\GetExerciseProperty{counter}%
\hspace{0.5cm} \GetExercisePropertyT{mode}
{{\PropertyValue}}%
\hspace{0.5cm} \color{line}\hrulefill \hspace{0.5cm}
\color{exercise}
\IfInsideSolutionF
{%
\GetExercisePropertyT{subtitle}
{{\PropertyValue}}%
\GetExercisePropertyT{points}
{{(/\PropertyValue})}%
}%
\noindent
}
}{}
\xsimsetup{exercise/template=exo}
\DeclareExerciseEnvironmentTemplate{sol}{%
\subsection*
{%
\color{exercise}{\XSIMmixedcase{\GetExerciseName}}\nobreakspace
: Exercice \GetExerciseProperty{counter}%
\color{exercise}\nobreakspace
Exercice \GetExerciseProperty{counter}%
\hspace{0.5cm} \color{line}\hrulefill \hspace{0.5cm}
\color{exercise}{\XSIMmixedcase{\GetExerciseName}}
\hspace{0.5cm} \color{line}\hrulefill \hspace{0.5cm}
\color{exercise}
\IfInsideSolutionF
{%
}%
\GetExercisePropertyT{subtitle}
{{\PropertyValue}}%
\noindent
}
}{}
@ -93,3 +95,31 @@
}%
}
\newcommand\printsectionexercises{%
\ForEachUsedExerciseByType{%
\ifnum\ExercisePropertyGet{##1}{##2}{step}=\value{section}
\printexercise{exercise}{##2}
\fi
}%
}
\newcommand\listsectionexercises{%
\begin{itemize}
\ForEachUsedExerciseByType{%
\ifnum\ExercisePropertyGet{##1}{##2}{step}=\value{section}
\item
\XSIMmixedcase{\GetExerciseName}\nobreakspace
\GetExerciseProperty{counter}%
{{\PropertyValue}}: %
\GetExerciseProperty{subtitle}%
{{\PropertyValue}}%
\fi
}%
\end{itemize}
}
\xsimsetup{
exercise/within = section,
exercise/the-counter = \arabic{exercise},
}