summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/exercise/README165
-rw-r--r--Master/texmf-dist/doc/latex/exercise/exercise.pdfbin213030 -> 207936 bytes
-rw-r--r--Master/texmf-dist/source/latex/exercise/exercise.dtx136
-rw-r--r--Master/texmf-dist/source/latex/exercise/exercise.ins130
-rw-r--r--Master/texmf-dist/tex/latex/exercise/exercise.sty106
5 files changed, 310 insertions, 227 deletions
diff --git a/Master/texmf-dist/doc/latex/exercise/README b/Master/texmf-dist/doc/latex/exercise/README
index 655e79ff4ae..ae94450c646 100644
--- a/Master/texmf-dist/doc/latex/exercise/README
+++ b/Master/texmf-dist/doc/latex/exercise/README
@@ -1,81 +1,84 @@
-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/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.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 07cad5e2086..721a9524e1e 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 30776f692d3..04f6b15a0c2 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> [2004/09/05 v1.1 Exercise package (P.Pichaureau)]
+%<package> [2009/03/26 v1.3 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{1554}
+%\CheckSum{1615}
%
%
% \GetFileInfo{exercise.sty}
@@ -507,8 +507,29 @@
%displays |<symbol>| repeated |<counter>| times. For example |\marker*2|
% gives **, and |\marker+{14}| gives ++++++++++++++
%
-% By default, the difficulty is symbolized by star. You can customise
-% this by redefining the command |\DifficultyMarker|.
+%By default, the difficulty is symbolized by star. You can customise
+%this by redefining the command |\DifficultyMarker|.
+%
+%\bigskip
+%\changes{v1.3}{2009/03/26}{Added the 'listofexercices' features.}
+%\DescribeMacro{\listofexercices}
+%This command add a list of all the exercise in your document.
+%
+%\begin{decl}
+% |\ListOfExerciseInToc|\\
+% |\ExerciseLevelInToc|\marg{level of exercices}
+%\end{decl}
+%\DescribeMacro{\ListOfExerciseInToc}
+%\DescribeMacro{\ExerciseLevelInToc}
+%If you prefer to display this list of exercises in the table of
+%contents, then use the command |\ListOfExerciseInToc|.
+%
+%By default, the exercises appear in the table of content at the same
+% level as the paragraphs. The command |\ExerciseLevelInToc| is used
+% to customize this behaviour. For example with the command
+% |\ExerciseLevelInToc{subsection}| the exercises will appear at the
+% same level as the subsctions. Avalaible levels are: section,
+% subsection, subsubsection, paragraph and subparagraph.
%
%\section{Customisation}
%
@@ -824,7 +845,7 @@
\newif\if@AswLastExe \@AswLastExefalse
\DeclareOption{noanswer} {\@AnswerOutputfalse}
-\DeclareOption{answeronly} {\@ExerciseOutputfalse}
+\DeclareOption{answeronly} {\@AnswerOutputtrue\@ExerciseOutputfalse}
\DeclareOption{noexercise} {\@ExerciseOutputfalse}
\DeclareOption{exerciseonly} {\@AnswerOutputfalse}
\DeclareOption{outputnothing}{\@ExerciseOutputfalse\@AnswerOutputfalse}
@@ -851,19 +872,31 @@
%\changes{v1.11}{2004/09/08}{Corrected a bug preventing the correct
%use of the \textsf{babel} package.}
% \begin{macrocode}
+\def\listexercisename{List of exercises}%
\def\ExerciseName{Exercise}%
-\def\AnswerName{Answer}%
+\def\AnswerName{Answer of exercise}%
\def\ExerciseListName{Ex.}%
\def\AnswerListName{Answer}%
\def\ExePartName{Part}%
+\def\ArticleOf{of\ }%
\@ifpackageloaded{babel}{
\addto{\captionsfrenchb}{
+ \def\listexercisename{Liste des exercices}%
\def\ExerciseName{Exercice}%
- \def\AnswerName{Solution}%
+ \def\AnswerName{Solution de l'exercice}%
\def\ExerciseListName{Ex.}%
- \def\AnswerListName{Sol.}%
+ \def\AnswerListName{Solution}%
\def\ExePartName{Partie}%
-}}{}
+}
+\addto{\captionsspanish}{
+ \def\listexercisename{\'{I}ndice de \es@uclc Eejercicios}%
+ \def\ExerciseName{Ejercicio}%
+ \def\AnswerName{Soluci\'on del ejercicio}%
+ \def\ExerciseListName{Ej.}%
+ \def\AnswerListName{Soluci\'on}%
+ \def\ExePartName{Parte}%
+ \def\ArticleOf{del\ }%
+ }}{}
% \end{macrocode}
%\subsubsection{Layout}
% First a bunch of length definitions.
@@ -937,19 +970,19 @@
\newcommand{\ExerciseHeaderDifficulty}{\theExerciseDifficulty\ }
\newcommand{\ExerciseHeaderOrigin}{%
\ ({\usefont{\encodingdefault}{\rmdefault}{m}{it}\ExerciseOrigin})}
-\newcommand{\ExerciseHeaderNB}{\ \theExercise}
+\newcommand{\ExerciseHeaderNB}{\theExercise}
\newcommand{\ExerciseHeaderLabel}{\fbox{\textsc{\ExerciseLabel}}}
% \end{macrocode}
% The header itself
% \begin{macrocode}
\newcommand{\ExerciseHeader}{\centerline{%
-\textbf{\large\ExerciseHeaderDifficulty\ExerciseName%
+\textbf{\large\ExerciseHeaderDifficulty\ExerciseName\ %
\ExerciseHeaderNB\ExerciseHeaderTitle\ExerciseHeaderOrigin}}\medskip}
% \end{macrocode}
% The header of exercise in ExerciseList environment
% \begin{macrocode}
\newcommand{\ExerciseListHeader}{\ExerciseHeaderDifficulty%
-\textbf{\ExerciseListName\ExerciseHeaderNB%
+\textbf{\ExerciseListName\ \ExerciseHeaderNB%
\ --- \ \ExerciseHeaderTitle}%
\ExerciseHeaderOrigin\ignorespaces}
% \end{macrocode}
@@ -1023,19 +1056,19 @@
\def\theExerciseDifficulty{\marker{\DifficultyMarker}{\ExerciseDifficulty}}
%
\define@key{PPExercise}{title}%
-{\global\@ExeTitletrue\gdef\ExerciseTitle{\string#1}}
+{\global\@ExeTitletrue\gdef\ExerciseTitle{#1}}
\define@key{PPExercise}{difficulty}%
{\global\@ExeDifficultytrue\global\ExerciseDifficulty=\number#1}
\define@key{PPExercise}{name}%
-{\global\@ExeReNametrue\gdef\@ExerciseName{\string#1}}
+{\global\@ExeReNametrue\gdef\@ExerciseName{#1}}
\define@key{PPExercise}{origin}%
{\global\@ExeOrigintrue\gdef\ExerciseOrigin{#1}}
\define@key{PPExercise}{counter}%
-{\gdef\@ExerciseCounter{\string#1}}
+{\gdef\@ExerciseCounter{#1}}
\define@key{PPExercise}{label}%
-{\global\@ExeLabeltrue\gdef\ExerciseLabel{\string#1}\gdef\ExerciseTrueLabel{#1}}
+{\global\@ExeLabeltrue\gdef\ExerciseLabel{#1}\gdef\ExerciseTrueLabel{#1}}
\define@key{PPExercise}{number}%
-{\global\@ExeNBtrue\gdef\ExerciseLocalNB{\string#1}}
+{\global\@ExeNBtrue\gdef\ExerciseLocalNB{#1}}
%
%% \define@key{PPExercise}{domain}{}
%% \define@key{PPExercise}{sdomain}{}
@@ -1065,7 +1098,8 @@
\gdef\@ExerciseCounter{Exercise}%
\setcounter{ExePart}{0}%
\setcounter{Question}{0}%
-\global\@ExeLabelfalse}
+\global\@ExeLabelfalse%
+}
%
\def\@getExerciseInfo{%
\if@ExeReName\def\ExerciseName{\@ExerciseName}\fi%
@@ -1078,8 +1112,8 @@
\if@ExeLabel\label{\ExerciseLabel}\recordExerciseLabel{\ExerciseLabel}\fi%
}
%
-\def\refstepExecounter{\if@ExeStared\else\if@ExeNB\else%
-\refstepcounter{\@ExerciseCounter}\fi\fi}
+\def\refstepExecounter{\if@ShipThisExercise\if@ExeStared\else\if@ExeNB\else%
+\refstepcounter{\@ExerciseCounter}\fi\fi\fi}
%
\def\recordExerciseLabel#1{\@bsphack
\protected@write\@auxout{}%
@@ -1100,7 +1134,7 @@
\global\setbox\temp@Exercisebox%
\vbox{\unvbox\all@Exercisebox\vskip\Exesep\unvbox\@Exercisebox\vskip\z@}%
\global\setbox\all@Exercisebox\copy\temp@Exercisebox%
-\else\vskip\Exesep\unvbox\@Exercisebox\fi\fi}
+\else\unvbox\@Exercisebox\fi\fi}
%
\newcommand{\shipoutAnswer}{\if@AnswerOutput\unvbox\all@Answerbox\fi}
\newcommand{\shipoutExercise}{\if@ExerciseOutput\unvbox\all@Exercisebox\fi}
@@ -1116,7 +1150,11 @@
\@selectExercise{\ExerciseTrueLabel}
\@QuestionLevel1
\refstepExecounter
- \begingroup\@getExerciseInfo\ExerciseHeader\endgroup}
+ \begingroup\@getExerciseInfo\ExerciseHeader
+ \addcontentsline{\ext@exercise}{\toc@exercise}{\ExerciseName\
+ \theExercise\ \expandafter{\itshape
+ \ExerciseTitle}\hspace{.66em}}
+ \endgroup}
%
%
\def\endExerciseEnv{\termineliste{1}\@EndExeBox}
@@ -1142,6 +1180,8 @@
\fi
\@selectExercise{\ExerciseTrueLabel}
\global\@Answerfalse\@BeginExeBox\refstepExecounter%
+ \addcontentsline{\ext@exercise}{\toc@exercise}{\ExerciseName\
+ \theExercise\ \expandafter{\itshape \ExerciseTitle}\hspace{.66em}}
\item\ignorespaces
}
%
@@ -1179,11 +1219,12 @@
\newif\if@QuestionDifficulty \@QuestionDifficultyfalse
%
\define@key{PPQuestion}{title}{%
-\global\@QuestionTitletrue\gdef\QuestionTitle{\string#1}}
+\global\@QuestionTitletrue\gdef\QuestionTitle{#1}}
\define@key{PPQuestion}{difficulty}{%
\global\@QuestionDifficultytrue\global\QuestionDifficulty=\number#1}
%
-\def\@InitQuestion{\gdef\QuestionTitle{}%
+\def\@InitQuestion{\nopagebreak
+\gdef\QuestionTitle{}%
\global\QuestionDifficulty=0%
\global\@QuestionTitlefalse%
\global\@QuestionDifficultyfalse}
@@ -1208,7 +1249,7 @@
\begin{list}{}{\leftmargin \QuestionIndent
\partopsep0pt \parsep\parskip \topsep \QuestionBefore
\itemsep \QuestionBefore \labelwidth 2em
- \labelsep .5em
+ \labelsep .33em
\usecounter{Question}}
\if@echapq
\setcounter{Question}{\value{savedQuestion}}\global\@echapqfalse
@@ -1245,7 +1286,7 @@
\newif\if@subQuestionDifficulty\@subQuestionDifficultyfalse
%
\define@key{PPsubQuestion}{title}{%
-\gdef\subQuestionTitle{\string#1}\global\@subQuestionTitletrue}
+\gdef\subQuestionTitle{#1}\global\@subQuestionTitletrue}
\define@key{PPsubQuestion}{difficulty}{%
\global\@subQuestionDifficultytrue\global\subQuestionDifficulty=\number#1}
%
@@ -1276,7 +1317,7 @@
\begin{list}{}{\leftmargin \subQuestionIndent
\partopsep0pt \parsep\parskip \topsep \subQuestionBefore
\itemsep \subQuestionBefore \labelwidth 2em
- \labelsep .5em
+ \labelsep .33em
\usecounter{subQuestion}}
\if@echapq
\setcounter{subQuestion}{\value{savedsubQuestion}}%
@@ -1309,7 +1350,7 @@
\newif\if@subsubQuestionDifficulty\@subsubQuestionDifficultyfalse
%
\define@key{PPsubsubQuestion}{title}{%
-\gdef\subsubQuestionTitle{\string#1}\global\@subsubQuestionTitletrue}
+\gdef\subsubQuestionTitle{#1}\global\@subsubQuestionTitletrue}
\define@key{PPsubsubQuestion}{difficulty}{%
\global\@subsubQuestionDifficultytrue%
\global\subsubQuestionDifficulty=\number#1}
@@ -1340,7 +1381,7 @@
\begin{list}{}{\leftmargin \subsubQuestionIndent
\partopsep0pt \parsep\parskip \topsep \subsubQuestionBefore
\itemsep \subsubQuestionBefore \labelwidth 2em
- \labelsep .5em
+ \labelsep .33em
\usecounter{subsubQuestion}}
\if@echapq
\setcounter{subsubQuestion}{\value{savedsubsubQuestion}}%
@@ -1386,9 +1427,9 @@
\global\@ExePartDifficultyfalse%
\setcounter{Question}{0}\termineliste{1}}
%
-\define@key{PPExePart}{title}{\gdef\ExePartTitle{\string#1}%
+\define@key{PPExePart}{title}{\gdef\ExePartTitle{#1}%
\global\@ExePartTitletrue}
-\define@key{PPExePart}{name}{\gdef\@ExePartName{\string#1}%
+\define@key{PPExePart}{name}{\gdef\@ExePartName{#1}%
\global\@ExePartReNametrue}
\define@key{PPExePart}{difficulty}{\global\@ExePartDifficultytrue%
\global\ExePartDifficulty=\number#1}
@@ -1416,14 +1457,13 @@
% \begin{macrocode}
\newbox\@Answerbox
%
-%% \newcommand{\AnswerHeaderRef}{Answer of \ExerciseName\ \theExercise}
-%% \newcommand{\AnswerListHeaderRef}{Answer (ex.\ \theExercise)\ ---\ }
+%\changes{v1.3}{2009/03/26}{Header of answers are now correct.}
%
-\newcommand{\AnswerHeader}{\medskip\centerline{\textbf{Answer of
- \ExerciseName \ExerciseHeaderNB}\smallskip}}
+\newcommand{\AnswerHeader}{\medskip\centerline{\textbf{\AnswerName\ %
+ \ExerciseHeaderNB}\smallskip}}
%
-\newcommand{\AnswerListHeader}{\textbf{Answer (ex.\
- \ExerciseHeaderNB)\ ---\ }}
+\newcommand{\AnswerListHeader}{\textbf{\AnswerListName\
+ (\ExerciseListName\ \ExerciseHeaderNB)\ ---\ }}
%
% The commands for <Exercise> environment
%
@@ -1450,7 +1490,7 @@
\if@AswLastExe
\else
\PackageWarning{Exercise}%
-{A answer has no reference and no number}{}%
+{An answer has no reference and no number}{}%
\def\AnswerHeaderRef{\AnswerName\ ???}%
\def\AnswerListHeaderRef{\AnswerName\ ???}%
\fi\fi\fi}
@@ -1470,7 +1510,7 @@
\@QuestionLevel1
\begingroup\@getExerciseInfo\@getAnswerInfo\AnswerHeader\endgroup}
%
-\def\endAnswerEnv{\termineliste{1}\@EndExeBox}
+\def\endAnswerEnv{\termineliste{1}\@EndExeBox\termineliste{0}}
%
\newenvironment{Answer}{}{}
\def\defineAnswerEnv{
@@ -1491,7 +1531,7 @@
\topsep\Exetopsep \labelwidth\Exelabelwidth
\leftmargin\Exeleftmargin
\rightmargin\Exerightmargin }
- \refstepExecounter
+%% \refstepExecounter
\else
\termineliste{1}\@EndExeBox
\fi
@@ -1515,7 +1555,6 @@
\def\def@ListOfExercise#1{\gdef\@ListOfExercise{#1}}
\def\@selectExercise#1{%
\ifx#1\@empty
- \message{PAs de label}
\if@ExerciseNoLabelSelected
\global\@ShipThisExercisetrue
\else
@@ -1526,7 +1565,6 @@
\global\@ShipThisExercisefalse
\@for\@label:=\@ListOfExercise\do
{ \ifthenelse{\equal{\@label}{#1}}{
- \message{[\@label = #1] OK !!!}
\global\@ShipThisExercisetrue
}{}
}
@@ -1591,5 +1629,19 @@
\let\@ifdefinable\@rc@ifdefinable
\@ifnextchar[{\@newctr{#1}}{}}
% \end{macrocode}
+% \begin{macrocode}
+\def\ext@exercise{loe}
+\newcommand{\ExerciseLevelInToc}[1]{\def\toc@exercise{#1}}
+\ExerciseLevelInToc{exercise}
+\newcommand{\ListOfExerciseInToc}{\def\ext@exercise{toc}\ExerciseLevelInToc{paragraph}}
+\newcommand\listofexercises{%
+ \section*{\listexercisename}%
+ \@mkboth{\MakeUppercase\listexercisename}%
+ {\MakeUppercase\listexercisename}%
+ \@starttoc{\ext@exercise}%
+}
+\newcommand*\l@exercise{\@dottedtocline{2}{1.5em}{2.3em}}
+% \end{macrocode}
+
% \Finale
\endinput
diff --git a/Master/texmf-dist/source/latex/exercise/exercise.ins b/Master/texmf-dist/source/latex/exercise/exercise.ins
index 57d5817637f..c2a5b09dcd7 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 523c29060e5..e6e29c8b082 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}
- [2004/09/05 v1.1 Exercise package (P.Pichaureau)]
+ [2009/03/26 v1.3 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
@@ -52,7 +52,7 @@
\newif\if@AswLastExe \@AswLastExefalse
\DeclareOption{noanswer} {\@AnswerOutputfalse}
-\DeclareOption{answeronly} {\@ExerciseOutputfalse}
+\DeclareOption{answeronly} {\@AnswerOutputtrue\@ExerciseOutputfalse}
\DeclareOption{noexercise} {\@ExerciseOutputfalse}
\DeclareOption{exerciseonly} {\@AnswerOutputfalse}
\DeclareOption{outputnothing}{\@ExerciseOutputfalse\@AnswerOutputfalse}
@@ -64,19 +64,31 @@
\ProcessOptions
\RequirePackage{keyval, ifthen}
+\def\listexercisename{List of exercises}%
\def\ExerciseName{Exercise}%
-\def\AnswerName{Answer}%
+\def\AnswerName{Answer of exercise}%
\def\ExerciseListName{Ex.}%
\def\AnswerListName{Answer}%
\def\ExePartName{Part}%
+\def\ArticleOf{of\ }%
\@ifpackageloaded{babel}{
\addto{\captionsfrenchb}{
+ \def\listexercisename{Liste des exercices}%
\def\ExerciseName{Exercice}%
- \def\AnswerName{Solution}%
+ \def\AnswerName{Solution de l'exercice}%
\def\ExerciseListName{Ex.}%
- \def\AnswerListName{Sol.}%
+ \def\AnswerListName{Solution}%
\def\ExePartName{Partie}%
-}}{}
+}
+\addto{\captionsspanish}{
+ \def\listexercisename{\'{I}ndice de \es@uclc Eejercicios}%
+ \def\ExerciseName{Ejercicio}%
+ \def\AnswerName{Soluci\'on del ejercicio}%
+ \def\ExerciseListName{Ej.}%
+ \def\AnswerListName{Soluci\'on}%
+ \def\ExePartName{Parte}%
+ \def\ArticleOf{del\ }%
+ }}{}
\newlength{\Exesep}
\setlength{\Exesep}{1\baselineskip}
\newlength{\Exetopsep}
@@ -128,13 +140,13 @@
\newcommand{\ExerciseHeaderDifficulty}{\theExerciseDifficulty\ }
\newcommand{\ExerciseHeaderOrigin}{%
\ ({\usefont{\encodingdefault}{\rmdefault}{m}{it}\ExerciseOrigin})}
-\newcommand{\ExerciseHeaderNB}{\ \theExercise}
+\newcommand{\ExerciseHeaderNB}{\theExercise}
\newcommand{\ExerciseHeaderLabel}{\fbox{\textsc{\ExerciseLabel}}}
\newcommand{\ExerciseHeader}{\centerline{%
-\textbf{\large\ExerciseHeaderDifficulty\ExerciseName%
+\textbf{\large\ExerciseHeaderDifficulty\ExerciseName\ %
\ExerciseHeaderNB\ExerciseHeaderTitle\ExerciseHeaderOrigin}}\medskip}
\newcommand{\ExerciseListHeader}{\ExerciseHeaderDifficulty%
-\textbf{\ExerciseListName\ExerciseHeaderNB%
+\textbf{\ExerciseListName\ \ExerciseHeaderNB%
\ --- \ \ExerciseHeaderTitle}%
\ExerciseHeaderOrigin\ignorespaces}
\newcommand{\ExePartHeaderNB}{\ \theExePart}
@@ -188,19 +200,19 @@
\newif\if@ExeNB \@ExeNBfalse
\def\theExerciseDifficulty{\marker{\DifficultyMarker}{\ExerciseDifficulty}}
\define@key{PPExercise}{title}%
-{\global\@ExeTitletrue\gdef\ExerciseTitle{\string#1}}
+{\global\@ExeTitletrue\gdef\ExerciseTitle{#1}}
\define@key{PPExercise}{difficulty}%
{\global\@ExeDifficultytrue\global\ExerciseDifficulty=\number#1}
\define@key{PPExercise}{name}%
-{\global\@ExeReNametrue\gdef\@ExerciseName{\string#1}}
+{\global\@ExeReNametrue\gdef\@ExerciseName{#1}}
\define@key{PPExercise}{origin}%
{\global\@ExeOrigintrue\gdef\ExerciseOrigin{#1}}
\define@key{PPExercise}{counter}%
-{\gdef\@ExerciseCounter{\string#1}}
+{\gdef\@ExerciseCounter{#1}}
\define@key{PPExercise}{label}%
-{\global\@ExeLabeltrue\gdef\ExerciseLabel{\string#1}\gdef\ExerciseTrueLabel{#1}}
+{\global\@ExeLabeltrue\gdef\ExerciseLabel{#1}\gdef\ExerciseTrueLabel{#1}}
\define@key{PPExercise}{number}%
-{\global\@ExeNBtrue\gdef\ExerciseLocalNB{\string#1}}
+{\global\@ExeNBtrue\gdef\ExerciseLocalNB{#1}}
%% \define@key{PPExercise}{domain}{}
%% \define@key{PPExercise}{sdomain}{}
%% \define@key{PPExercise}{keyword}{}
@@ -226,7 +238,8 @@
\gdef\@ExerciseCounter{Exercise}%
\setcounter{ExePart}{0}%
\setcounter{Question}{0}%
-\global\@ExeLabelfalse}
+\global\@ExeLabelfalse%
+}
\def\@getExerciseInfo{%
\if@ExeReName\def\ExerciseName{\@ExerciseName}\fi%
\if@ExeTitle\else\def\ExerciseHeaderTitle{}\fi%
@@ -237,8 +250,8 @@
\if@ExeNB\def\theExercise{\ExerciseLocalNB}\fi%
\if@ExeLabel\label{\ExerciseLabel}\recordExerciseLabel{\ExerciseLabel}\fi%
}
-\def\refstepExecounter{\if@ExeStared\else\if@ExeNB\else%
-\refstepcounter{\@ExerciseCounter}\fi\fi}
+\def\refstepExecounter{\if@ShipThisExercise\if@ExeStared\else\if@ExeNB\else%
+\refstepcounter{\@ExerciseCounter}\fi\fi\fi}
\def\recordExerciseLabel#1{\@bsphack
\protected@write\@auxout{}%
{\string\newlabel{PP#1}{{\@AnswerHeaderRef}{\thepage}}}%
@@ -255,7 +268,7 @@
\global\setbox\temp@Exercisebox%
\vbox{\unvbox\all@Exercisebox\vskip\Exesep\unvbox\@Exercisebox\vskip\z@}%
\global\setbox\all@Exercisebox\copy\temp@Exercisebox%
-\else\vskip\Exesep\unvbox\@Exercisebox\fi\fi}
+\else\unvbox\@Exercisebox\fi\fi}
\newcommand{\shipoutAnswer}{\if@AnswerOutput\unvbox\all@Answerbox\fi}
\newcommand{\shipoutExercise}{\if@ExerciseOutput\unvbox\all@Exercisebox\fi}
\def\beginExerciseEnv{\@InitExe\@ifnextchar[\@@ExeEnv{\@@ExeEnv[]}}%]
@@ -265,7 +278,11 @@
\@selectExercise{\ExerciseTrueLabel}
\@QuestionLevel1
\refstepExecounter
- \begingroup\@getExerciseInfo\ExerciseHeader\endgroup}
+ \begingroup\@getExerciseInfo\ExerciseHeader
+ \addcontentsline{\ext@exercise}{\toc@exercise}{\ExerciseName\
+ \theExercise\ \expandafter{\itshape
+ \ExerciseTitle}\hspace{.66em}}
+ \endgroup}
\def\endExerciseEnv{\termineliste{1}\@EndExeBox}
\def\ExerciseCmd{\@InitExe\@ifstar{\global\@ExeStaredtrue\@ExeCmd}%
{\global\@ExeStaredfalse\@ExeCmd}}
@@ -283,6 +300,8 @@
\fi
\@selectExercise{\ExerciseTrueLabel}
\global\@Answerfalse\@BeginExeBox\refstepExecounter%
+ \addcontentsline{\ext@exercise}{\toc@exercise}{\ExerciseName\
+ \theExercise\ \expandafter{\itshape \ExerciseTitle}\hspace{.66em}}
\item\ignorespaces
}
\def\defineExePartInEnv{\def\@ExePartHeader{\ExePartHeader}}
@@ -309,10 +328,11 @@
\global\newcount\QuestionDifficulty \QuestionDifficulty=0
\newif\if@QuestionDifficulty \@QuestionDifficultyfalse
\define@key{PPQuestion}{title}{%
-\global\@QuestionTitletrue\gdef\QuestionTitle{\string#1}}
+\global\@QuestionTitletrue\gdef\QuestionTitle{#1}}
\define@key{PPQuestion}{difficulty}{%
\global\@QuestionDifficultytrue\global\QuestionDifficulty=\number#1}
-\def\@InitQuestion{\gdef\QuestionTitle{}%
+\def\@InitQuestion{\nopagebreak
+\gdef\QuestionTitle{}%
\global\QuestionDifficulty=0%
\global\@QuestionTitlefalse%
\global\@QuestionDifficultyfalse}
@@ -332,7 +352,7 @@
\begin{list}{}{\leftmargin \QuestionIndent
\partopsep0pt \parsep\parskip \topsep \QuestionBefore
\itemsep \QuestionBefore \labelwidth 2em
- \labelsep .5em
+ \labelsep .33em
\usecounter{Question}}
\if@echapq
\setcounter{Question}{\value{savedQuestion}}\global\@echapqfalse
@@ -362,7 +382,7 @@
\global\newcount\subQuestionDifficulty\subQuestionDifficulty=0
\newif\if@subQuestionDifficulty\@subQuestionDifficultyfalse
\define@key{PPsubQuestion}{title}{%
-\gdef\subQuestionTitle{\string#1}\global\@subQuestionTitletrue}
+\gdef\subQuestionTitle{#1}\global\@subQuestionTitletrue}
\define@key{PPsubQuestion}{difficulty}{%
\global\@subQuestionDifficultytrue\global\subQuestionDifficulty=\number#1}
\def\@InitsubQuestion{\gdef\subQuestionTitle{}%
@@ -388,7 +408,7 @@
\begin{list}{}{\leftmargin \subQuestionIndent
\partopsep0pt \parsep\parskip \topsep \subQuestionBefore
\itemsep \subQuestionBefore \labelwidth 2em
- \labelsep .5em
+ \labelsep .33em
\usecounter{subQuestion}}
\if@echapq
\setcounter{subQuestion}{\value{savedsubQuestion}}%
@@ -419,7 +439,7 @@
\global\newcount\subsubQuestionDifficulty\subsubQuestionDifficulty=0
\newif\if@subsubQuestionDifficulty\@subsubQuestionDifficultyfalse
\define@key{PPsubsubQuestion}{title}{%
-\gdef\subsubQuestionTitle{\string#1}\global\@subsubQuestionTitletrue}
+\gdef\subsubQuestionTitle{#1}\global\@subsubQuestionTitletrue}
\define@key{PPsubsubQuestion}{difficulty}{%
\global\@subsubQuestionDifficultytrue%
\global\subsubQuestionDifficulty=\number#1}
@@ -446,7 +466,7 @@
\begin{list}{}{\leftmargin \subsubQuestionIndent
\partopsep0pt \parsep\parskip \topsep \subsubQuestionBefore
\itemsep \subsubQuestionBefore \labelwidth 2em
- \labelsep .5em
+ \labelsep .33em
\usecounter{subsubQuestion}}
\if@echapq
\setcounter{subsubQuestion}{\value{savedsubsubQuestion}}%
@@ -486,9 +506,9 @@
\global\@ExePartReNamefalse%
\global\@ExePartDifficultyfalse%
\setcounter{Question}{0}\termineliste{1}}
-\define@key{PPExePart}{title}{\gdef\ExePartTitle{\string#1}%
+\define@key{PPExePart}{title}{\gdef\ExePartTitle{#1}%
\global\@ExePartTitletrue}
-\define@key{PPExePart}{name}{\gdef\@ExePartName{\string#1}%
+\define@key{PPExePart}{name}{\gdef\@ExePartName{#1}%
\global\@ExePartReNametrue}
\define@key{PPExePart}{difficulty}{\global\@ExePartDifficultytrue%
\global\ExePartDifficulty=\number#1}
@@ -506,12 +526,10 @@
\if@ExePartStared\else\refstepcounter{ExePart}\fi
\begingroup\@getExePartInfo\@ExePartHeader\endgroup}
\newbox\@Answerbox
-%% \newcommand{\AnswerHeaderRef}{Answer of \ExerciseName\ \theExercise}
-%% \newcommand{\AnswerListHeaderRef}{Answer (ex.\ \theExercise)\ ---\ }
-\newcommand{\AnswerHeader}{\medskip\centerline{\textbf{Answer of
- \ExerciseName \ExerciseHeaderNB}\smallskip}}
-\newcommand{\AnswerListHeader}{\textbf{Answer (ex.\
- \ExerciseHeaderNB)\ ---\ }}
+\newcommand{\AnswerHeader}{\medskip\centerline{\textbf{\AnswerName\ %
+ \ExerciseHeaderNB}\smallskip}}
+\newcommand{\AnswerListHeader}{\textbf{\AnswerListName\
+ (\ExerciseListName\ \ExerciseHeaderNB)\ ---\ }}
\def\@InitAnswer{\@savemathindent\global\@echapqfalse%
\gdef\AnswerRef{}%
\global\@AnswerReffalse%
@@ -534,7 +552,7 @@
\if@AswLastExe
\else
\PackageWarning{Exercise}%
-{A answer has no reference and no number}{}%
+{An answer has no reference and no number}{}%
\def\AnswerHeaderRef{\AnswerName\ ???}%
\def\AnswerListHeaderRef{\AnswerName\ ???}%
\fi\fi\fi}
@@ -548,7 +566,7 @@
\newcommand{\@@@AnswerEnv}{%
\@QuestionLevel1
\begingroup\@getExerciseInfo\@getAnswerInfo\AnswerHeader\endgroup}
-\def\endAnswerEnv{\termineliste{1}\@EndExeBox}
+\def\endAnswerEnv{\termineliste{1}\@EndExeBox\termineliste{0}}
\newenvironment{Answer}{}{}
\def\defineAnswerEnv{
\gdef\@AnswerHeaderRef{\AnswerHeader}
@@ -564,7 +582,7 @@
\topsep\Exetopsep \labelwidth\Exelabelwidth
\leftmargin\Exeleftmargin
\rightmargin\Exerightmargin }
- \refstepExecounter
+%% \refstepExecounter
\else
\termineliste{1}\@EndExeBox
\fi
@@ -584,7 +602,6 @@
\def\def@ListOfExercise#1{\gdef\@ListOfExercise{#1}}
\def\@selectExercise#1{%
\ifx#1\@empty
- \message{PAs de label}
\if@ExerciseNoLabelSelected
\global\@ShipThisExercisetrue
\else
@@ -595,7 +612,6 @@
\global\@ShipThisExercisefalse
\@for\@label:=\@ListOfExercise\do
{ \ifthenelse{\equal{\@label}{#1}}{
- \message{[\@label = #1] OK !!!}
\global\@ShipThisExercisetrue
}{}
}
@@ -639,6 +655,18 @@
\relax
\let\@ifdefinable\@rc@ifdefinable
\@ifnextchar[{\@newctr{#1}}{}}
+\def\ext@exercise{loe}
+\newcommand{\ExerciseLevelInToc}[1]{\def\toc@exercise{#1}}
+\ExerciseLevelInToc{exercise}
+\newcommand{\ListOfExerciseInToc}{\def\ext@exercise{toc}\ExerciseLevelInToc{paragraph}}
+\newcommand\listofexercises{%
+ \section*{\listexercisename}%
+ \@mkboth{\MakeUppercase\listexercisename}%
+ {\MakeUppercase\listexercisename}%
+ \@starttoc{\ext@exercise}%
+}
+\newcommand*\l@exercise{\@dottedtocline{2}{1.5em}{2.3em}}
+
\endinput
%%
%% End of file `exercise.sty'.