summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/exercise/README1
-rw-r--r--Master/texmf-dist/doc/latex/exercise/exercise.pdfbin437195 -> 435724 bytes
-rw-r--r--Master/texmf-dist/source/latex/exercise/exercise.dtx55
-rw-r--r--Master/texmf-dist/tex/latex/exercise/exercise.sty18
4 files changed, 71 insertions, 3 deletions
diff --git a/Master/texmf-dist/doc/latex/exercise/README b/Master/texmf-dist/doc/latex/exercise/README
index 73a8ceee334..77bb3a1af41 100644
--- a/Master/texmf-dist/doc/latex/exercise/README
+++ b/Master/texmf-dist/doc/latex/exercise/README
@@ -70,6 +70,7 @@ To do:
Change log:
-----------
+- v1.55 2011/03/13 Command \refAnswer added
- v1.54 2010/12/14 Corrected a bug with infinite loop in Answer
- v1.53 2010/11/27 Exercise selection now works correctly
- v1.52 2010/10/09 New skip added
diff --git a/Master/texmf-dist/doc/latex/exercise/exercise.pdf b/Master/texmf-dist/doc/latex/exercise/exercise.pdf
index c3e1f7c2cfc..62c2d3a380a 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 47d0e8cd5cb..1252a1225b2 100644
--- a/Master/texmf-dist/source/latex/exercise/exercise.dtx
+++ b/Master/texmf-dist/source/latex/exercise/exercise.dtx
@@ -21,7 +21,7 @@
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{exercise}
-%<package> [2010/12/14 v1.54 Exercise package (P.Pichaureau)]
+%<package> [2011/03/13 v1.55 Exercise package (P.Pichaureau)]
%<*driver>
\documentclass{ltxdoc}
\usepackage{exercise}
@@ -84,7 +84,7 @@
% \DoNotIndex{\setlength,\string,\textbf,\textsc,\emph,\whiledo,\vbox}
% \DoNotIndex{\unvbox,\usefont,\usecounter,\value,\vskip,\setbox,\setcounter}
%
-%\CheckSum{1948}
+%\CheckSum{1982}
%
%
% \GetFileInfo{exercise.sty}
@@ -381,6 +381,41 @@
%The purpose of these commands is to select exercises within a long list
%stored on an auxiliary file.
%
+%\subsection{References}
+%
+%If you want to make a cross-reference to an exercise, you must use
+%the |label| key of the |Exercise| command. Afterward, you can use the
+%usual \LaTeX commands |\ref|, |\pageref| and so on.
+%
+%The |hyperref| package should work normaly, but you must load it
+%\emph{before} the |exercise| package.
+%
+%\begin{decl}
+% |\refAnswer|\marg{label}
+%\end{decl}
+%\DescribeMacro{\refAnswer} Whenever an answer is connected to an
+%exercise \emph{via} the |ref| key, a label \emph{Exercise
+%label}|-Answer| is created. In this way, you can easily make
+%reference to a given exercise.
+%
+%The |\refAnswer| command is another way to reference the answer of a
+%given exercise : its argument is the label of an exercise without the
+%postfix |-Answer|.
+%
+%In this way
+%\begin{verbatim}
+% \ref{ex1-Answer} \refAnswer{ex1}
+%\end{verbatim}
+%are two equivalent way to reference the answer of the preceding
+%exercise labeled |ex1|.
+%
+%Remember that inside an |Exercise| the command |\ExerciseLabel|
+%stores the label of the exercise. So another way to reference the
+%answer \emph{inside} the code of an exercise is
+%\begin{verbatim}
+% \ref{\ExerciseLabel}
+%\end{verbatim}
+%
%\subsection{Extra stuff}
%\DescribeMacro{\marker}
%\DescribeMacro{\DifficultyMarker}
@@ -876,7 +911,21 @@
% Now the counters
% \begin{macrocode}
\newcounter{Exercise}
+\newcounter{Answer}
\gdef\@ExerciseCounter{Exercise} %default exercise counter
+\gdef\@AnswerCounter{Answer} %default answer counter
+\@ifpackageloaded{hyperref}{
+\def\@setAnswerref#1#2#3#4{%
+ \ifx#1\relax
+ \protect\G@refundefinedtrue
+ \nfss@text{\reset@font\bfseries ??}%
+ \PackageWarning{exercise}{Reference to Answer of `#3' on page
+ \thepage \space undefined}%
+ \else
+ \hyperref[#4]{\expandafter#2#1}\null
+ \fi}
+\def\refAnswer#1{\expandafter\@setAnswerref\csname r@#1\endcsname\@firstoffive{#1}{#1-Answer}}}
+{\let\refAnswer\ref}
\newcounter{ExePart}[Exercise]
\newcounter{Question}[Exercise]
\newcounter{subQuestion}[Question]
@@ -1428,6 +1477,8 @@
\def\@getAnswerInfo{%
\if@AnswerRef%
\def\theExercise{\ref{\AnswerRef}}%
+\refstepcounter{Answer}%
+\recordExerciseLabel{\AnswerRef-Answer}%
\else
\if@AnswerNB
\def\ExerciseTitle{}%
diff --git a/Master/texmf-dist/tex/latex/exercise/exercise.sty b/Master/texmf-dist/tex/latex/exercise/exercise.sty
index ada490082a6..1a3f6d3005f 100644
--- a/Master/texmf-dist/tex/latex/exercise/exercise.sty
+++ b/Master/texmf-dist/tex/latex/exercise/exercise.sty
@@ -27,7 +27,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{exercise}
- [2010/12/14 v1.54 Exercise package (P.Pichaureau)]
+ [2011/03/13 v1.55 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
@@ -159,7 +159,21 @@
\newlength{\subsubQuestionIndent}
\setlength{\subsubQuestionIndent}{2.5em}
\newcounter{Exercise}
+\newcounter{Answer}
\gdef\@ExerciseCounter{Exercise} %default exercise counter
+\gdef\@AnswerCounter{Answer} %default answer counter
+\@ifpackageloaded{hyperref}{
+\def\@setAnswerref#1#2#3#4{%
+ \ifx#1\relax
+ \protect\G@refundefinedtrue
+ \nfss@text{\reset@font\bfseries ??}%
+ \PackageWarning{exercise}{Reference to Answer of `#3' on page
+ \thepage \space undefined}%
+ \else
+ \hyperref[#4]{\expandafter#2#1}\null
+ \fi}
+\def\refAnswer#1{\expandafter\@setAnswerref\csname r@#1\endcsname\@firstoffive{#1}{#1-Answer}}}
+{\let\refAnswer\ref}
\newcounter{ExePart}[Exercise]
\newcounter{Question}[Exercise]
\newcounter{subQuestion}[Question]
@@ -590,6 +604,8 @@
\def\@getAnswerInfo{%
\if@AnswerRef%
\def\theExercise{\ref{\AnswerRef}}%
+\refstepcounter{Answer}%
+\recordExerciseLabel{\AnswerRef-Answer}%
\else
\if@AnswerNB
\def\ExerciseTitle{}%