2017-2018/tools/style/remixExam.cls

186 lines
5.4 KiB
TeX

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{remixExam}
% classe de base
\LoadClassWithOptions{exam}
% extensions
\RequirePackage{base}
\RequirePackage{none_beamer}
\RequirePackage{colorscheme}
\RequirePackage{xifthen}
%\RequirePackage{etoolbox}
\RequirePackage{pdftexcmds}
% Generalites
% géométrie
\RequirePackage{geometry}
\geometry{left=20mm,right=20mm, top=15mm, bottom=20mm}
% Calculatrice
\newcommand{\noCalc}{{\centering \textbf{Calculatrice interdite} \par}}
\newcommand{\Calc}{{\centering \textbf{Calculatrice autorisée} \par}}
% Custumisation de la class Exam
%% Document informations
\newcommand{\op@entete}{}
\newcommand{\op@soustitre}{\op@classe{} -- \@date{}}
\newcommand{\op@typedoctmp}{}
\newcommand{\op@classe}{}
\newcommand{\op@titre}{}
\newcommand{\op@duree}{}
\newcommand{\op@sujet}{}
\newcommand{\op@ptpres}{0}
\newcommand{\classe}[1]{\renewcommand{\op@classe}{#1}}
\newcommand{\titre}[1]{\renewcommand{\op@titre}{#1}}
\newcommand{\duree}[1]{\renewcommand{\op@duree}{#1}}
\newcommand{\sujet}[1]{\renewcommand{\op@sujet}{Sujet #1}}
\newcommand{\ptpres}[1]{\renewcommand{\op@ptpres}{#1}}
\newcommand{\typedoc}[1]{\renewcommand{\op@typedoctmp}{#1}
\renewcommand{\op@soustitre}{\op@classe{} -- \@date{}}%
\renewcommand{\op@entete}{\@date}
}
%% Redéfinition de maketitle
\renewcommand{\maketitle}{%
\noindent{\huge \color{title}\bfseries \op@titre}\par
\noindent{\color{line}\rule{\linewidth}{1ex}}\par
\noindent{\color{subtitle}\bfseries \op@soustitre \hfill \large\op@sujet}\par
\vspace{2.5\baselineskip}
}
% Page de garde
\renewcommand{\titlepage}{%
\begin{center}
%~\\[1cm]
\Huge \op@titre \\
\Huge \op@classe\\[1cm]
\LARGE \@date \\[1cm]
\fbox{
\parbox{0.7\textwidth}{~\\[1cm] \large Épreuve de : \\ \Huge MATHÉMATIQUES \\ \Large Durée de l'épreuve: \op@duree %
\ifprintanswers \Huge\center \textbf{Correction} \fi \\[1cm]}
}
~\\[1cm]
\normalsize
Ce sujet comporte \numpages\, pages, numérotées de 1 / \numpages \; à \numpages / \numpages \\
Dès qu'il vous est remis, assurez-vous qu'il est complet.
\\[0.5cm]
L'utilisation de la calculatrice est autorisée.\\
L'échange de calculatrice entre les élèves est strictement interdit.\\
L'usage du dictionnaire n'est pas autorisé. \\[1cm]
\pointtable[h][questions]
~\\[0.5cm]
\ifthenelse{\equal{\op@ptpres}{0}}%
{}%
{\textbf{\op@ptpres\, points} sont réservés à la présentation et à la rédaction.}
\end{center}
\clearpage
}
%% Les en-tête et les pieds de pages
\newcommand{\op@boiteentete}{\makebox[0pt][l]{\hspace*{-3ex}%
\color{bgentete}\rule[-0.8ex]{\linewidth+6ex}{3ex}%
}}
\pagestyle{headandfoot}
\header{\op@boiteentete\small\scshape\op@entete}{}{\small \op@titre}
\footer{\scriptsize\op@classe{} -- \op@annee}{}{\scriptsize\thepage / \numpages}
%% En tête de la première page
% Header de la première page
\firstpageheader{}{}{}
% header des autres pages
\runningheader{\op@boiteentete\small\scshape\op@entete}{}{\small \op@titre}
% Footer de la première page
\firstpagefooter{\scriptsize\op@classe{} -- \op@annee}{}{\scriptsize\thepage / \numpages}
% footer des autres pages
\runningfooter{\scriptsize\op@classe{} -- \op@annee}{}{\scriptsize\thepage / \numpages}
%% Questions and parts
%%% Numbering
% numérotation de part
\renewcommand{\thepartno}{\arabic{partno}}
% numérotation de choice
\renewcommand{\thechoice}{\alph{choice}}
% numérotation de subpart
\renewcommand{\thesubpart}{\alph{subpart}}
% numérotation de subsubpart
\renewcommand{\thesubsubpart}{\greeknum{subsubpart}}
%%% Display numbering
\renewcommand{\partlabel}{\colorbox{exercice}{\color{highlightbg}\thepartno}}
%\renewcommand{\choicelabel}{\color{exercice}\thechoice.}}
%\newcommand{\partlabel}{\thepartno.}
\renewcommand{\subpartlabel}{\color{exercice}\thesubpart.\color{text}}
\renewcommand{\subsubpartlabel}{\color{exercice}\thesubsubpart)}
%%% Reformat questions
\qformat{\Large \textbf{\color{exercice}{Exercice \thequestion}} \hspace{0.5cm} \color{line}\hrulefill \hspace{0.5cm} \color{exercice} \thepoints}
%%% Points table
\addpoints
\vqword{Éxercice}
%% Saved solutions environment
\newbox\allsolutions
\setbox\allsolutions=\vbox{}
\edef\iniq{}
\edef\inip{}
\edef\inisp{}
\newenvironment{savedSolution}
{%
\ifprintanswers
% s'il y a printanswers on veut que les solutions soient au milieu des questions.
\begin{solution}
\else
\global\setbox\allsolutions=\vbox\bgroup
\unvbox\allsolutions
% à partir de là, on enregistre des truc dans la boite. Je suis pas convaincu que le truc avec minipage va bien marcher mais bon...
\begin{minipage}{0.45\textheight}
\ifnum\pdf@strcmp{\iniq}{\thequestion}=0
\else
\Large \textbf{\color{exercice}{Exercice \thequestion}} \hspace{0.5cm} {\color{line}\hrulefill} \hspace{0.5cm} {\color{exercice} Solution} \normalsize
\global\edef\iniq{\thequestion}%
\fi
\ifnum\pdf@strcmp{\inip}{\thepartno}=0
\else
\partlabel \;
\global\edef\inip{\thepartno}%
\fi
\ifnum\pdf@strcmp{\inisp}{\thesubpart}=0
\else
\subpartlabel \;
\global\edef\inisp{\thesubpart}%
\fi%
\fi%
}%
{%
\ifprintanswers
\end{solution}
\else
\end{minipage}
\bigbreak
\egroup
\fi
}
\newcommand{\showallsolutions}{\par\unvbox\allsolutions}