2021-2022/tools/style/myXsim.sty

126 lines
3.4 KiB
Plaintext
Raw Normal View History

2021-08-23 05:40:35 +00:00
\NeedsTeXFormat{LaTeX2e}
% extensions
\RequirePackage{colorscheme}
\RequirePackage{base}
\RequirePackage{myhdr}
\RequirePackage{notbeamer}
2021-08-27 09:35:03 +00:00
\RequirePackage{xsim}
2021-08-23 05:40:35 +00:00
\DeclareExerciseTagging{step}
\DeclareExerciseTagging{type}
\DeclareExerciseTagging{tribe}
\DeclareExerciseTagging{difficulty}
\DeclareExerciseTagging{origin}
\DeclareExerciseTagging{mode}
2021-08-23 05:40:35 +00:00
\DeclareExerciseTranslations{total}{
French = total,
2021-08-23 05:40:35 +00:00
}
\DeclareExerciseEnvironmentTemplate{exo}{%
\subsection*
{%
\color{exercise}{\XSIMmixedcase{\GetExerciseName}}\nobreakspace
\GetExerciseProperty{counter}%
\hspace{0.5cm} \GetExercisePropertyT{mode}
{{\PropertyValue}}%
2021-08-23 05:40:35 +00:00
\hspace{0.5cm} \color{line}\hrulefill \hspace{0.5cm}
\color{exercise}
\GetExercisePropertyT{subtitle}
{{\PropertyValue}}%
\GetExercisePropertyT{points}
{{(/\PropertyValue})}%
2021-08-23 05:40:35 +00:00
\noindent
}
}{}
2021-08-23 05:40:35 +00:00
\xsimsetup{exercise/template=exo}
\DeclareExerciseEnvironmentTemplate{sol}{%
\subsection*
{%
\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}
\GetExercisePropertyT{subtitle}
{{\PropertyValue}}%
\noindent
}
}{}
\xsimsetup{solution/template=sol}
2021-08-23 05:40:35 +00:00
\DeclareExerciseTableTemplate{DNB}{%
\XSIMputright\ExerciseTableCode{%
\hline
\XSIMifblankTF{\ExerciseType}
{}
{\XSIMmixedcase{\GetExerciseParameter{exercise-name}}}
&
\XSIMmixedcase{\XSIMtranslate{points}} \\
\hline
}%
\ForEachUsedExerciseByType{%
\XSIMifeqTF{#1}{\ExerciseTableType{#1}}
{%
\XSIMifblankTF{\ExerciseType}
{%
\XSIMputright\ExerciseTableCode{%
\XSIMmixedcase{\ExerciseParameterGet{#1}{exercise-name} }%
}%
}
{}%
\XSIMputright\ExerciseTableCode
{#3 & \XSIMifblankTF{#5}{\printgoal{0}}{\printgoal{#5}}\\ }%
}
{}%
}
\XSIMputright\ExerciseTableCode{%
\hline
\XSIMmixedcase{\XSIMtranslate{total}} &
\XSIMifblankTF{\ExerciseType}
{\TotalExerciseGoal{points}{}{}}
{\TotalExerciseTypeGoal{\ExerciseType}{points}{}{}} \\
\hline
}%
\XSIMexpandcode{%
\noexpand\begin{tabular}{|\XSIMifblankTF{\ExerciseType}{l}{c}|c|}
\noexpand\ExerciseTableCode
\noexpand\end{tabular}%
}%
}
\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},
}