summaryrefslogtreecommitdiff
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
parent122d749a0aa11870aba704eb168d86722b47457c (diff)
exercise update (27aug10)
git-svn-id: svn://tug.org/texlive/trunk@19783 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/exercise/README171
-rw-r--r--Master/texmf-dist/doc/latex/exercise/exercise.pdfbin207936 -> 358466 bytes
-rw-r--r--Master/texmf-dist/source/latex/exercise/exercise.dtx217
-rw-r--r--Master/texmf-dist/source/latex/exercise/exercise.ins130
-rw-r--r--Master/texmf-dist/tex/latex/exercise/exercise.sty181
5 files changed, 448 insertions, 251 deletions
diff --git a/Master/texmf-dist/doc/latex/exercise/README b/Master/texmf-dist/doc/latex/exercise/README
index ae94450c646..519ed4a504e 100644
--- a/Master/texmf-dist/doc/latex/exercise/README
+++ b/Master/texmf-dist/doc/latex/exercise/README
@@ -1,84 +1,87 @@
-Typesetting exercises: the exercise package
-===========================================
-
-The package helps to typeset exercises or list of exercises within any
-document.
-
-Exercises, questions, sub-questions are automatically numbered. It is
-possible to put answers in the same document, and display them
-immediately, later in the document or not at all.
-
-The layout of exercise is fully customisable. It is then possible to typeset
-long problems, short exercises, questionnaires, etc.
-
-Usage of the babel package is detected, but not fully supported by now
-(only english and french are implemented). See documentation for more
-information.
-
-Copyright:
-----------
-
-Copyright (C) 2004 by Paul Pichaureau
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-
-Installation:
--------------
-
-- execute latex on exercise.ins
-
-- execute latex on exercise.dtx
-
-- produce Index and Change History with
-
- makeindex -s gind.ist -o exercise.ind exercise.idx
- makeindex -s gglo.ist -o exercise.gls exercise.glo
-
-- and then execute latex on exercise.dtx (again !)
-
-- copy exercise.sty and exercise.pdf to the correct places in the texmf
-tree. exercise.sty could be put in
-
- $LOCALTEXMF\tex\latex\exercise
-
-exercise.pdf is the documentation of the package: it could take place
-in
-
- $TEXMF\doc\latex\exercise
-
-- run texhash or the corresponding command of your distribution
-
-
-To do:
-------
-
-- Add more languages.
-
-
-Change log:
------------
-- v1.3 2009/03/26 Spanish support added
- List of exercices support
- Bug corrected
-- v1.2 2006/04/22 A basic exercice selection mechanism added.
-- v1.11 2004/09/08 Corrected a bug preventing the correct
- use of the babel package.
-- v1.1 2004/09/05 Added the \renewcounter command
-- v1 2004/08/19 First release
-
-19 aout 2004
-Paul Pichaureau
-paul.pichaureau@alcandre.net
+Typesetting exercises: the exercise package
+===========================================
+
+The package helps to typeset exercises or list of exercises within any
+document.
+
+Exercises, questions, sub-questions are automatically numbered. It is
+possible to put answers in the same document, and display them
+immediately, later in the document or not at all.
+
+The layout of exercise is fully customisable. It is then possible to typeset
+long problems, short exercises, questionnaires, etc.
+
+Usage of the babel package is detected, but not fully supported by now
+(only english and french are implemented). See documentation for more
+information.
+
+Copyright:
+----------
+
+Copyright (C) 2004 by Paul Pichaureau
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+Installation:
+-------------
+
+- execute latex on exercise.ins
+
+- execute latex on exercise.dtx
+
+- produce Index and Change History with
+
+ makeindex -s gind.ist -o exercise.ind exercise.idx
+ makeindex -s gglo.ist -o exercise.gls exercise.glo
+
+- and then execute latex on exercise.dtx (again !)
+
+- copy exercise.sty and exercise.pdf to the correct places in the texmf
+tree. exercise.sty could be put in
+
+ $LOCALTEXMF\tex\latex\exercise
+
+exercise.pdf is the documentation of the package: it could take place
+in
+
+ $TEXMF\doc\latex\exercise
+
+- run texhash or the corresponding command of your distribution
+
+
+To do:
+------
+
+- Add more languages.
+
+
+Change log:
+-----------
+- v1.4 2010/08/27 Many bugs corrected
+ Exercise selection reviewed
+- v1.31 2009/03/28 Italian support added
+- v1.3 2009/03/26 Spanish support added
+ List of exercices support
+ Bug corrected
+- v1.2 2006/04/22 A basic exercice selection mechanism added.
+- v1.11 2004/09/08 Corrected a bug preventing the correct
+ use of the babel package.
+- v1.1 2004/09/05 Added the \renewcounter command
+- v1 2004/08/19 First release
+
+19 aout 2004
+Paul Pichaureau
+paul.pichaureau@alcandre.net
diff --git a/Master/texmf-dist/doc/latex/exercise/exercise.pdf b/Master/texmf-dist/doc/latex/exercise/exercise.pdf
index 721a9524e1e..65cca450ae6 100644
--- a/Master/texmf-dist/doc/latex/exercise/exercise.pdf
+++ b/Master/texmf-dist/doc/latex/exercise/exercise.pdf
Binary files differ
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}
diff --git a/Master/texmf-dist/source/latex/exercise/exercise.ins b/Master/texmf-dist/source/latex/exercise/exercise.ins
index c2a5b09dcd7..57d5817637f 100644
--- a/Master/texmf-dist/source/latex/exercise/exercise.ins
+++ b/Master/texmf-dist/source/latex/exercise/exercise.ins
@@ -1,66 +1,66 @@
-%% Copyright (C) 2003 by Paul Pichaureau
-%%
-%% This program is free software; you can redistribute it and/or
-%% modify it under the terms of the GNU General Public License
-%% as published by the Free Software Foundation; either version 2
-%% of the License, or (at your option) any later version.
-%%
-%% This program is distributed in the hope that it will be useful,
-%% but WITHOUT ANY WARRANTY; without even the implied warranty of
-%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-%% GNU General Public License for more details.
-%%
-%% You should have received a copy of the GNU General Public License
-%% along with this program; if not, write to the Free Software
-%% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-%% Public LaTeX Project Public
-
-\input docstrip.tex
-
-%\keepsilent
-
-\usedir{tex/latex/exercise}
-
-\preamble
-
-This is a generated file.
-
-Copyright (C) 2003 by Paul Pichaureau
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-Public LaTeX Project Public
-
-\endpreamble
-
-\generate{\file{exercise.sty}{\from{exercise.dtx}{package}}}
-
-\Msg{*********************************************************}
-\Msg{*}
-\Msg{* To finish the installation you have to move the}
-\Msg{* following file into a directory searched by TeX:}
-\Msg{*}
-\Msg{* \space\space exercise.sty}
-\Msg{*}
-\Msg{* To produce the documentation run the file exercise.dtx}
-\Msg{* through LaTeX.}
-\Msg{*}
-\Msg{* Don't forget to produce Index and Change History with}
-\Msg{* makeindex -s gind.ist -o exercise.ind exercise.idx}
-\Msg{* makeindex -s gglo.ist -o exercise.gls exercise.glo}
-\Msg{*}
-\Msg{* Happy TeXing!}
-\Msg{*********************************************************}
-
+%% Copyright (C) 2003 by Paul Pichaureau
+%%
+%% This program is free software; you can redistribute it and/or
+%% modify it under the terms of the GNU General Public License
+%% as published by the Free Software Foundation; either version 2
+%% of the License, or (at your option) any later version.
+%%
+%% This program is distributed in the hope that it will be useful,
+%% but WITHOUT ANY WARRANTY; without even the implied warranty of
+%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+%% GNU General Public License for more details.
+%%
+%% You should have received a copy of the GNU General Public License
+%% along with this program; if not, write to the Free Software
+%% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+%% Public LaTeX Project Public
+
+\input docstrip.tex
+
+%\keepsilent
+
+\usedir{tex/latex/exercise}
+
+\preamble
+
+This is a generated file.
+
+Copyright (C) 2003 by Paul Pichaureau
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+Public LaTeX Project Public
+
+\endpreamble
+
+\generate{\file{exercise.sty}{\from{exercise.dtx}{package}}}
+
+\Msg{*********************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the}
+\Msg{* following file into a directory searched by TeX:}
+\Msg{*}
+\Msg{* \space\space exercise.sty}
+\Msg{*}
+\Msg{* To produce the documentation run the file exercise.dtx}
+\Msg{* through LaTeX.}
+\Msg{*}
+\Msg{* Don't forget to produce Index and Change History with}
+\Msg{* makeindex -s gind.ist -o exercise.ind exercise.idx}
+\Msg{* makeindex -s gglo.ist -o exercise.gls exercise.glo}
+\Msg{*}
+\Msg{* Happy TeXing!}
+\Msg{*********************************************************}
+
\endbatchfile \ No newline at end of file
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}