2020-2021/tools/style/myXsim.sty

142 lines
3.8 KiB
TeX

\NeedsTeXFormat{LaTeX2e}
% extensions
\RequirePackage{colorscheme}
\RequirePackage{base}
\RequirePackage{myhdr}
\RequirePackage{hyperref}
\RequirePackage{enumitem}
\setlist[itemize,1]{label=$\bullet$}
% Pour gérer les todo
\RequirePackage[french]{todonotes}
\newcounter{afaire}
\newcommand{\afaire}[2][]{%
% initials of the author (optional) + note in the margin
\refstepcounter{afaire}%
{%
%\setstretch{0.7}% spacing
\todo[inline,#1]{%
\textbf{À faire au crayon à papier:}~#2}%
}}
\newcounter{envideo}
\newcommand{\envideo}[3][]{%
% initials of the author (optional) + note in the margin
\refstepcounter{envideo}%
{%
%\setstretczh{0.7}% spacing
\todo[inline,backgroundcolor=green,#1]{%
\textbf{Voir la vidéo}~\href{#2}{#3}}%
}}
\newcounter{enclasse}
\newcommand{\enclasse}[2][]{%
% initials of the author (optional) + note in the margin
\refstepcounter{enclasse}%
{%
%\setstretch{0.7}% spacing
\todo[inline,backgroundcolor=green,#1]{%
\textbf{Sera complété en classe}~#2}%
}}
\newcounter{arediger}
\newcommand{\arediger}[2][]{%
% initials of the author (optional) + note in the margin
\refstepcounter{afaire}%
{%
%\setstretch{0.7}% spacing
\todo[inline,#1]{%
\textbf{À rédiger et m'envoyer par mail:}~#2}%
}}
\RequirePackage{geometry}
%\geometry{landscape}
\geometry{left=15mm,right=15mm, bottom= 15mm, top=15mm}
%\firstpageheader{\op@boiteentete\small\scshape\op@entete}{}{\small\op@typedoc \op@titre} % Header de la première page
%\setlength{\oddsidemargin}{0in} % default=0in
%\setlength{\textwidth}{9in} % default=9in
\setlength{\columnsep}{30pt} % default=10pt
\setlength{\columnseprule}{1pt} % default=0pt (no line)
%\setlength{\textheight}{5.85in} % default=5.15in
%\setlength{\topmargin}{-0.40in} % default=0.20in
%\setlength{\headsep}{0.35in} % default=0.35in
%\renewcommand{\op@entete}{\op@classe}
%\RequirePackage{xsim}
\RequirePackage[no-files]{xsim}
\DeclareExerciseTagging{step}
\DeclareExerciseTagging{difficulty}
\DeclareExerciseTagging{origin}
\DeclareExerciseTranslations{total}{
French = total ,
}
\DeclareExerciseEnvironmentTemplate{exo}{%
\subsection*
{%
\color{exercise}{\XSIMmixedcase{\GetExerciseName}}\nobreakspace
\GetExerciseProperty{counter}%
\hspace{0.5cm} \color{line}\hrulefill \hspace{0.5cm}
\color{exercise}
\IfInsideSolutionF
{%
\GetExercisePropertyT{subtitle}
{{\PropertyValue}}%
\GetExercisePropertyT{points}
{{(/\PropertyValue})}%
}%
\noindent
}
}{}
\xsimsetup{exercise/template=exo}
\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}%
}%
}