summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/exercise
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-09-18 00:08:11 +0000
committerKarl Berry <karl@freefriends.org>2010-09-18 00:08:11 +0000
commitf9f2a1ab5b27f009ae29eb431c38aea64a0b8bf7 (patch)
tree609604b5acea03b6fbe415813e29a79d4a80e7a2 /Master/texmf-dist/tex/latex/exercise
parent122d749a0aa11870aba704eb168d86722b47457c (diff)
exercise update (27aug10)
git-svn-id: svn://tug.org/texlive/trunk@19783 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/exercise')
-rw-r--r--Master/texmf-dist/tex/latex/exercise/exercise.sty181
1 files changed, 140 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/latex/exercise/exercise.sty b/Master/texmf-dist/tex/latex/exercise/exercise.sty
index e6e29c8b082..ed75b0b156d 100644
--- a/Master/texmf-dist/tex/latex/exercise/exercise.sty
+++ b/Master/texmf-dist/tex/latex/exercise/exercise.sty
@@ -28,7 +28,7 @@
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{exercise}
- [2009/03/26 v1.3 Exercise package (P.Pichaureau)]
+ [2010/08/27 v1.4 Exercise package (P.Pichaureau)]
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -88,7 +88,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}%
+}
+}{}
\newlength{\Exesep}
\setlength{\Exesep}{1\baselineskip}
\newlength{\Exetopsep}
@@ -137,6 +146,8 @@
\@tempcnta by -1 }}
\def\DifficultyMarker{*}
\newcommand{\ExerciseHeaderTitle}{\qquad \ExerciseTitle}
+\newcommand{\ExerciseHeaderConcours}{\ExerciseConcours}
+\newcommand{\ExerciseHeaderAnnee}{\ \ExerciseAnnee}
\newcommand{\ExerciseHeaderDifficulty}{\theExerciseDifficulty\ }
\newcommand{\ExerciseHeaderOrigin}{%
\ ({\usefont{\encodingdefault}{\rmdefault}{m}{it}\ExerciseOrigin})}
@@ -192,30 +203,38 @@
\end{list}\advance\@QuestionLevel by -1}%
\ifnum\@QuestionLevel=\colonnesLevel\end{multicols}\colonnesLevel=-10\fi}
\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
\def\theExerciseDifficulty{\marker{\DifficultyMarker}{\ExerciseDifficulty}}
\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
\newif\if@staredpart
@@ -226,14 +245,20 @@
\@renamepartfalse
\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}%
@@ -243,12 +268,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%
\refstepcounter{\@ExerciseCounter}\fi\fi\fi}
@@ -275,7 +305,7 @@
\def\@@ExeEnv[#1]{\setkeys{PPExercise}{#1}%
\global\@Answerfalse\@BeginExeBox\@@@ExeEnv}
\newcommand{\@@@ExeEnv}{%
- \@selectExercise{\ExerciseTrueLabel}
+ \@selectExercise%{\ExerciseTrueLabel}
\@QuestionLevel1
\refstepExecounter
\begingroup\@getExerciseInfo\ExerciseHeader
@@ -298,7 +328,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}}
@@ -539,13 +569,14 @@
\setcounter{Question}{0}}
\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
@@ -591,39 +622,107 @@
}
\def\defineAnswerCmd{\gdef\@AnswerHeaderRef{\AnswerListHeader}%
\gdef\Answer{\AnswerCmd}}
-\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
}
\newcommand{\ExeText}{\setcounter{savedQuestion}{\value{Question}}%
\termineliste{1}\@echapqtrue}