diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/exercise/exercise.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/exercise/exercise.dtx | 217 |
1 files changed, 156 insertions, 61 deletions
diff --git a/Master/texmf-dist/source/latex/exercise/exercise.dtx b/Master/texmf-dist/source/latex/exercise/exercise.dtx index 04f6b15a0c2..a4f6952fa0d 100644 --- a/Master/texmf-dist/source/latex/exercise/exercise.dtx +++ b/Master/texmf-dist/source/latex/exercise/exercise.dtx @@ -23,7 +23,7 @@ % \iffalse %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{exercise} -%<package> [2009/03/26 v1.3 Exercise package (P.Pichaureau)] +%<package> [2010/08/27 v1.4 Exercise package (P.Pichaureau)] %<*driver> \documentclass{ltxdoc} \usepackage{exercise} @@ -85,7 +85,7 @@ % \DoNotIndex{\setlength,\string,\textbf,\textsc,\emph,\whiledo,\vbox} % \DoNotIndex{\unvbox,\usefont,\usecounter,\value,\vskip,\setbox,\setcounter} % -%\CheckSum{1615} +%\CheckSum{1826} % % % \GetFileInfo{exercise.sty} @@ -469,32 +469,25 @@ % %\subsection{Exercise selection} %\begin{decl} -% |\ExerciseStartSelect|\marg{comma separated list}\\ +% |\ExerciseSelect|\marg{key val list}\\ % |\ExerciseStopSelect| %\end{decl} -%\DescribeMacro{\ExerciseStartSelect} +%\DescribeMacro{\ExerciseSelect} %\DescribeMacro{\ExerciseStopSelect} % % A very basic exercise selection mechanism is provided. When -% |\ExerciseStartSelect| is used, an exercise is printed if and only -% if its label is in the list of labels. For example, the following -% command +% |\ExerciseSelect| is used, an exercise is printed if and only +% if the value of its keys are within the values specified after +% |\ExerciseSelect|. For example, the following command %\begin{verbatim} -% \ExerciseStartSelect{exe1, exe10, exe11} +% \ExerciseSelect{type={short}, difficulty={0,1}} +%\end{verbatim} +%selects the short exercises of difficulties 0 and 1, whereas +%\begin{verbatim} +% \ExerciseSelect{label={exe1, exe10, exe11}} %\end{verbatim} %selects the exercises with label |exe1|, |exe10| and |exe11|. % -%\begin{decl} -% |\ExerciseStartSelectNoLabel| \\ -% |\ExerciseStopSelectNoLabel| -%\end{decl} -%\DescribeMacro{\ExerciseStartSelectNoLabel} -%\DescribeMacro{\ExerciseStopSelectNoLabel} -% -% By default, exercises which have no label are printed. With the command -% |\ExerciseStopSelectNoLabel|, these exercises are \emph{not} -% printed. -% %\subsection{Extra stuff} %\DescribeMacro{\marker} %\DescribeMacro{\DifficultyMarker} @@ -896,7 +889,16 @@ \def\AnswerListName{Soluci\'on}% \def\ExePartName{Parte}% \def\ArticleOf{del\ }% - }}{} + } +\addto\captionsitalian{% + \def\listexercisename{Indice degli esercizi} + \def\ExerciseName{Esercizio}% + \def\AnswerName{Soluzione dell'esercizio}% + \def\ExerciseListName{Es.}% + \def\AnswerListName{Soluzione}% + \def\ExePartName{Parte}% +} +}{} % \end{macrocode} %\subsubsection{Layout} % First a bunch of length definitions. @@ -967,6 +969,8 @@ % Presentation of informations in the header of exercises % \begin{macrocode} \newcommand{\ExerciseHeaderTitle}{\qquad \ExerciseTitle} +\newcommand{\ExerciseHeaderConcours}{\ExerciseConcours} +\newcommand{\ExerciseHeaderAnnee}{\ \ExerciseAnnee} \newcommand{\ExerciseHeaderDifficulty}{\theExerciseDifficulty\ } \newcommand{\ExerciseHeaderOrigin}{% \ ({\usefont{\encodingdefault}{\rmdefault}{m}{it}\ExerciseOrigin})} @@ -1046,10 +1050,13 @@ % The keyval package is used to specify various information about an exercise. % \begin{macrocode} \newif\if@ExeTitle \@ExeTitlefalse +\newif\if@ExeConcours \@ExeConcoursfalse +\newif\if@ExeAnnee \@ExeAnneefalse \newif\if@ExeReName \@ExeReNamefalse \global\newcount\ExerciseDifficulty \ExerciseDifficulty=0 \newif\if@ExeDifficulty \@ExeDifficultyfalse \newif\if@ExeOrigin \@ExeOriginfalse +\newif\if@ExeType \@ExeTypefalse \newif\if@ExeLabel \@ExeLabelfalse \newif\if@ExeNB \@ExeNBfalse % @@ -1057,22 +1064,26 @@ % \define@key{PPExercise}{title}% {\global\@ExeTitletrue\gdef\ExerciseTitle{#1}} +\define@key{PPExercise}{concours}% +{\global\@ExeConcourstrue\gdef\ExerciseConcours{#1}} +\define@key{PPExercise}{annee}% +{\global\@ExeAnneetrue\gdef\ExerciseAnnee{#1}} \define@key{PPExercise}{difficulty}% {\global\@ExeDifficultytrue\global\ExerciseDifficulty=\number#1} \define@key{PPExercise}{name}% {\global\@ExeReNametrue\gdef\@ExerciseName{#1}} \define@key{PPExercise}{origin}% {\global\@ExeOrigintrue\gdef\ExerciseOrigin{#1}} +\define@key{PPExercise}{type}% +{\global\@ExeTypetrue\gdef\ExerciseType{#1}} \define@key{PPExercise}{counter}% {\gdef\@ExerciseCounter{#1}} \define@key{PPExercise}{label}% {\global\@ExeLabeltrue\gdef\ExerciseLabel{#1}\gdef\ExerciseTrueLabel{#1}} \define@key{PPExercise}{number}% {\global\@ExeNBtrue\gdef\ExerciseLocalNB{#1}} -% -%% \define@key{PPExercise}{domain}{} -%% \define@key{PPExercise}{sdomain}{} -%% \define@key{PPExercise}{keyword}{} +\define@key{PPExercise}{class}% +{\gdef\ExerciseClass{#1}} % \newif\if@ExeStared \newif\if@staredpb @@ -1086,14 +1097,20 @@ % \def\@InitExe{\@savemathindent\global\@echapqfalse% \gdef\ExerciseTitle{}% +\gdef\ExerciseConcours{}% +\gdef\ExerciseAnnee{}% \gdef\@ExerciseName{}% \gdef\ExerciseOrigin{}% +\gdef\ExerciseType{}% \gdef\ExerciseTrueLabel{}% \global\ExerciseDifficulty=0% \global\@ExeTitlefalse% +\global\@ExeConcoursfalse% +\global\@ExeAnneefalse% \global\@ExeReNamefalse% \global\@ExeDifficultyfalse% \global\@ExeOriginfalse% +\global\@ExeTypefalse% \global\@ExeNBfalse% \gdef\@ExerciseCounter{Exercise}% \setcounter{ExePart}{0}% @@ -1104,12 +1121,17 @@ \def\@getExerciseInfo{% \if@ExeReName\def\ExerciseName{\@ExerciseName}\fi% \if@ExeTitle\else\def\ExerciseHeaderTitle{}\fi% +\if@ExeConcours\else\def\ExerciseHeaderConcours{}\fi% +\if@ExeAnnee\else\def\ExerciseHeaderAnnee{}\fi% \if@ExeOrigin\else\def\ExerciseHeaderOrigin{}\fi% +\if@ExeType\else\def\ExerciseHeaderType{}\fi% \if@ExeLabel\else\def\ExerciseHeaderLabel{}\fi% \if@ExeDifficulty\else\def\ExerciseHeaderDifficulty{}\fi% \if@ExeStared\def\ExerciseHeaderNB{}\fi% \if@ExeNB\def\theExercise{\ExerciseLocalNB}\fi% -\if@ExeLabel\label{\ExerciseLabel}\recordExerciseLabel{\ExerciseLabel}\fi% +\if@ExeLabel\label{\ExerciseLabel} +%%\recordExerciseLabel{\ExerciseLabel} +\fi% } % \def\refstepExecounter{\if@ShipThisExercise\if@ExeStared\else\if@ExeNB\else% @@ -1147,7 +1169,7 @@ \global\@Answerfalse\@BeginExeBox\@@@ExeEnv} % \newcommand{\@@@ExeEnv}{% - \@selectExercise{\ExerciseTrueLabel} + \@selectExercise%{\ExerciseTrueLabel} \@QuestionLevel1 \refstepExecounter \begingroup\@getExerciseInfo\ExerciseHeader @@ -1178,7 +1200,7 @@ \else \termineliste{1}\@EndExeBox \fi - \@selectExercise{\ExerciseTrueLabel} + \@selectExercise %{\ExerciseTrueLabel} \global\@Answerfalse\@BeginExeBox\refstepExecounter% \addcontentsline{\ext@exercise}{\toc@exercise}{\ExerciseName\ \theExercise\ \expandafter{\itshape \ExerciseTitle}\hspace{.66em}} @@ -1453,7 +1475,7 @@ \begingroup\@getExePartInfo\@ExePartHeader\endgroup} % % \end{macrocode} -% \subsubsection{ Presentation of answers} +% \subsubsection{Presentation of answers} % \begin{macrocode} \newbox\@Answerbox % @@ -1477,13 +1499,14 @@ % \def\@getAnswerInfo{% \if@AnswerRef% -\def\AnswerHeader{\ref{PP\AnswerRef}}% -\def\AnswerListHeader{\ref{PP\AnswerRef}}% +%% \def\AnswerHeader{\ref{PP\AnswerRef}}% +%% \def\AnswerListHeader{\ref{PP\AnswerRef}}% \else \if@AnswerNB \def\ExerciseTitle{} \def\ExerciseName{} \def\ExerciseOrigin{} +\def\ExerciseType{} \ExerciseDifficulty=0 \def\theExercise{\AnswerNB} \else @@ -1543,40 +1566,112 @@ \gdef\Answer{\AnswerCmd}} % \end{macrocode} % \subsubsection{Exercises selection} +% +%\changes{v1.4}{2010/08/27}{Exercises selection completly review.} +% % \begin{macrocode} -\newif\if@ExerciseSelected\@ExerciseSelectedfalse -\newif\if@ExerciseNoLabelSelected\@ExerciseNoLabelSelectedtrue -\newif\if@ExerciseOmitted\@ExerciseOmittedfalse -\newif\if@ShipThisExercise\@ShipThisExercisetrue -\newcommand{\ExerciseStartSelectNoLabel}{\@ExerciseNoLabelSelectedtrue} -\newcommand{\ExerciseStopSelectNoLabel}{\@ExerciseNoLabelSelectedfalse} -\newcommand{\ExerciseStopSelect}{\@ExerciseSelectedfalse} -\newcommand{\ExerciseStartSelect}{\@ExerciseSelectedtrue\@ifstar{\@ExerciseOmittedtrue\def@ListOfExercise}{\@ExerciseOmittedfalse\def@ListOfExercise}} -\def\def@ListOfExercise#1{\gdef\@ListOfExercise{#1}} -\def\@selectExercise#1{% - \ifx#1\@empty - \if@ExerciseNoLabelSelected - \global\@ShipThisExercisetrue - \else - \global\@ShipThisExercisefalse - \fi - \else - \if@ExerciseSelected - \global\@ShipThisExercisefalse - \@for\@label:=\@ListOfExercise\do - { \ifthenelse{\equal{\@label}{#1}}{ - \global\@ShipThisExercisetrue + + +\newif\if@ShipThisExercise \@ShipThisExercisetrue +\newif\if@@ShipThisExercise \@@ShipThisExercisetrue +\newif\if@ExerciseSelected \@ExerciseSelectedtrue +\newif\if@ExeSelectConcours \@ExeSelectConcoursfalse +\newif\if@ExeSelectAnnee \@ExeSelectAnneefalse +%% \newif\if@ExeSelectDifficulty \@ExeSelectDifficultyfalse +\newif\if@ExeSelectOrigin \@ExeSelectOriginfalse +\newif\if@ExeSelectClass \@ExeSelectClassfalse +\newif\if@ExeSelectType \@ExeSelectTypefalse +\newif\if@ExeSelectLabel \@ExeSelectLabelfalse + +\define@key{PPExerciseSelect}{concours}% +{\global\@ExeSelectConcourstrue\gdef\ExerciseSelectConcours{#1}} +\define@key{PPExerciseSelect}{annee}% +{\global\@ExeSelectAnneetrue\gdef\ExerciseSelectAnnee{#1}} +\define@key{PPExerciseSelect}{type}% +{\global\@ExeSelectTypetrue\gdef\ExerciseSelectType{#1}} +\define@key{PPExerciseSelect}{origin}% +{\global\@ExeSelectOrigintrue\gdef\ExerciseSelectOrigin{#1}} +\define@key{PPExerciseSelect}{class}% +{\global\@ExeSelectClasstrue\gdef\ExerciseSelectClass{#1}} +\define@key{PPExerciseSelect}{label}% +{\global\@ExeSelectLabeltrue\gdef\ExerciseSelectLabel{#1}} + +\newcommand{\ExerciseStopSelect}{ + \@ExeSelectConcoursfalse + \@ExeSelectAnneefalse + \@ExeSelectTypefalse + \@ExeSelectOriginfalse + \@ExeSelectClassfalse + \@ExeSelectLabelfalse + \@ExeSelectTypefalse +} + +\newcommand{\ExerciseSelect}{\@ifstar{\global\@ExerciseSelectedfalse\@ExerciseSelect}{\global\@ExerciseSelectedtrue\@ExerciseSelect}} +\newcommand{\@ExerciseSelect}[1][]{\setkeys{PPExerciseSelect}{#1}} + +\def\@selectExercise{% + \global\@ShipThisExercisetrue + \global\@@ShipThisExercisefalse + \if@ExeSelectConcours + \@for\@concours:=\ExerciseSelectConcours\do + {\ifthenelse{\equal{\@concours}{\ExerciseConcours}}{ + \global\@@ShipThisExercisetrue + }{} + } + \if@@ShipThisExercise\else\@ShipThisExercisefalse\fi + \global\@@ShipThisExercisefalse + \fi + % + \if@ExeSelectAnnee + \@for\@annee:=\ExerciseSelectAnnee\do + { \ifthenelse{\equal{\@annee}{\ExerciseAnnee}}{ + \global\@@ShipThisExercisetrue }{} - } - \if@ExerciseOmitted - \if@ShipThisExercise - \global\@ShipThisExercisefalse - \else - \global\@ShipThisExercisetrue - \fi + } + \if@@ShipThisExercise\else\@ShipThisExercisefalse\fi + \global\@@ShipThisExercisefalse \fi - \fi -\fi + % + \if@ExeSelectOrigin + \@for\@origin:=\ExerciseSelectOrigin\do + { \ifthenelse{\equal{\@origin}{\ExerciseOrigin}}{ + \global\@@ShipThisExercisetrue + }{} + } + \if@@ShipThisExercise\else\@ShipThisExercisefalse\fi + \global\@@ShipThisExercisefalse + \fi + % + \if@ExeSelectClass + \@for\@origin:=\ExerciseSelectClass\do + { \ifthenelse{\equal{\@origin}{\ExerciseClass}}{ + \global\@@ShipThisExercisetrue + }{} + } + \if@@ShipThisExercise\else\@ShipThisExercisefalse\fi + \global\@@ShipThisExercisefalse + \fi + % + \if@ExeSelectLabel + \@for\@label:=\ExerciseSelectLabel\do + { \ifthenelse{\equal{\@label}{\ExerciseLabel}}{ + \global\@@ShipThisExercisetrue + }{} + } + \if@@ShipThisExercise\else\@ShipThisExercisefalse\fi + \global\@@ShipThisExercisefalse + \fi + % + \if@ExeSelectType + \@for\@type:=\ExerciseSelectType\do + { \ifthenelse{\equal{\@type}{\ExerciseType}}{ + \global\@@ShipThisExercisetrue + }{} + } + \if@@ShipThisExercise\else\@ShipThisExercisefalse\fi + \global\@@ShipThisExercisefalse + \fi + \if@ExerciseSelected\else\if@ShipThisExercise\global\@ShipThisExercisefalse\else\global\@ShipThisExercisetrue\fi\fi } % \end{macrocode} % \subsubsection{Some extra stuff} |