meilleure organisation du code

Cette révision appartient à :
Yann Salmon
2019-05-07 16:46:13 +02:00
Parent 13c3c7af92
révision 4988dd8ebe

Voir le fichier

@@ -23,18 +23,24 @@
\RequirePackage{comment}
\RequirePackage{xr}
\newcount\modecorrige
\newcount\ys@modecorrige
%% 0 énoncé normal
%% 1 corrigé seul
%% 2 mode prof
%% 3 corrigé de concours
\let\modeenonce0
\let\modecorrseul1
\let\modeprof2
\let\modeconcours3
\newif\ifcorrige
\def\corr{\filigrane{\Huge CORRIG\'E --- CORRIG\'E}\global\modecorrige=2\global\corrigetrue\global\enoncefalse}
\newif\ifcorrigeseul
\def\corrseul{\filigrane{\Huge CORRIG\'E --- CORRIG\'E}\global\modecorrige=1\global\corrigeseultrue\global\enoncefalse}
\newif\ifenonce
\enoncetrue
\def\ifcorrige{\ifnum\ys@modecorrige=2}
\def\ifcorrigeseul{\ifnum\ys@modecorrige=1}
\def\ifenonce{\ifnum\ys@modecorrige=0}
\def\corr{\filigrane{\Huge CORRIG\'E --- CORRIG\'E}\global\ys@modecorrige=2}
\def\corrseul{\filigrane{\Huge CORRIG\'E --- CORRIG\'E}\global\ys@modecorrige=1}
\RequirePackage{xstring}
\let\basejobname\jobname
@@ -64,14 +70,14 @@
\AtBeginDocument{%
\ifnum\modecorrige=2
\immediate\typeout{Mode professeur}
\subtitle{Corrigé}
\newenvironment{corrige}{\begin{mdframed}[backgroundcolor=gray!20, skipbelow=1ex]}{\end{mdframed}}
\newenvironment{comcorrige}{\begin{mdframed}[backgroundcolor=gray!20, skipbelow=1ex]}{\end{mdframed}}
\newenvironment{qcmcorr}{\begin{mdframed}[backgroundcolor=gray!20, skipbelow=1ex]}{\end{mdframed}}
\ifcase\ys@modecorrige
%% 0
\immediate\typeout{Mode enonce}
\excludecomment{corrige}
\excludecomment{comcorrige}
\excludecomment{qcmcorr}
\avecenonce
\else\ifnum\modecorrige=1
\or %% 1
\immediate\typeout{Mode corrige}
%
\let\real@xwmlastpage\r@xwmlastpage % ne pas écraser ces labels depuis le fichier externe
@@ -95,17 +101,18 @@
\newtheorem{qcmcorr}{QCM}
\let\theqcmcorr\theqcm
\newenvironment{comcorrige}{}{}
\else\ifnum\modecorrige=3
\or %% 2
\immediate\typeout{Mode professeur}
\subtitle{Corrigé}
\newenvironment{corrige}{\begin{mdframed}[backgroundcolor=gray!20, skipbelow=1ex]}{\end{mdframed}}
\newenvironment{comcorrige}{\begin{mdframed}[backgroundcolor=gray!20, skipbelow=1ex]}{\end{mdframed}}
\newenvironment{qcmcorr}{\begin{mdframed}[backgroundcolor=gray!20, skipbelow=1ex]}{\end{mdframed}}
\avecenonce
\or %% 3
\subtitle{Corrigé}
\edef\@temp{\noexpand\newtheorem{corrige}{Question}\resetlevel}\@temp
\newenvironment{comcorrige}{}{}
\else
\immediate\typeout{Mode enonce}
\excludecomment{corrige}
\excludecomment{comcorrige}
\excludecomment{qcmcorr}
\avecenonce
\fi\fi\fi
\fi
}
\DeclareInstance{xfrac}{cinqdemi}{text}{scale-factor=1, h-scale=1.25, slash-left-kern=-2.5pt, slash-right-kern=-2.25pt}