From 4990be51499132d2118e1e5c8902806dfe2b26b7 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 28 Nov 2010 00:31:39 +0000 Subject: exercise 1.53 (28nov10) git-svn-id: svn://tug.org/texlive/trunk@20583 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/exercise/README | 179 ++++++------ Master/texmf-dist/doc/latex/exercise/exercise.pdf | Bin 358466 -> 429558 bytes .../texmf-dist/source/latex/exercise/exercise.dtx | 302 +++++++++------------ .../texmf-dist/source/latex/exercise/exercise.ins | 130 ++++----- Master/texmf-dist/tex/latex/exercise/exercise.sty | 119 +++++--- 5 files changed, 361 insertions(+), 369 deletions(-) diff --git a/Master/texmf-dist/doc/latex/exercise/README b/Master/texmf-dist/doc/latex/exercise/README index 519ed4a504e..7022185393c 100644 --- a/Master/texmf-dist/doc/latex/exercise/README +++ b/Master/texmf-dist/doc/latex/exercise/README @@ -1,87 +1,92 @@ -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 +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.53 2010/11/27 Exercise selection now works correctly +- v1.52 2010/10/09 New skip added + German support added (thx to Peter Zimmermann) +- v1.5 2010/10/03 Label and reference now corrects + Dutch support added (thx to Frank Koenders) +- 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 65cca450ae6..8778ebbaed5 100644 Binary files a/Master/texmf-dist/doc/latex/exercise/exercise.pdf and b/Master/texmf-dist/doc/latex/exercise/exercise.pdf differ diff --git a/Master/texmf-dist/source/latex/exercise/exercise.dtx b/Master/texmf-dist/source/latex/exercise/exercise.dtx index a4f6952fa0d..81d39587011 100644 --- a/Master/texmf-dist/source/latex/exercise/exercise.dtx +++ b/Master/texmf-dist/source/latex/exercise/exercise.dtx @@ -8,8 +8,8 @@ % 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 +% 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 @@ -18,17 +18,16 @@ % Public LaTeX Project Public % % \fi - - % \iffalse %\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)] %<*driver> \documentclass{ltxdoc} \usepackage{exercise} \usepackage[latin1]{inputenc} \usepackage{xspace,fancyvrb} +\usepackage{hyperref} %% \IfFileExists{hyperref.sty}{\usepackage[bookmarksopen]{hyperref}}{} %% \def\PrintDescribeMacro#1{} %% \def\PrintDescribeEnv#1{} @@ -85,7 +84,7 @@ % \DoNotIndex{\setlength,\string,\textbf,\textsc,\emph,\whiledo,\vbox} % \DoNotIndex{\unvbox,\usefont,\usecounter,\value,\vskip,\setbox,\setcounter} % -%\CheckSum{1826} +%\CheckSum{1933} % % % \GetFileInfo{exercise.sty} @@ -104,7 +103,7 @@ % %\date{\today} % -%\author{Paul Pichaureau\\ \texttt{paul.pichaureau@nerim.net}} +%\author{Paul Pichaureau\\ \texttt{paul.pichaureau@alcandre.net}} % %\maketitle % @@ -118,129 +117,7 @@ % later in the document. %\end{abstract} % -%\section{Simple usage} -% -%This package defines two environments. The environment |Exercise| -%is used to typeset one exercise. For example, the following -%output:\medskip\index{example} -% -%\noindent \fbox{\begin{minipage}[t]{.95\textwidth} -%\begin{Exercise}[title={Duhamel's Rule}, label={ex:one}] -% \label{exe:ex1} -% Assume that the series $\sum x_n$ satisfies -% $$ -% \frac{x_{n+1}}{x_n} = 1 - \frac{b}{n}+\frac{\varepsilon(n)}{n} -% $$ -% where $b$ is a real number and the function $\varepsilon$ satisfies -% $$ -% \lim_{n\rightarrow + \infty} \varepsilon(n) = 0. -% $$ -% -% \Question Show that if $b < 1$, then the series $\sum x_n$ is -% divergent. -% -% \Question Show that if $b > 1$, then the series $\sum x_n$ is -% convergent. -% -% \Question What happens to $\sum x_n$ if $b=1$? -% -% \end{Exercise} -% -%\end{minipage}} -% -%\medskip \noindent is obtained by the following code (the text has been cut to underscore -%the structure of the code): -%\begin{verbatim} -%\begin{Exercise}[title={Duhamel's Rule}] -% Assume... -% \Question Show that if $b < 1$... -% \Question Show that if $b > 1$... -% \Question What happens to if $b=1$? -%\end{Exercise} -%\end{verbatim} -% -%Up to three level of question are available, and a part level (between -%exercise and question) is implemented: -%\begin{verbatim} -%\begin{Exercise}[title={Example}] -% Assume... -% \ExePart -% \Question -% \subQuestion Show that... -% \subQuestion In this question... -% \subsubQuestion Show that... -% \subsubQuestion Conclude... -% \subQuestion Conclude. -% \Question Show that if $b > 1$... -% \ExePart -% \Question What happens to if $b=1$? -%\end{Exercise} -%\end{verbatim} -% -% -%The commands to typeset question, sub-question and sub-sub-question -%are |Question|, |subQuestion|, and -%|subsubQuestion|. The exercise is split in parts with the -%command |ExePart|. -% -%The environment \texttt{Exercise} can be stared (no number is -%typeset). The options of these commands are described in section -%\ref{sec:option}. The layout of exercises can be customised in many -%way: see section \ref{sec:custom}. -% -%It is common to have a long list of exercise to typeset, and the usage -%of the |Exercise| environment could be cumbersome. Another -%environment is available: the |ExerciseList| environment. -% -%\medskip -% -%\noindent \fbox{\begin{minipage}[t]{.95\textwidth} -%\begin{ExerciseList} -% \Exercise[label={ex:two}] Discuss the convergence or divergence of $ -% \left[1 + \sin \left(\frac1{an}\right)\right]^{bn}$ -% where $a$ and $b$ are two parameters. -% -% \Exercise Discuss the convergence or divergence of $ -% n^{\frac{(-1)^n}{n}} - 1$. -% -% \Exercise* Discuss the convergence or divergence of $ -% \frac{(-1)^n}{n+(-1)^n}$. -% -% \Answer[ref={ex:two}] $ \displaystyle \lim_{n\rightarrow -% +\infty} \left[1 + \sin \left(\frac1{an}\right)\right]^{bn}= {\mathrm{e}}^{\frac{b}{a}}$ -% -%\end{ExerciseList} -%\end{minipage}} -% -%\medskip -% -%\begin{verbatim} -%\begin{ExerciseList} -% \Exercise[label={ex:two}] Discuss... -% \Exercise Discuss... -% \Exercise* Discuss... -% \Answer[ref={ex:two}] $...$ -%\end{ExerciseList} -%\end{verbatim} -% -%This example show two new commands: |\Exercise*| (for an exercise -%without number) and |\Answer|. These commands are explained in detail -%later in this document. -% -%Of course, the |\Question|, |\subQuestion|, and |\subsubQuestion| -%hierarchy is also available in |ExerciseList|: -% -%\begin{verbatim} -%\begin{ExerciseList} -% \Exercise Discuss... -% \Exercise Let $u$... -% \Question ... -% \subQuestion ... -% \Question -% \Exercise What... -%\end{ExerciseList} -%\end{verbatim} -% +% \tableofcontents %\section{Options of the package} % %\index{package>options}\index{options>of the package} @@ -298,7 +175,10 @@ %\DescribeEnv{Exercise}\DescribeEnv{Exercise*} %The |Exercise| environment is used to typeset just one exercise. We %use the \textsf{keyval} package to give different informations about -%an exercise. +%an exercise. +% +%The |Exercise*| environment typeset an exercise without number, and +% without puting it in the |listofexercices|. % %\vspace*{-\baselineskip} % @@ -339,14 +219,14 @@ %As an example, with the default definitions, the following code: %\medskip %\begin{verbatim} -%\begin{Exercise}[title={Euler's constant}, difficulty=2, +%\begin{Exercise}[title={Euler's constant}, difficulty=2, label=ex1, % origin={P.Paelw}] %\end{Exercise} %\end{verbatim} %\noindent will give \par \medskip %\index{example} %\noindent \fbox{\begin{minipage}[t]{.95\textwidth} -%\begin{Exercise}[title={Euler's constant}, difficulty=2, +%\begin{Exercise}[title={Euler's constant}, difficulty=2, label=ex1, % origin={P.Paelw}] %\end{Exercise} %\end{minipage}} @@ -398,7 +278,7 @@ % |\begin{ExerciseList}| \\ % \quad |\Exercise|\oarg{key val list} \\ % \quad |\Answer|\oarg{key val list} \\ -% |\end{Exercise}| +% |\end{ExerciseList}| %\end{decl} % %\DescribeEnv{ExerciseList} @@ -469,7 +349,8 @@ % %\subsection{Exercise selection} %\begin{decl} -% |\ExerciseSelect|\marg{key val list}\\ +% |\ExerciseSelect|\oarg{key val list}\\ +% |\ExerciseSelect*|\oarg{key val list}\\ % |\ExerciseStopSelect| %\end{decl} %\DescribeMacro{\ExerciseSelect} @@ -480,14 +361,23 @@ % if the value of its keys are within the values specified after % |\ExerciseSelect|. For example, the following command %\begin{verbatim} -% \ExerciseSelect{type={short}, difficulty={0,1}} +% \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}} +% \ExerciseSelect[label={exe1, exe10, exe11}] %\end{verbatim} %selects the exercises with label |exe1|, |exe10| and |exe11|. % +%With |\ExerciseStartSelect*|, the exercises which fit the conditions +%are \emph{omited} instead of selected. +% +%Last, |\ExerciseStopSelect| stops the processus of selection: every +%exercise will be displayed later. +% +%The purpose of these commands is to select exercises within a long list +%stored on an auxiliary file. +% %\subsection{Extra stuff} %\DescribeMacro{\marker} %\DescribeMacro{\DifficultyMarker} @@ -505,7 +395,7 @@ % %\bigskip %\changes{v1.3}{2009/03/26}{Added the 'listofexercices' features.} -%\DescribeMacro{\listofexercices} +%\DescribeMacro{\listofexercises} %This command add a list of all the exercise in your document. % %\begin{decl} @@ -560,6 +450,7 @@ %You must load the \textsf{exercise} package \emph{after} %\textsf{babel} to activate this option. % +%\changes{v1.41}{2010/11/03}{Added dutch translation (provided by F.A.J. Koenders).} %\subsection{Layout} % %\subsubsection{Exercises, answers and parts} @@ -595,7 +486,7 @@ % \newcommand{\ExerciseHeaderTitle}{\quad---\quad\ExerciseTitle} %\end{verbatim} %If an exercise has a title, then this title will be displayed preceded -%by an emdash (as you can see in exercise \ref{exe:ex1} of this +%by an emdash (as you can see in exercise \ref{ex1} of this %document). If an exercise doesn't have a title, then this command is %set to nothing (precisely to |{}|) during the exercise. % @@ -695,6 +586,19 @@ % %\subsection{Lengths} % +%\changes{v1.52}{201/11/09}{Added the 'ExerciseSkipBefore' +%and 'ExerciseListAfter' skip.} +%\begin{decl} +% \begin{tabular}{l} +% |\ExerciseSkipBefore| \\ +% |\ExerciseSkipAfter| \\ +%\end{tabular} +%\end{decl} +%\DescribeMacro{ExerciseSkipBefore} +%\DescribeMacro{ExerciseSkipAfter} +%Before every |Exercise| environment the vertical skip +%|ExerciseSkipBefore| is added. The corresponding |ExerciseSkipAfter| +%vertical skip is added after every |Exercise| environment. %\begin{decl} % \begin{tabular}{llll} % |\Exesep| & |\Exetopsep| & |\Exeparsep| & @@ -710,7 +614,8 @@ %\DescribeMacro{Exeleftmargin} %\DescribeMacro{Exerightmargin} %\DescribeMacro{Exelabelsep} -%The |ExerciseList| environment is nothing more than a |list| +%These lengths have an effect only inside an |ExerciseList| environment. +%This environment is nothing more than a |list| %environment. All the parameters of \LaTeX's lists are %available. Please consult your favourite source of information to have %the exact definitions of these lengths. @@ -898,11 +803,42 @@ \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\ }% +} }{} % \end{macrocode} %\subsubsection{Layout} % First a bunch of length definitions. % \begin{macrocode} +\newlength{\ExerciseSkipBefore} +\setlength{\ExerciseSkipBefore}{1\baselineskip} +\newlength{\ExerciseSkipAfter} +\setlength{\ExerciseSkipAfter}{0\baselineskip} \newlength{\Exesep} \setlength{\Exesep}{1\baselineskip} \newlength{\Exetopsep} @@ -945,7 +881,7 @@ % \end{macrocode} % Presentation of these labels in cross references % \begin{macrocode} -\renewcommand{\theExercise}{\arabic{\@ExerciseCounter}} +\renewcommand{\theExercise}{\if@ExeStared\else\arabic{\@ExerciseCounter}\fi} \renewcommand{\theExePart}{\Roman{ExePart}} \renewcommand{\theQuestion}{\arabic{Question}} \renewcommand{\thesubQuestion}{\alph{subQuestion}} @@ -968,7 +904,7 @@ % \end{macrocode} % Presentation of informations in the header of exercises % \begin{macrocode} -\newcommand{\ExerciseHeaderTitle}{\qquad \ExerciseTitle} +\newcommand{\ExerciseHeaderTitle}{\qquad\ExerciseTitle} \newcommand{\ExerciseHeaderConcours}{\ExerciseConcours} \newcommand{\ExerciseHeaderAnnee}{\ \ExerciseAnnee} \newcommand{\ExerciseHeaderDifficulty}{\theExerciseDifficulty\ } @@ -1086,14 +1022,7 @@ {\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{}% @@ -1125,29 +1054,25 @@ \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} @@ -1166,20 +1091,22 @@ \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} % \end{macrocode} % The commands for exercise within environment % \begin{macrocode} @@ -1200,10 +1127,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 } % @@ -1499,16 +1428,16 @@ % \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 @@ -1527,11 +1456,11 @@ \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}} % @@ -1558,7 +1487,7 @@ \else \termineliste{1}\@EndExeBox \fi - \global\@Answertrue\@BeginExeBox% + \global\@Answertrue\@selectAnswer\@BeginExeBox% \item[\bgroup\@getAnswerInfo\AnswerListHeader\egroup]\ignorespaces } % @@ -1575,11 +1504,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 @@ -1673,6 +1604,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 +} % \end{macrocode} % \subsubsection{Some extra stuff} % \begin{macrocode} 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 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 -- cgit v1.2.3