Awaiting Activation added file macrosexercices.sty.bak  about 8 years ago

Commit id: 6d2cc1a3a02c4a0fe9e0a47251040a718baa2d3a

deletions | additions      

         

\NeedsTeXFormat{LaTeX2e}  \ProvidesPackage{macrosexercices}  \RequirePackage{verbatim}  \RequirePackage{etoolbox}  \newcommand*\motsclesexercice{}  \newcommand*\motsclesrecherches{}  \newcommand*\numerosexercices{}  \makeatletter  % a version of \ifinlist which takes the item as last argument so we can use  % it as handler in \forcsvlist  \newcommand\my@ifinlist[4]{\ifinlist{#4}{#1}{#2}{#3}}  % a temporary boolean:  \newbool{my@tmp@bool}  \newrobustcmd\iflistincludedAND[2]{%  \booltrue{my@tmp@bool}%  \forlistloop{\my@ifinlist{#2}{}{\boolfalse{my@tmp@bool}}}{#1}%  \ifbool{my@tmp@bool}%  }  \newrobustcmd\iflistincludedOR[2]{%  \boolfalse{my@tmp@bool}%  \forlistloop{\my@ifinlist{#2}{\booltrue{my@tmp@bool}}{}}{#1}%  \ifbool{my@tmp@bool}%  }  \RequirePackage{pgf}  \RequirePackage{pgffor}  \newcount\rangea  \newcount\rangeb  \newcommand\ifinrange[2]{%  \global\let\inrange\@secondoftwo  \foreach \range in {#2} {%  \afterassignment\getrangeb  \rangea=0\range\relax  \pgfmathtruncatemacro\result{ ( #1 >= \rangea) && (#1 <= \rangeb) }%  \ifnum\result=1\relax  \breakforeach  \global\let\inrange\@firstoftwo  \fi  }%  \inrange  }  \newcommand\getrangeb{%  \@ifnextchar\relax  {\rangeb=\rangea}%  {\@getrangeb}%  }  \def\@getrangeb-#1\relax{%  \ifx\relax#1\relax  \rangeb=100000% \maxdimen is too large for pgfmath  \else  \rangeb=#1\relax  \fi  }  \makeatother  \newbool{imprime}  \newcounter{exercice}\setcounter{exercice}{0}  \let\iflistincluded\iflistincludedAND  % argument: mots clés  \newenvironment{exercice}[1]%  {%  \refstepcounter{exercice}%  %  \boolfalse{imprime}%  \forcsvlist{\listadd\motsclesexercice}{#1}  \iflistincluded\motsclesrecherches\motsclesexercice{\booltrue{imprime}}{}%  \ifbool{imprime}{%  \par\vspace{18pt}%saut vertical avant exercice  \penalty-100% encourage un saut de pagestyle  \textbf{Exercice~\arabic{exercice}}%  \par\nobreak\vspace{3pt}%espace après  \par\nobreak\ignorespaces%  }%  {\expandafter\comment}%  }%  {%  \ifbool{imprime}{}{\expandafter\endcomment}%  }  %arguments: #1 = et/ou #2 = mots clés à chercher  \newcommand{\recherche}[2]{%  \ifstrequal{#1}{et}{\let\iflistincluded\iflistincludedAND}{\let\iflistincluded\iflistincludedOR}%  \forcsvlist{\listadd\motsclesrecherches}{#2}  }  \newcounter{question}  \newcommand{\questions}[1]{%  \setcounter{question}{0}  \forcsvlist{\listadd\numerosexercices}{#1}  \renewenvironment{exercice}[1]{%  \refstepcounter{exercice}%  \ifinrange{\value{exercice}}{#1}{\booltrue{imprime}}{\boolfalse{imprime}}%  \ifbool{imprime}{%  \refstepcounter{question}%  \par\vspace{18pt}%saut vertical avant exercice  \penalty-100% encourage un saut de pagestyle  \textbf{Exercice~\arabic{question}}%  \par\nobreak\vspace{3pt}%espace après  \par\nobreak\ignorespaces%  }%  {\expandafter\comment}%  }%  {\ifbool{imprime}{}{\expandafter\endcomment}}%  }%  \newcommand{\test}[3][]{%série,classe,date  \newpage\setcounter{page}{1}%  \noindent#2\hfill#3\par%  \vspace{\baselineskip}%  \centerline{\bfseries\large Chimie%  \ifx#1\empty\relax\else\enspace#1}%  \setcounter{exercice}{0}  }