diff options
author | Karl Berry <karl@freefriends.org> | 2010-11-28 00:31:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-11-28 00:31:39 +0000 |
commit | 4990be51499132d2118e1e5c8902806dfe2b26b7 (patch) | |
tree | 93c37e2b60dce8e288de4efa44218580fc37c205 /Master/texmf-dist/tex/latex/exercise | |
parent | a71d255dc4a69bebb54dea17ce8e53b28f78fa8e (diff) |
exercise 1.53 (28nov10)
git-svn-id: svn://tug.org/texlive/trunk@20583 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/exercise')
-rw-r--r-- | Master/texmf-dist/tex/latex/exercise/exercise.sty | 119 |
1 files changed, 80 insertions, 39 deletions
diff --git a/Master/texmf-dist/tex/latex/exercise/exercise.sty b/Master/texmf-dist/tex/latex/exercise/exercise.sty index ed75b0b156d..09b0402030b 100644 --- a/Master/texmf-dist/tex/latex/exercise/exercise.sty +++ b/Master/texmf-dist/tex/latex/exercise/exercise.sty @@ -25,10 +25,9 @@ %% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. %% Public LaTeX Project Public %% - \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{exercise} - [2010/08/27 v1.4 Exercise package (P.Pichaureau)] + [2010/11/27 v1.53 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 @@ -97,7 +96,38 @@ \def\AnswerListName{Soluzione}% \def\ExePartName{Parte}% } +\addto\captionsdutch{% + \def\listexercisename{Lijst van opdrachten} + \def\ExerciseName{Opdracht} + \def\AnswerName{Oplossing van opdracht} + \def\ExerciseListName{Opg.} + \def\AnswerListName{Oplossing} + \def\ExePartName{Deel} + \def\ArticleOf{van\ } +} +\addto\captionsgerman{% + \def\listexercisename{Liste der {\"U}bungen}% + \def\ExerciseName{{\"U}bung}% + \def\AnswerName{L{\"o}sung zu den {\"U}bung}% + \def\ExerciseListName{{\"U}b.}% + \def\AnswerListName{L{\"o}sung}% + \def\ExePartName{Teil}% + \def\ArticleOf{von\ }% +} +\addto\captionsngerman{% + \def\listexercisename{Liste der {\"U}bungen}% + \def\ExerciseName{{\"U}bung}% + \def\AnswerName{L{\"o}sung zu den {\"U}bung}% + \def\ExerciseListName{{\"U}b.}% + \def\AnswerListName{L{\"o}sung}% + \def\ExePartName{Teil}% + \def\ArticleOf{von\ }% +} }{} +\newlength{\ExerciseSkipBefore} +\setlength{\ExerciseSkipBefore}{1\baselineskip} +\newlength{\ExerciseSkipAfter} +\setlength{\ExerciseSkipAfter}{0\baselineskip} \newlength{\Exesep} \setlength{\Exesep}{1\baselineskip} \newlength{\Exetopsep} @@ -134,7 +164,7 @@ \newcounter{Question}[Exercise] \newcounter{subQuestion}[Question] \newcounter{subsubQuestion}[subQuestion] -\renewcommand{\theExercise}{\arabic{\@ExerciseCounter}} +\renewcommand{\theExercise}{\if@ExeStared\else\arabic{\@ExerciseCounter}\fi} \renewcommand{\theExePart}{\Roman{ExePart}} \renewcommand{\theQuestion}{\arabic{Question}} \renewcommand{\thesubQuestion}{\alph{subQuestion}} @@ -145,7 +175,7 @@ \def\marker#1#2{\@tempcnta#2\whiledo{\@tempcnta>0}{#1\advance \@tempcnta by -1 }} \def\DifficultyMarker{*} -\newcommand{\ExerciseHeaderTitle}{\qquad \ExerciseTitle} +\newcommand{\ExerciseHeaderTitle}{\qquad\ExerciseTitle} \newcommand{\ExerciseHeaderConcours}{\ExerciseConcours} \newcommand{\ExerciseHeaderAnnee}{\ \ExerciseAnnee} \newcommand{\ExerciseHeaderDifficulty}{\theExerciseDifficulty\ } @@ -236,13 +266,7 @@ \define@key{PPExercise}{class}% {\gdef\ExerciseClass{#1}} \newif\if@ExeStared -\newif\if@staredpb -\newif\if@staredpart -\newif\if@renamepart \@ExeStaredfalse -\@staredpbfalse -\@staredpartfalse -\@renamepartfalse \def\@InitExe{\@savemathindent\global\@echapqfalse% \gdef\ExerciseTitle{}% \gdef\ExerciseConcours{}% @@ -272,25 +296,21 @@ \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@ExeNB\setcounter{Exercise}{\ExerciseLocalNB} +\protected@edef\@currentlabel{\p@Exercise\theExercise}% +\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\recordExerciseLabel{\ExerciseLabel}\else\def\ExerciseHeaderLabel{}\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}}}% - \@esphack} +\def\recordExerciseLabel#1{\label{#1}} \def\@BeginExeBox{\global\setbox\@Exercisebox\vbox\bgroup} \def\@EndExeBox{\egroup\if@Answer\if@AnswerOutput\@DelayAnswerBox\fi% \else\if@ExerciseOutput\@DelayExerciseBox\fi\fi} \def\@DelayAnswerBox{% -\if@ShipThisExercise\if@AnswerDelay\global\setbox\temp@Answerbox% +\if@ShipThisAnswer\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\fi} @@ -303,17 +323,19 @@ \newcommand{\shipoutExercise}{\if@ExerciseOutput\unvbox\all@Exercisebox\fi} \def\beginExerciseEnv{\@InitExe\@ifnextchar[\@@ExeEnv{\@@ExeEnv[]}}%] \def\@@ExeEnv[#1]{\setkeys{PPExercise}{#1}% -\global\@Answerfalse\@BeginExeBox\@@@ExeEnv} +\@selectExercise\global\@Answerfalse\@BeginExeBox\@@@ExeEnv} \newcommand{\@@@ExeEnv}{% - \@selectExercise%{\ExerciseTrueLabel} + \vskip\ExerciseSkipBefore \@QuestionLevel1 \refstepExecounter \begingroup\@getExerciseInfo\ExerciseHeader + \if@ExeStared\else% \addcontentsline{\ext@exercise}{\toc@exercise}{\ExerciseName\ - \theExercise\ \expandafter{\itshape - \ExerciseTitle}\hspace{.66em}} + \theExercise\ \expandafter{\itshape \ExerciseTitle}\hspace{.66em}} + \fi% \endgroup} -\def\endExerciseEnv{\termineliste{1}\@EndExeBox} +\def\endExerciseEnv{\termineliste{1}\@EndExeBox% +\vskip\ExerciseSkipAfter} \def\ExerciseCmd{\@InitExe\@ifstar{\global\@ExeStaredtrue\@ExeCmd}% {\global\@ExeStaredfalse\@ExeCmd}} \def\@ExeCmd{\@ifnextchar[\@@ExeCmd{\@@ExeCmd[]}}%] for emacs @@ -328,10 +350,12 @@ \else \termineliste{1}\@EndExeBox \fi - \@selectExercise %{\ExerciseTrueLabel} + \@selectExercise \global\@Answerfalse\@BeginExeBox\refstepExecounter% + \if@ExeStared\else% \addcontentsline{\ext@exercise}{\toc@exercise}{\ExerciseName\ \theExercise\ \expandafter{\itshape \ExerciseTitle}\hspace{.66em}} + \fi% \item\ignorespaces } \def\defineExePartInEnv{\def\@ExePartHeader{\ExePartHeader}} @@ -569,16 +593,16 @@ \setcounter{Question}{0}} \def\@getAnswerInfo{% \if@AnswerRef% -%% \def\AnswerHeader{\ref{PP\AnswerRef}}% -%% \def\AnswerListHeader{\ref{PP\AnswerRef}}% +\def\theExercise{\ref{\AnswerRef}}% +\def\AnswerListHeader{\@AnswerHeaderRef} \else \if@AnswerNB -\def\ExerciseTitle{} -\def\ExerciseName{} -\def\ExerciseOrigin{} -\def\ExerciseType{} -\ExerciseDifficulty=0 -\def\theExercise{\AnswerNB} +\def\ExerciseTitle{}% +\def\ExerciseName{}% +\def\ExerciseOrigin{}% +\def\ExerciseType{}% +\ExerciseDifficulty=0% +\def\theExercise{\AnswerNB}% \else \if@AswLastExe \else @@ -593,10 +617,10 @@ \define@key{PPAnswer}{number}{\global\@AnswerNBtrue\gdef\AnswerNB{\string#1}} \def\beginAnswerEnv{\@InitAnswer\@ifnextchar[\@@AnswerEnv{\@@AnswerEnv[]}}%] \def\@@AnswerEnv[#1]{\setkeys{PPAnswer}{#1}% -\global\@Answertrue\@BeginExeBox\@@@AnswerEnv} +\global\@Answertrue\@selectAnswer\@BeginExeBox\@@@AnswerEnv} \newcommand{\@@@AnswerEnv}{% \@QuestionLevel1 - \begingroup\@getExerciseInfo\@getAnswerInfo\AnswerHeader\endgroup} + \begingroup\@getAnswerInfo\AnswerHeader\endgroup} \def\endAnswerEnv{\termineliste{1}\@EndExeBox\termineliste{0}} \newenvironment{Answer}{}{} \def\defineAnswerEnv{ @@ -617,7 +641,7 @@ \else \termineliste{1}\@EndExeBox \fi - \global\@Answertrue\@BeginExeBox% + \global\@Answertrue\@selectAnswer\@BeginExeBox% \item[\bgroup\@getAnswerInfo\AnswerListHeader\egroup]\ignorespaces } \def\defineAnswerCmd{\gdef\@AnswerHeaderRef{\AnswerListHeader}% @@ -626,11 +650,13 @@ \newif\if@ShipThisExercise \@ShipThisExercisetrue \newif\if@@ShipThisExercise \@@ShipThisExercisetrue \newif\if@ExerciseSelected \@ExerciseSelectedtrue +\newif\if@ShipThisAnswer \@ShipThisAnswertrue +\newif\if@@ShipThisAnswer \@@ShipThisAnswertrue \newif\if@ExeSelectConcours \@ExeSelectConcoursfalse \newif\if@ExeSelectAnnee \@ExeSelectAnneefalse -%% \newif\if@ExeSelectDifficulty \@ExeSelectDifficultyfalse +%% \newif\if@ExeSelectDifficulty \@ExeSelectDifficultyfalse \newif\if@ExeSelectOrigin \@ExeSelectOriginfalse -\newif\if@ExeSelectClass \@ExeSelectClassfalse +\newif\if@ExeSelectClass \@ExeSelectClassfalse \newif\if@ExeSelectType \@ExeSelectTypefalse \newif\if@ExeSelectLabel \@ExeSelectLabelfalse @@ -724,6 +750,21 @@ \fi \if@ExerciseSelected\else\if@ShipThisExercise\global\@ShipThisExercisefalse\else\global\@ShipThisExercisetrue\fi\fi } +\def\@selectAnswer{% + \global\@ShipThisAnswertrue + \global\@@ShipThisAnswerfalse + % + \if@ExeSelectLabel + \@for\@label:=\ExerciseSelectLabel\do + { \ifthenelse{\equal{\@label}{\AnswerRef}}{ + \global\@@ShipThisAnswertrue + }{} + } + \if@@ShipThisAnswer\else\@ShipThisAnswerfalse\fi + \global\@@ShipThisAnswerfalse + \fi + \if@ExerciseSelected\else\if@ShipThisAnswer\global\@ShipThisAnswerfalse\else\global\@ShipThisAnswertrue\fi\fi +} \newcommand{\ExeText}{\setcounter{savedQuestion}{\value{Question}}% \termineliste{1}\@echapqtrue} \newcount\colonnesLevel \colonnesLevel=-10 |