From d1319d34c8535f22404c9e2d7bfaab56858826b5 Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Sat, 15 Jan 2022 14:13:28 +0100 Subject: [PATCH] Feat: listsectionexercise and printsectionexercise --- tools/style/myXsim.sty | 56 ++++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/tools/style/myXsim.sty b/tools/style/myXsim.sty index ffa22b6..c90585d 100644 --- a/tools/style/myXsim.sty +++ b/tools/style/myXsim.sty @@ -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})}% - }% + \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}, +}