diff options
-rwxr-xr-x | Build/tools/tpm-ctan-check | 3 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/exercise/README | 5 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/exercise/exercise.pdf | bin | 213600 -> 213030 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/exercise/exercise.dtx | 176 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exercise/exercise.sty | 122 | ||||
-rw-r--r-- | Master/texmf-dist/tpm/exercise.tpm | 8 |
6 files changed, 230 insertions, 84 deletions
diff --git a/Build/tools/tpm-ctan-check b/Build/tools/tpm-ctan-check index 9f42c8a21c6..7d1a5568641 100755 --- a/Build/tools/tpm-ctan-check +++ b/Build/tools/tpm-ctan-check @@ -40,7 +40,8 @@ sub main "draftwatermark", "dtxtut", "ednotes", "elpres", "endheads", "emulateapj", "enumitem", "etaremune", "esint", - "esint-type1", "ethiop", "europecv", "everypage", "exteps", + "esint-type1", "ethiop", "europecv", "everypage", "exercise", + "exteps", "featpost", "flagderiv", "flippdf", ""floatflt", "floatrow", "flowfram", "fltpoint", "fmtcount", "fncychap", "fontspec", "formular", "fourier", "free-math-font-survey", diff --git a/Master/texmf-dist/doc/latex/exercise/README b/Master/texmf-dist/doc/latex/exercise/README index 9d15fdc18a8..655e79ff4ae 100644 --- a/Master/texmf-dist/doc/latex/exercise/README +++ b/Master/texmf-dist/doc/latex/exercise/README @@ -70,9 +70,12 @@ To do: 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@nerim.net
\ No newline at end of file +paul.pichaureau@alcandre.net
diff --git a/Master/texmf-dist/doc/latex/exercise/exercise.pdf b/Master/texmf-dist/doc/latex/exercise/exercise.pdf Binary files differindex ebfebd00941..07cad5e2086 100644 --- a/Master/texmf-dist/doc/latex/exercise/exercise.pdf +++ b/Master/texmf-dist/doc/latex/exercise/exercise.pdf diff --git a/Master/texmf-dist/source/latex/exercise/exercise.dtx b/Master/texmf-dist/source/latex/exercise/exercise.dtx index 72d34436437..30776f692d3 100644 --- a/Master/texmf-dist/source/latex/exercise/exercise.dtx +++ b/Master/texmf-dist/source/latex/exercise/exercise.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2003 by Paul Pichaureau +% Copyright (C) 2003-2006 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 @@ -45,7 +45,7 @@ {\\\hline\end{tabular}\nobreak\@decl@date\par\nobreak \vspace{2.3ex}\vskip -\parskip} \makeatletter - \EnableCrossrefs \PageIndex \RecordChanges + \EnableCrossrefs \PageIndex \makeatother \begin{document} \DocInput{exercise.dtx} @@ -85,7 +85,7 @@ % \DoNotIndex{\setlength,\string,\textbf,\textsc,\emph,\whiledo,\vbox} % \DoNotIndex{\unvbox,\usefont,\usecounter,\value,\vskip,\setbox,\setcounter} % -%\CheckSum{1426} +%\CheckSum{1554} % % % \GetFileInfo{exercise.sty} @@ -118,9 +118,6 @@ % later in the document. %\end{abstract} % -%\changes{v1.0}{2004/08/17}{Initial version} -%\changes{v1.01}{2004/08/18}{Many typos corrected, improved index.} -% %\section{Simple usage} % %This package defines two environments. The environment |Exercise| @@ -469,6 +466,35 @@ %be a |\ExePart| or a |\Question|. % % +% +%\subsection{Exercise selection} +%\begin{decl} +% |\ExerciseStartSelect|\marg{comma separated list}\\ +% |\ExerciseStopSelect| +%\end{decl} +%\DescribeMacro{\ExerciseStartSelect} +%\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 +%\begin{verbatim} +% \ExerciseStartSelect{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} @@ -517,6 +543,9 @@ %add them in the package. Anyway, you can redefine these %commands (with a |\renewcommand|). % +%You must load the \textsf{exercise} package \emph{after} +%\textsf{babel} to activate this option. +% %\subsection{Layout} % %\subsubsection{Exercises, answers and parts} @@ -702,7 +731,7 @@ %\DescribeMacro{\renewcounter} % %\begin{decl} -% |\newcounter|\marg{foo}\oarg{counter} +% |\renewcounter|\marg{foo}\oarg{counter} %\end{decl} % The |\renewcounter| command defines a new counter named |foo|. The % counter is initialized to zero. @@ -711,7 +740,7 @@ % reset whenever the counter named in the optional argument is % incremented. % -% If the counter |foo| was not previously defined, an \LaTeX\ error +% If the counter |foo| was not previously defined, a \LaTeX\ error % occurs. % %\section{Known problems} @@ -819,6 +848,8 @@ %\subsection{Customisation} % %\subsubsection{Internationalisation} +%\changes{v1.11}{2004/09/08}{Corrected a bug preventing the correct +%use of the \textsf{babel} package.} % \begin{macrocode} \def\ExerciseName{Exercise}% \def\AnswerName{Answer}% @@ -827,12 +858,12 @@ \def\ExePartName{Part}% \@ifpackageloaded{babel}{ \addto{\captionsfrenchb}{ - \def\ExerciseName{Exercise}% + \def\ExerciseName{Exercice}% \def\AnswerName{Solution}% \def\ExerciseListName{Ex.}% \def\AnswerListName{Sol.}% - \def\ExePartName{Partie}% -}} + \def\ExePartName{Partie}% +}}{} % \end{macrocode} %\subsubsection{Layout} % First a bunch of length definitions. @@ -842,7 +873,7 @@ \newlength{\Exetopsep} \setlength{\Exetopsep}\z@ \newlength{\Exeparsep} -\setlength{\Exeparsep}\z@ +\setlength{\Exeparsep}{\parskip} \newlength{\Exepartopsep} \setlength{\Exepartopsep}\z@ \newlength{\Exeleftmargin} @@ -866,7 +897,7 @@ \newlength{\subQuestionIndent} \setlength{\subQuestionIndent}{2em} \newlength{\subsubQuestionIndent} -\setlength{\subsubQuestionIndent}{1.5em} +\setlength{\subsubQuestionIndent}{2.5em} % \end{macrocode} % Now the counters % \begin{macrocode} @@ -883,7 +914,7 @@ \renewcommand{\theExePart}{\Roman{ExePart}} \renewcommand{\theQuestion}{\arabic{Question}} \renewcommand{\thesubQuestion}{\alph{subQuestion}} -\renewcommand{\thesubsubQuestion}{\arabic{subsubQuestion}} +\renewcommand{\thesubsubQuestion}{\roman{subsubQuestion}} % \end{macrocode} % For internal purposes % \begin{macrocode} @@ -902,7 +933,7 @@ % \end{macrocode} % Presentation of informations in the header of exercises % \begin{macrocode} -\newcommand{\ExerciseHeaderTitle}{\quad --- \quad \ExerciseTitle} +\newcommand{\ExerciseHeaderTitle}{\qquad \ExerciseTitle} \newcommand{\ExerciseHeaderDifficulty}{\theExerciseDifficulty\ } \newcommand{\ExerciseHeaderOrigin}{% \ ({\usefont{\encodingdefault}{\rmdefault}{m}{it}\ExerciseOrigin})} @@ -933,6 +964,9 @@ \newcommand{\ExePartHeader}{% \medskip\centerline{\emph{\large\ExePartHeaderDifficulty\ExePartName% \ExePartHeaderNB\ExePartHeaderTitle}}} +\newcommand{\ExePartListHeader}{\bigskip% +\emph{\ExePartHeaderDifficulty\ExePartName% +\ExePartHeaderNB\ExePartHeaderTitle}\par\medskip} % \end{macrocode} % Presentation of Questions % \begin{macrocode} @@ -948,7 +982,7 @@ \subQuestionNB)\ \emph{\subQuestionHeaderTitle}} \newcommand{\thesubQuestionDifficulty}{\marker{\DifficultyMarker}% {\subQuestionDifficulty}} -\newcommand{\subsubQuestionNB}{\arabic{subsubQuestion} -- } +\newcommand{\subsubQuestionNB}{\roman{subsubQuestion} -- } \newcommand{\subsubQuestionHeaderTitle}{\emph{(\subsubQuestionTitle)}\ } \newcommand{\subsubQuestionHeaderDifficulty}{\thesubsubQuestionDifficulty\ } \newcommand{\subsubQuestionHeader}{\subsubQuestionHeaderDifficulty% @@ -999,7 +1033,7 @@ \define@key{PPExercise}{counter}% {\gdef\@ExerciseCounter{\string#1}} \define@key{PPExercise}{label}% -{\global\@ExeLabeltrue\gdef\ExerciseLabel{\string#1}} +{\global\@ExeLabeltrue\gdef\ExerciseLabel{\string#1}\gdef\ExerciseTrueLabel{#1}} \define@key{PPExercise}{number}% {\global\@ExeNBtrue\gdef\ExerciseLocalNB{\string#1}} % @@ -1021,7 +1055,7 @@ \gdef\ExerciseTitle{}% \gdef\@ExerciseName{}% \gdef\ExerciseOrigin{}% -\gdef\labelexe{}% +\gdef\ExerciseTrueLabel{}% \global\ExerciseDifficulty=0% \global\@ExeTitlefalse% \global\@ExeReNamefalse% @@ -1029,6 +1063,7 @@ \global\@ExeOriginfalse% \global\@ExeNBfalse% \gdef\@ExerciseCounter{Exercise}% +\setcounter{ExePart}{0}% \setcounter{Question}{0}% \global\@ExeLabelfalse} % @@ -1056,16 +1091,16 @@ \else\if@ExerciseOutput\@DelayExerciseBox\fi\fi} % \def\@DelayAnswerBox{% -\if@AnswerDelay\global\setbox\temp@Answerbox% -\vbox{\unvbox\all@Answerbox\vskip12pt\unvbox\@Exercisebox\vskip\z@}% +\if@ShipThisExercise\if@AnswerDelay\global\setbox\temp@Answerbox% +\vbox{\unvbox\all@Answerbox\vskip\Exesep\unvbox\@Exercisebox\vskip\z@}% \global\setbox\all@Answerbox\copy\temp@Answerbox% -\else\unvbox\@Exercisebox\fi} +\else\unvbox\@Exercisebox\fi\fi} % -\def\@DelayExerciseBox{\if@ExerciseDelay% +\def\@DelayExerciseBox{\if@ShipThisExercise\if@ExerciseDelay% \global\setbox\temp@Exercisebox% -\vbox{\unvbox\all@Exercisebox\vskip12pt\unvbox\@Exercisebox\vskip\z@}% +\vbox{\unvbox\all@Exercisebox\vskip\Exesep\unvbox\@Exercisebox\vskip\z@}% \global\setbox\all@Exercisebox\copy\temp@Exercisebox% -\else\unvbox\@Exercisebox\fi} +\else\vskip\Exesep\unvbox\@Exercisebox\fi\fi} % \newcommand{\shipoutAnswer}{\if@AnswerOutput\unvbox\all@Answerbox\fi} \newcommand{\shipoutExercise}{\if@ExerciseOutput\unvbox\all@Exercisebox\fi} @@ -1078,6 +1113,7 @@ \global\@Answerfalse\@BeginExeBox\@@@ExeEnv} % \newcommand{\@@@ExeEnv}{% + \@selectExercise{\ExerciseTrueLabel} \@QuestionLevel1 \refstepExecounter \begingroup\@getExerciseInfo\ExerciseHeader\endgroup} @@ -1104,15 +1140,19 @@ \else \termineliste{1}\@EndExeBox \fi + \@selectExercise{\ExerciseTrueLabel} \global\@Answerfalse\@BeginExeBox\refstepExecounter% \item\ignorespaces } % +\def\defineExePartInEnv{\def\@ExePartHeader{\ExePartHeader}} +\def\defineExePartInList{\def\@ExePartHeader{\ExePartListHeader}} \def\defineExerciseEnv{% - \renewenvironment{Exercise}{\global\@ExeStaredfalse\beginExerciseEnv}% -{\endExerciseEnv} + \defineExePartInEnv + \renewenvironment{Exercise}{\global\beginExerciseEnv}% +{\@ExeStaredfalse\endExerciseEnv} \renewenvironment{Exercise*}{\global\@ExeStaredtrue\beginExerciseEnv}% -{\endExerciseEnv} +{\@ExeStaredfalse\endExerciseEnv} } \newenvironment{Exercise}{}{} \newenvironment{Exercise*}{}{} @@ -1123,7 +1163,8 @@ % \defineExerciseEnv % -\def\beginExerciseListEnv{\defineExerciseCmd\defineAnswerCmd} +\def\beginExerciseListEnv{\defineExerciseCmd\defineAnswerCmd% +\defineExePartInList} % \def\endExerciseListEnv{\termineliste{1}\@EndExeBox\termineliste{0}% \defineExerciseEnv\defineAnswerEnv} @@ -1138,9 +1179,9 @@ \newif\if@QuestionDifficulty \@QuestionDifficultyfalse % \define@key{PPQuestion}{title}{% -\gdef\QuestionTitle{\string#1}\@QuestionTitletrue} +\global\@QuestionTitletrue\gdef\QuestionTitle{\string#1}} \define@key{PPQuestion}{difficulty}{% -\@QuestionDifficultytrue\global\QuestionDifficulty=\number#1} +\global\@QuestionDifficultytrue\global\QuestionDifficulty=\number#1} % \def\@InitQuestion{\gdef\QuestionTitle{}% \global\QuestionDifficulty=0% @@ -1165,8 +1206,9 @@ \ifnum\@QuestionLevel=1 \advance \@QuestionLevel by 1 \begin{list}{}{\leftmargin \QuestionIndent - \partopsep0pt \parsep0pt \topsep \QuestionBefore + \partopsep0pt \parsep\parskip \topsep \QuestionBefore \itemsep \QuestionBefore \labelwidth 2em + \labelsep .5em \usecounter{Question}} \if@echapq \setcounter{Question}{\value{savedQuestion}}\global\@echapqfalse @@ -1203,9 +1245,9 @@ \newif\if@subQuestionDifficulty\@subQuestionDifficultyfalse % \define@key{PPsubQuestion}{title}{% -\gdef\subQuestionTitle{\string#1}\@subQuestionTitletrue} +\gdef\subQuestionTitle{\string#1}\global\@subQuestionTitletrue} \define@key{PPsubQuestion}{difficulty}{% -\@subQuestionDifficultytrue\global\subQuestionDifficulty=\number#1} +\global\@subQuestionDifficultytrue\global\subQuestionDifficulty=\number#1} % \def\@InitsubQuestion{\gdef\subQuestionTitle{}% \global\subQuestionDifficulty=0% @@ -1232,8 +1274,9 @@ \ifnum\@QuestionLevel=2 \advance \@QuestionLevel by 1 \begin{list}{}{\leftmargin \subQuestionIndent - \partopsep0pt \parsep0pt \topsep \subQuestionBefore + \partopsep0pt \parsep\parskip \topsep \subQuestionBefore \itemsep \subQuestionBefore \labelwidth 2em + \labelsep .5em \usecounter{subQuestion}} \if@echapq \setcounter{subQuestion}{\value{savedsubQuestion}}% @@ -1266,9 +1309,10 @@ \newif\if@subsubQuestionDifficulty\@subsubQuestionDifficultyfalse % \define@key{PPsubsubQuestion}{title}{% -\gdef\subsubQuestionTitle{\string#1}\@QuestionTitletrue} +\gdef\subsubQuestionTitle{\string#1}\global\@subsubQuestionTitletrue} \define@key{PPsubsubQuestion}{difficulty}{% -\@QuestionDifficultytrue\global\subsubQuestionDifficulty=\number#1} +\global\@subsubQuestionDifficultytrue% +\global\subsubQuestionDifficulty=\number#1} % \def\@InitsubsubQuestion{\gdef\subsubQuestionTitle{}% \global\subsubQuestionDifficulty=0% @@ -1294,8 +1338,9 @@ \ifnum\@QuestionLevel=3 \advance \@QuestionLevel by 1 \begin{list}{}{\leftmargin \subsubQuestionIndent - \partopsep0pt \parsep0pt \topsep \subsubQuestionBefore + \partopsep0pt \parsep\parskip \topsep \subsubQuestionBefore \itemsep \subsubQuestionBefore \labelwidth 2em + \labelsep .5em \usecounter{subsubQuestion}} \if@echapq \setcounter{subsubQuestion}{\value{savedsubsubQuestion}}% @@ -1339,11 +1384,13 @@ \global\@ExePartTitlefalse% \global\@ExePartReNamefalse% \global\@ExePartDifficultyfalse% -\setcounter{Question}{0}} +\setcounter{Question}{0}\termineliste{1}} % -\define@key{PPExePart}{title}{\gdef\ExePartTitle{\string#1}\@ExePartTitletrue} -\define@key{PPExePart}{name}{\gdef\@ExePartName{\string#1}\@ExePartReNametrue} -\define@key{PPExePart}{difficulty}{\@ExePartDifficultytrue% +\define@key{PPExePart}{title}{\gdef\ExePartTitle{\string#1}% +\global\@ExePartTitletrue} +\define@key{PPExePart}{name}{\gdef\@ExePartName{\string#1}% +\global\@ExePartReNametrue} +\define@key{PPExePart}{difficulty}{\global\@ExePartDifficultytrue% \global\ExePartDifficulty=\number#1} % \def\@getExePartInfo{% @@ -1362,7 +1409,7 @@ % \newcommand{\@@@ExePart}{% \if@ExePartStared\else\refstepcounter{ExePart}\fi - \begingroup\@getExePartInfo\ExePartHeader\endgroup} + \begingroup\@getExePartInfo\@ExePartHeader\endgroup} % % \end{macrocode} % \subsubsection{ Presentation of answers} @@ -1385,6 +1432,7 @@ \global\@AnswerReffalse% \gdef\AnswerNB{}% \global\@AnswerNBfalse% +\setcounter{ExePart}{0}% \setcounter{Question}{0}} % \def\@getAnswerInfo{% @@ -1420,7 +1468,7 @@ % \newcommand{\@@@AnswerEnv}{% \@QuestionLevel1 - \begingroup\@getAnswerInfo\AnswerHeader\endgroup} + \begingroup\@getExerciseInfo\@getAnswerInfo\AnswerHeader\endgroup} % \def\endAnswerEnv{\termineliste{1}\@EndExeBox} % @@ -1454,7 +1502,46 @@ \def\defineAnswerCmd{\gdef\@AnswerHeaderRef{\AnswerListHeader}% \gdef\Answer{\AnswerCmd}} % \end{macrocode} -% \subsubsection{ Some extra stuff} +% \subsubsection{Exercises selection} +% \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 + \message{PAs de label} + \if@ExerciseNoLabelSelected + \global\@ShipThisExercisetrue + \else + \global\@ShipThisExercisefalse + \fi + \else + \if@ExerciseSelected + \global\@ShipThisExercisefalse + \@for\@label:=\@ListOfExercise\do + { \ifthenelse{\equal{\@label}{#1}}{ + \message{[\@label = #1] OK !!!} + \global\@ShipThisExercisetrue + }{} + } + \if@ExerciseOmitted + \if@ShipThisExercise + \global\@ShipThisExercisefalse + \else + \global\@ShipThisExercisetrue + \fi + \fi + \fi +\fi +} +% \end{macrocode} +% \subsubsection{Some extra stuff} % \begin{macrocode} \newcommand{\ExeText}{\setcounter{savedQuestion}{\value{Question}}% \termineliste{1}\@echapqtrue} @@ -1478,6 +1565,7 @@ % \@ifundefined{if@fleqn}{\newif\if@fleqn\@fleqnfalse}{} % +\newlength{\@savedmathindent} \newcommand{\@savemathindent}{\relax} \newcommand{\@decalemathindent}[1]{\relax} \newcommand{\@restoremathindent}{\relax} diff --git a/Master/texmf-dist/tex/latex/exercise/exercise.sty b/Master/texmf-dist/tex/latex/exercise/exercise.sty index 7030e923157..523c29060e5 100644 --- a/Master/texmf-dist/tex/latex/exercise/exercise.sty +++ b/Master/texmf-dist/tex/latex/exercise/exercise.sty @@ -71,18 +71,18 @@ \def\ExePartName{Part}% \@ifpackageloaded{babel}{ \addto{\captionsfrenchb}{ - \def\ExerciseName{Exercise}% + \def\ExerciseName{Exercice}% \def\AnswerName{Solution}% \def\ExerciseListName{Ex.}% \def\AnswerListName{Sol.}% \def\ExePartName{Partie}% -}} +}}{} \newlength{\Exesep} \setlength{\Exesep}{1\baselineskip} \newlength{\Exetopsep} \setlength{\Exetopsep}\z@ \newlength{\Exeparsep} -\setlength{\Exeparsep}\z@ +\setlength{\Exeparsep}{\parskip} \newlength{\Exepartopsep} \setlength{\Exepartopsep}\z@ \newlength{\Exeleftmargin} @@ -106,7 +106,7 @@ \newlength{\subQuestionIndent} \setlength{\subQuestionIndent}{2em} \newlength{\subsubQuestionIndent} -\setlength{\subsubQuestionIndent}{1.5em} +\setlength{\subsubQuestionIndent}{2.5em} \newcounter{Exercise} \gdef\@ExerciseCounter{Exercise} %default exercise counter \newcounter{ExePart}[Exercise] @@ -117,14 +117,14 @@ \renewcommand{\theExePart}{\Roman{ExePart}} \renewcommand{\theQuestion}{\arabic{Question}} \renewcommand{\thesubQuestion}{\alph{subQuestion}} -\renewcommand{\thesubsubQuestion}{\arabic{subsubQuestion}} +\renewcommand{\thesubsubQuestion}{\roman{subsubQuestion}} \newcounter{savedQuestion} \newcounter{savedsubQuestion} \newcounter{savedsubsubQuestion} \def\marker#1#2{\@tempcnta#2\whiledo{\@tempcnta>0}{#1\advance \@tempcnta by -1 }} \def\DifficultyMarker{*} -\newcommand{\ExerciseHeaderTitle}{\quad --- \quad \ExerciseTitle} +\newcommand{\ExerciseHeaderTitle}{\qquad \ExerciseTitle} \newcommand{\ExerciseHeaderDifficulty}{\theExerciseDifficulty\ } \newcommand{\ExerciseHeaderOrigin}{% \ ({\usefont{\encodingdefault}{\rmdefault}{m}{it}\ExerciseOrigin})} @@ -143,6 +143,9 @@ \newcommand{\ExePartHeader}{% \medskip\centerline{\emph{\large\ExePartHeaderDifficulty\ExePartName% \ExePartHeaderNB\ExePartHeaderTitle}}} +\newcommand{\ExePartListHeader}{\bigskip% +\emph{\ExePartHeaderDifficulty\ExePartName% +\ExePartHeaderNB\ExePartHeaderTitle}\par\medskip} \newcommand{\QuestionNB}{\arabic{Question}.\ } \newcommand{\QuestionHeaderTitle}{\emph{(\QuestionTitle)}\ } \newcommand{\QuestionHeaderDifficulty}{\theQuestionDifficulty\ } @@ -155,7 +158,7 @@ \subQuestionNB)\ \emph{\subQuestionHeaderTitle}} \newcommand{\thesubQuestionDifficulty}{\marker{\DifficultyMarker}% {\subQuestionDifficulty}} -\newcommand{\subsubQuestionNB}{\arabic{subsubQuestion} -- } +\newcommand{\subsubQuestionNB}{\roman{subsubQuestion} -- } \newcommand{\subsubQuestionHeaderTitle}{\emph{(\subsubQuestionTitle)}\ } \newcommand{\subsubQuestionHeaderDifficulty}{\thesubsubQuestionDifficulty\ } \newcommand{\subsubQuestionHeader}{\subsubQuestionHeaderDifficulty% @@ -195,7 +198,7 @@ \define@key{PPExercise}{counter}% {\gdef\@ExerciseCounter{\string#1}} \define@key{PPExercise}{label}% -{\global\@ExeLabeltrue\gdef\ExerciseLabel{\string#1}} +{\global\@ExeLabeltrue\gdef\ExerciseLabel{\string#1}\gdef\ExerciseTrueLabel{#1}} \define@key{PPExercise}{number}% {\global\@ExeNBtrue\gdef\ExerciseLocalNB{\string#1}} %% \define@key{PPExercise}{domain}{} @@ -213,7 +216,7 @@ \gdef\ExerciseTitle{}% \gdef\@ExerciseName{}% \gdef\ExerciseOrigin{}% -\gdef\labelexe{}% +\gdef\ExerciseTrueLabel{}% \global\ExerciseDifficulty=0% \global\@ExeTitlefalse% \global\@ExeReNamefalse% @@ -221,6 +224,7 @@ \global\@ExeOriginfalse% \global\@ExeNBfalse% \gdef\@ExerciseCounter{Exercise}% +\setcounter{ExePart}{0}% \setcounter{Question}{0}% \global\@ExeLabelfalse} \def\@getExerciseInfo{% @@ -243,21 +247,22 @@ \def\@EndExeBox{\egroup\if@Answer\if@AnswerOutput\@DelayAnswerBox\fi% \else\if@ExerciseOutput\@DelayExerciseBox\fi\fi} \def\@DelayAnswerBox{% -\if@AnswerDelay\global\setbox\temp@Answerbox% -\vbox{\unvbox\all@Answerbox\vskip12pt\unvbox\@Exercisebox\vskip\z@}% +\if@ShipThisExercise\if@AnswerDelay\global\setbox\temp@Answerbox% +\vbox{\unvbox\all@Answerbox\vskip\Exesep\unvbox\@Exercisebox\vskip\z@}% \global\setbox\all@Answerbox\copy\temp@Answerbox% -\else\unvbox\@Exercisebox\fi} -\def\@DelayExerciseBox{\if@ExerciseDelay% +\else\unvbox\@Exercisebox\fi\fi} +\def\@DelayExerciseBox{\if@ShipThisExercise\if@ExerciseDelay% \global\setbox\temp@Exercisebox% -\vbox{\unvbox\all@Exercisebox\vskip12pt\unvbox\@Exercisebox\vskip\z@}% +\vbox{\unvbox\all@Exercisebox\vskip\Exesep\unvbox\@Exercisebox\vskip\z@}% \global\setbox\all@Exercisebox\copy\temp@Exercisebox% -\else\unvbox\@Exercisebox\fi} +\else\vskip\Exesep\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[]}}%] \def\@@ExeEnv[#1]{\setkeys{PPExercise}{#1}% \global\@Answerfalse\@BeginExeBox\@@@ExeEnv} \newcommand{\@@@ExeEnv}{% + \@selectExercise{\ExerciseTrueLabel} \@QuestionLevel1 \refstepExecounter \begingroup\@getExerciseInfo\ExerciseHeader\endgroup} @@ -276,21 +281,26 @@ \else \termineliste{1}\@EndExeBox \fi + \@selectExercise{\ExerciseTrueLabel} \global\@Answerfalse\@BeginExeBox\refstepExecounter% \item\ignorespaces } +\def\defineExePartInEnv{\def\@ExePartHeader{\ExePartHeader}} +\def\defineExePartInList{\def\@ExePartHeader{\ExePartListHeader}} \def\defineExerciseEnv{% - \renewenvironment{Exercise}{\global\@ExeStaredfalse\beginExerciseEnv}% -{\endExerciseEnv} + \defineExePartInEnv + \renewenvironment{Exercise}{\global\beginExerciseEnv}% +{\@ExeStaredfalse\endExerciseEnv} \renewenvironment{Exercise*}{\global\@ExeStaredtrue\beginExerciseEnv}% -{\endExerciseEnv} +{\@ExeStaredfalse\endExerciseEnv} } \newenvironment{Exercise}{}{} \newenvironment{Exercise*}{}{} \def\defineExerciseCmd{\def\Exercise{\ExerciseCmd}} \renewcommand{\Exercise}{} \defineExerciseEnv -\def\beginExerciseListEnv{\defineExerciseCmd\defineAnswerCmd} +\def\beginExerciseListEnv{\defineExerciseCmd\defineAnswerCmd% +\defineExePartInList} \def\endExerciseListEnv{\termineliste{1}\@EndExeBox\termineliste{0}% \defineExerciseEnv\defineAnswerEnv} \newenvironment{ExerciseList}{\beginExerciseListEnv}{\endExerciseListEnv} @@ -299,9 +309,9 @@ \global\newcount\QuestionDifficulty \QuestionDifficulty=0 \newif\if@QuestionDifficulty \@QuestionDifficultyfalse \define@key{PPQuestion}{title}{% -\gdef\QuestionTitle{\string#1}\@QuestionTitletrue} +\global\@QuestionTitletrue\gdef\QuestionTitle{\string#1}} \define@key{PPQuestion}{difficulty}{% -\@QuestionDifficultytrue\global\QuestionDifficulty=\number#1} +\global\@QuestionDifficultytrue\global\QuestionDifficulty=\number#1} \def\@InitQuestion{\gdef\QuestionTitle{}% \global\QuestionDifficulty=0% \global\@QuestionTitlefalse% @@ -320,8 +330,9 @@ \ifnum\@QuestionLevel=1 \advance \@QuestionLevel by 1 \begin{list}{}{\leftmargin \QuestionIndent - \partopsep0pt \parsep0pt \topsep \QuestionBefore + \partopsep0pt \parsep\parskip \topsep \QuestionBefore \itemsep \QuestionBefore \labelwidth 2em + \labelsep .5em \usecounter{Question}} \if@echapq \setcounter{Question}{\value{savedQuestion}}\global\@echapqfalse @@ -351,9 +362,9 @@ \global\newcount\subQuestionDifficulty\subQuestionDifficulty=0 \newif\if@subQuestionDifficulty\@subQuestionDifficultyfalse \define@key{PPsubQuestion}{title}{% -\gdef\subQuestionTitle{\string#1}\@subQuestionTitletrue} +\gdef\subQuestionTitle{\string#1}\global\@subQuestionTitletrue} \define@key{PPsubQuestion}{difficulty}{% -\@subQuestionDifficultytrue\global\subQuestionDifficulty=\number#1} +\global\@subQuestionDifficultytrue\global\subQuestionDifficulty=\number#1} \def\@InitsubQuestion{\gdef\subQuestionTitle{}% \global\subQuestionDifficulty=0% \global\@subQuestionTitlefalse% @@ -375,8 +386,9 @@ \ifnum\@QuestionLevel=2 \advance \@QuestionLevel by 1 \begin{list}{}{\leftmargin \subQuestionIndent - \partopsep0pt \parsep0pt \topsep \subQuestionBefore + \partopsep0pt \parsep\parskip \topsep \subQuestionBefore \itemsep \subQuestionBefore \labelwidth 2em + \labelsep .5em \usecounter{subQuestion}} \if@echapq \setcounter{subQuestion}{\value{savedsubQuestion}}% @@ -407,9 +419,10 @@ \global\newcount\subsubQuestionDifficulty\subsubQuestionDifficulty=0 \newif\if@subsubQuestionDifficulty\@subsubQuestionDifficultyfalse \define@key{PPsubsubQuestion}{title}{% -\gdef\subsubQuestionTitle{\string#1}\@QuestionTitletrue} +\gdef\subsubQuestionTitle{\string#1}\global\@subsubQuestionTitletrue} \define@key{PPsubsubQuestion}{difficulty}{% -\@QuestionDifficultytrue\global\subsubQuestionDifficulty=\number#1} +\global\@subsubQuestionDifficultytrue% +\global\subsubQuestionDifficulty=\number#1} \def\@InitsubsubQuestion{\gdef\subsubQuestionTitle{}% \global\subsubQuestionDifficulty=0% \global\@subsubQuestionTitlefalse% @@ -431,8 +444,9 @@ \ifnum\@QuestionLevel=3 \advance \@QuestionLevel by 1 \begin{list}{}{\leftmargin \subsubQuestionIndent - \partopsep0pt \parsep0pt \topsep \subsubQuestionBefore + \partopsep0pt \parsep\parskip \topsep \subsubQuestionBefore \itemsep \subsubQuestionBefore \labelwidth 2em + \labelsep .5em \usecounter{subsubQuestion}} \if@echapq \setcounter{subsubQuestion}{\value{savedsubsubQuestion}}% @@ -471,10 +485,12 @@ \global\@ExePartTitlefalse% \global\@ExePartReNamefalse% \global\@ExePartDifficultyfalse% -\setcounter{Question}{0}} -\define@key{PPExePart}{title}{\gdef\ExePartTitle{\string#1}\@ExePartTitletrue} -\define@key{PPExePart}{name}{\gdef\@ExePartName{\string#1}\@ExePartReNametrue} -\define@key{PPExePart}{difficulty}{\@ExePartDifficultytrue% +\setcounter{Question}{0}\termineliste{1}} +\define@key{PPExePart}{title}{\gdef\ExePartTitle{\string#1}% +\global\@ExePartTitletrue} +\define@key{PPExePart}{name}{\gdef\@ExePartName{\string#1}% +\global\@ExePartReNametrue} +\define@key{PPExePart}{difficulty}{\global\@ExePartDifficultytrue% \global\ExePartDifficulty=\number#1} \def\@getExePartInfo{% \if@ExePartReName\def\ExePartName{\@ExePartName}\fi @@ -488,7 +504,7 @@ \def\@@ExePart[#1]{\setkeys{PPExePart}{#1}\@@@ExePart} \newcommand{\@@@ExePart}{% \if@ExePartStared\else\refstepcounter{ExePart}\fi - \begingroup\@getExePartInfo\ExePartHeader\endgroup} + \begingroup\@getExePartInfo\@ExePartHeader\endgroup} \newbox\@Answerbox %% \newcommand{\AnswerHeaderRef}{Answer of \ExerciseName\ \theExercise} %% \newcommand{\AnswerListHeaderRef}{Answer (ex.\ \theExercise)\ ---\ } @@ -501,6 +517,7 @@ \global\@AnswerReffalse% \gdef\AnswerNB{}% \global\@AnswerNBfalse% +\setcounter{ExePart}{0}% \setcounter{Question}{0}} \def\@getAnswerInfo{% \if@AnswerRef% @@ -530,7 +547,7 @@ \global\@Answertrue\@BeginExeBox\@@@AnswerEnv} \newcommand{\@@@AnswerEnv}{% \@QuestionLevel1 - \begingroup\@getAnswerInfo\AnswerHeader\endgroup} + \begingroup\@getExerciseInfo\@getAnswerInfo\AnswerHeader\endgroup} \def\endAnswerEnv{\termineliste{1}\@EndExeBox} \newenvironment{Answer}{}{} \def\defineAnswerEnv{ @@ -556,6 +573,42 @@ } \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 + \message{PAs de label} + \if@ExerciseNoLabelSelected + \global\@ShipThisExercisetrue + \else + \global\@ShipThisExercisefalse + \fi + \else + \if@ExerciseSelected + \global\@ShipThisExercisefalse + \@for\@label:=\@ListOfExercise\do + { \ifthenelse{\equal{\@label}{#1}}{ + \message{[\@label = #1] OK !!!} + \global\@ShipThisExercisetrue + }{} + } + \if@ExerciseOmitted + \if@ShipThisExercise + \global\@ShipThisExercisefalse + \else + \global\@ShipThisExercisetrue + \fi + \fi + \fi +\fi +} \newcommand{\ExeText}{\setcounter{savedQuestion}{\value{Question}}% \termineliste{1}\@echapqtrue} \newcount\colonnesLevel \colonnesLevel=-10 @@ -567,6 +620,7 @@ \multicolsep=\subQuestionBefore\or\multicolsep=\subsubQuestionBefore\fi% \begin{multicols}{2}} \@ifundefined{if@fleqn}{\newif\if@fleqn\@fleqnfalse}{} +\newlength{\@savedmathindent} \newcommand{\@savemathindent}{\relax} \newcommand{\@decalemathindent}[1]{\relax} \newcommand{\@restoremathindent}{\relax} diff --git a/Master/texmf-dist/tpm/exercise.tpm b/Master/texmf-dist/tpm/exercise.tpm index a3654e34000..2ed1379f00a 100644 --- a/Master/texmf-dist/tpm/exercise.tpm +++ b/Master/texmf-dist/tpm/exercise.tpm @@ -3,7 +3,7 @@ <rdf:Description about="http://texlive.dante.de/texlive/Package/exercise.zip"> <TPM:Name>exercise</TPM:Name> <TPM:Type>Package</TPM:Type> - <TPM:Date>2006/01/11 23:53:04</TPM:Date> + <TPM:Date>2006/04/22 22:03:00</TPM:Date> <TPM:Version>1.0</TPM:Version> <TPM:Creator>rahtz</TPM:Creator> <TPM:Title> @@ -25,15 +25,15 @@ by now (only english and french are implemented). <TPM:Author>unknown</TPM:Author> <TPM:Size>295640</TPM:Size> <TPM:Build/> - <TPM:RunFiles size="25263"> + <TPM:RunFiles size="27315"> texmf-dist/tex/latex/exercise/exercise.sty texmf-dist/tpm/exercise.tpm </TPM:RunFiles> - <TPM:DocFiles size="215880"> + <TPM:DocFiles size="215493"> texmf-dist/doc/latex/exercise/README texmf-dist/doc/latex/exercise/exercise.pdf </TPM:DocFiles> - <TPM:SourceFiles size="54497"> + <TPM:SourceFiles size="59223"> texmf-dist/source/latex/exercise/exercise.dtx texmf-dist/source/latex/exercise/exercise.ins </TPM:SourceFiles> |