diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/exercise/README | 18 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/exercise/exercise.pdf | bin | 440120 -> 321470 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/exercise/exercise.dtx | 111 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exercise/exercise.sty | 43 |
4 files changed, 123 insertions, 49 deletions
diff --git a/Master/texmf-dist/doc/latex/exercise/README b/Master/texmf-dist/doc/latex/exercise/README index a17636a17e7..8bd6efcd13d 100644 --- a/Master/texmf-dist/doc/latex/exercise/README +++ b/Master/texmf-dist/doc/latex/exercise/README @@ -70,9 +70,21 @@ To do: Change log: ----------- -- v1.58 2012-05-08 Minor modification to avoid pagebreak after exercise and answer heading (thx to Mathias Magdowski) -- v1.57 2011/07/19 Bug correction on exercise selection (thx to Tobias Isenberg) -- v1.56 2011/05/10 Portuguese translation added (thx to José Romildo Malaquias) +- v1.6 2014-10-20 Added \AtBeginExercise and \AddBeginAnswer + (following a suggestion of Daniel Turner) + Portuguese translation fixed. + Russian translation added + (thx to Andreï V. Kostyrka) + Added \AnswerSkipBefore and \AnswerSkipAfter + (thx to Alexander Malkis) + Bugs corrected. +- v1.58 2012-05-08 Minor modification to avoid pagebreak after + exercise and answer heading + (thx to Mathias Magdowski) +- v1.57 2011/07/19 Bug correction on exercise selection + (thx to Tobias Isenberg) +- v1.56 2011/05/10 Portuguese translation added + (thx to José Romildo Malaquias) - v1.55 2011/03/13 Command \refAnswer added (thx to Ferenc Wettl) - v1.54 2010/12/14 Corrected a bug with infinite loop in Answer - v1.53 2010/11/27 Exercise selection now works correctly diff --git a/Master/texmf-dist/doc/latex/exercise/exercise.pdf b/Master/texmf-dist/doc/latex/exercise/exercise.pdf Binary files differindex 18bc8c78954..b3792cdaa64 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 036c2440f3f..9ffb04cf2e0 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> [2012/05/08 v1.58 Exercise package (P.Pichaureau)] +%<package> [2014/10/20 v1.6 Exercise package (P.Pichaureau)] %<*driver> \documentclass{ltxdoc} \usepackage{exercise} @@ -142,7 +142,9 @@ % % \item[|answerdelayed|] save the answers instead of typeset % them. The answers can be included later in the document with the -% command |\shipoutAnswer|. More precisely, the answers are stored +% command |\shipoutAnswer|. +% +% More precisely, the answers are stored % in a vertical box. When |\shipoutAnswer| is encountered, this box % is emptied and its contents is placed in the main vertical % list. The answers defined later are placed in this emptied @@ -192,6 +194,8 @@ %|name|=\marg{string}\\ %|counter|=\marg{counter}\\ %|number|=\marg{string} +%|exam|=\marg{string} +%|year|=\marg{string} %\end{decl} %All these keys define commands that will be available later to typeset %the exercise. They are all optional. @@ -208,7 +212,8 @@ % It will be available later with the command |\ExerciseOrigin|. % \item[|name|] In document, exercises can have multiple % denomination, like problem, exam, or even question. This key -% allows to change the denomination. +% allows to change the denomination. This denomination is accessible +% with the command |\ExerciseName|. % \item[|counter|] Use the given counter to number this % exercise. Here, \marg{counter} must be a pre-defined counter. % \item[|number|] Use the given number for the exercise. In @@ -219,6 +224,8 @@ % exercise. %\end{description} % +%\bigskip[1] +% %As an example, with the default definitions, the following code: %\medskip %\begin{verbatim} @@ -251,7 +258,7 @@ % %\DescribeEnv{Answer} %The |Answer| environment is used to typeset the answer of an -%exercise. To determine which the exercise this answer is attributed +%exercise. To determine to which exercise this answer is attributed %to, you can use the two following keys. % %\vspace*{-\baselineskip} @@ -261,7 +268,6 @@ %|ref|=\marg{string}\\ %|number|=\marg{string} %\end{decl} -%This is the description of these keys: %\begin{description} % \item[|ref|] a \LaTeX\ reference. \emph{Must} correspond to the |label| % key of an exercise. @@ -368,9 +374,10 @@ %\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|. +%selects the exercises with label |exe1|, |exe10| and |exe11|. It is important +%to \emph{not} have spaces before or after the commas. % %With |\ExerciseStartSelect*|, the exercises which fit the conditions %are \emph{omited} instead of selected. @@ -407,11 +414,11 @@ % \ref{ex1-Answer} \refAnswer{ex1} %\end{verbatim} %are two equivalent ways to reference the answer of the preceding -%exercise labeled |ex1|. +%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 +%exercise \emph{inside} is own code is %\begin{verbatim} % \ref{\ExerciseLabel} %\end{verbatim} @@ -477,9 +484,10 @@ % %\textsf{Exercise.sty} automatically detects the usage of % \textsf{babel} and translate these terms in the language loaded... -% if I (the author) know the translation! As my skills in foreign -% language are quite weak, only English and French are currently -% supported. +% if I (the author) know the translation! +% +% By now, and thanks to many contributors, english, french, spanish, +% italian, dutch, german, portugese and russian are supported. % %If you sent me the translations in your language, I will be happy to %add them in the package. Anyway, you can redefine these @@ -488,7 +496,6 @@ %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} @@ -591,6 +598,19 @@ %These pieces are collected in the command |\ExePartHeader| or %\\ |\ExePartListHeader|. % +%\DescribeMacro{\AtBeginExercise} +%\DescribeMacro{\AtBeginAnswer} +%Finally, you can use the commands |\AtBeginExercise| +%and |\AtBeginAnswer|. They are executed respectively at the beginning +%of each exercise/each answer. +% +%For example, if you want all the answer typeset in italic shape, use +% \begin{verbatim} +%\newcommand{\AtBeginAnswer}{\itshape} +% \end{verbatim} +% +%\changes{v1.6}{2014/10/20}{Added new commands |\AtBeginExercise| +%and |\AtBeginAnswer|.} % % %\subsubsection{Questions, sub-questions and sub-sub-questions} @@ -624,19 +644,27 @@ % %\subsection{Lengths} % -%\changes{v1.52}{201/11/09}{Added the 'ExerciseSkipBefore' -%and 'ExerciseListAfter' skip.} +%\changes{v1.52}{2011/11/09}{Added the 'ExerciseSkipBefore' +%and 'ExerciseSkipAfter' skip.} +%\changes{v1.6}{2014/10/20}{Added the 'AnswerSkipBefore' +%and 'AnswerSkipAfter' skip.} %\begin{decl} % \begin{tabular}{l} % |\ExerciseSkipBefore| \\ % |\ExerciseSkipAfter| \\ +% |\AnswerSkipBefore| \\ +% |\AnswerSkipAfter| %\end{tabular} %\end{decl} %\DescribeMacro{ExerciseSkipBefore} %\DescribeMacro{ExerciseSkipAfter} +%\DescribeMacro{AnswerSkipBefore} +%\DescribeMacro{AnswerSkipAfter} %Before every |Exercise| environment the vertical skip %|ExerciseSkipBefore| is added. The corresponding |ExerciseSkipAfter| -%vertical skip is added after every |Exercise| environment. +%vertical skip is added after every |Exercise| environment. +%|AnswerSkipBefore| and |AnswerSkipAfter| are the amount of vertical +%spaces inserted before an after each answer. %\begin{decl} % \begin{tabular}{llll} % |\Exesep| & |\Exetopsep| & |\Exeparsep| & @@ -734,8 +762,8 @@ %\end{verbatim} % %\begin{decl} -% |\EndCurrentQuestion|\\ -% |\EndCurrentsubQuestion|\\ +% |\EndCurrentQuestion|\\ +% |\EndCurrentsubQuestion|\\ % |\EndCurrentsubsubQuestion| %\end{decl} %\DescribeMacro{\EndCurrentQuestion} @@ -868,15 +896,24 @@ \def\ExePartName{Teil}% \def\ArticleOf{von\ }% } -\addto\captionsportuges{% +\addto\captionsportugese{% \def\listexercisename{Lista de exerc\'icios}% \def\ExerciseName{Exerc\'icio}% -\def\AnswerName{Soluo do exerc\'icio}% +\def\AnswerName{Solução do exerc\'icio}% \def\ExerciseListName{Ex.}% \def\AnswerListName{Solu\c{c}\~ao}% \def\ExePartName{Parte}% \def\ArticleOf{de\ }% } +\addto{\captionsrussian}{ + \def\listexercisename{Список упражнений}% + \def\ExerciseName{Упражнение}% + \def\AnswerName{Ответ к упражнению}% + \def\ExerciseListName{Упр.}% + \def\AnswerListName{Ответ}% + \def\ExePartName{Часть}% + \def\ArticleOf{из\ }% +} }{} % \end{macrocode} %\subsubsection{Layout} @@ -886,6 +923,10 @@ \setlength{\ExerciseSkipBefore}{1\baselineskip} \newlength{\ExerciseSkipAfter} \setlength{\ExerciseSkipAfter}{0\baselineskip} +\newlength{\AnswerSkipBefore} +\setlength{\AnswerSkipBefore}{0\baselineskip} +\newlength{\AnswerSkipAfter} +\setlength{\AnswerSkipAfter}{0\baselineskip} \newlength{\Exesep} \setlength{\Exesep}{1\baselineskip} \newlength{\Exetopsep} @@ -963,6 +1004,12 @@ % \begin{macrocode} \def\DifficultyMarker{*} % \end{macrocode} +% Commands executed respectively at the begin of an exercise and at the +% beginning of an Answer (in both case, \emph{after} the header). +% \begin{macrocode} +\newcommand{\AtBeginExercise}{} +\newcommand{\AtBeginAnswer}{} +% \end{macrocode} % Presentation of informations in the header of exercises % \begin{macrocode} \newcommand{\ExerciseHeaderTitle}{\qquad\ExerciseTitle} @@ -1161,7 +1208,7 @@ \begingroup\@getExerciseInfo\ExerciseHeader \addcontentsline{\ext@exercise}{\toc@exercise}{\ExerciseName\ \theExercise\ \expandafter{\itshape \ExerciseTitle}\hspace{.66em}} - \endgroup} + \endgroup\AtBeginExercise} % % \def\endExerciseEnv{\termineliste{1}\@EndExeBox% @@ -1190,17 +1237,17 @@ \global\@Answerfalse\@BeginExeBox\refstepExecounter% \addcontentsline{\ext@exercise}{\toc@exercise}{\ExerciseName\ \theExercise\ \expandafter{\itshape \ExerciseTitle}\hspace{.66em}} - \item\ignorespaces + \item\ignorespaces\AtBeginExercise } % \def\defineExePartInEnv{\def\@ExePartHeader{\ExePartHeader}} \def\defineExePartInList{\def\@ExePartHeader{\ExePartListHeader}} \def\defineExerciseEnv{% \defineExePartInEnv - \renewenvironment{Exercise}{\global\beginExerciseEnv}% -{\@ExeStaredfalse\endExerciseEnv} + \renewenvironment{Exercise}{\global\@ExeStaredfalse\global\beginExerciseEnv}% +{\endExerciseEnv} \renewenvironment{Exercise*}{\global\@ExeStaredtrue\beginExerciseEnv}% -{\@ExeStaredfalse\endExerciseEnv} +{\endExerciseEnv} } \newenvironment{Exercise}{}{} \newenvironment{Exercise*}{}{} @@ -1517,13 +1564,13 @@ \global\@Answertrue\@selectAnswer\@BeginExeBox\@@@AnswerEnv} % \newcommand{\@@@AnswerEnv}{% - \@QuestionLevel1 - \pagebreak[1]\begingroup\@getAnswerInfo\AnswerHeader\endgroup} + \pagebreak[1]\vskip\AnswerSkipBefore\@QuestionLevel1 + \begingroup\@getAnswerInfo\AnswerHeader\endgroup\AtBeginAnswer} % -\def\endAnswerEnv{\termineliste{1}\@EndExeBox\termineliste{0}} +\gdef\endAnswerEnv{\termineliste{1}\@EndExeBox\termineliste{0}\vskip\AnswerSkipAfter} % \newenvironment{Answer}{}{} -\def\defineAnswerEnv{ +\gdef\defineAnswerEnv{ \gdef\@AnswerHeaderRef{\AnswerHeader} \renewenvironment{Answer}{\beginAnswerEnv}{\endAnswerEnv}} % @@ -1546,11 +1593,11 @@ \termineliste{1}\@EndExeBox \fi \global\@Answertrue\@selectAnswer\@BeginExeBox% - \item[\bgroup\@getAnswerInfo\AnswerListHeader\egroup]\ignorespaces + \item[\bgroup\@getAnswerInfo\AnswerListHeader\egroup]\AtBeginAnswer\ignorespaces } % \def\defineAnswerCmd{\gdef\@AnswerHeaderRef{\AnswerListHeader}% -\gdef\Answer{\AnswerCmd}} +\def\Answer{\AnswerCmd}} % \end{macrocode} % \subsubsection{Exercises selection} % @@ -1699,7 +1746,7 @@ % \subsubsection{Secret stuff} % \begin{macrocode} % -% Il est possible de prsenter un niveau de sectionnement sur +% Il est possible de présenter un niveau de sectionnement sur % deux colonnes avec la commande \colonnesLevel % \newcount\colonnesLevel \colonnesLevel=-10 diff --git a/Master/texmf-dist/tex/latex/exercise/exercise.sty b/Master/texmf-dist/tex/latex/exercise/exercise.sty index f09436ca270..7598ca26def 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} - [2012/05/08 v1.58 Exercise package (P.Pichaureau)] + [2014/10/20 v1.6 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 @@ -123,20 +123,33 @@ \def\ExePartName{Teil}% \def\ArticleOf{von\ }% } -\addto\captionsportuges{% +\addto\captionsportugese{% \def\listexercisename{Lista de exerc\'icios}% \def\ExerciseName{Exerc\'icio}% -\def\AnswerName{Soluo do exerc\'icio}% +\def\AnswerName{Solução do exerc\'icio}% \def\ExerciseListName{Ex.}% \def\AnswerListName{Solu\c{c}\~ao}% \def\ExePartName{Parte}% \def\ArticleOf{de\ }% } +\addto{\captionsrussian}{ + \def\listexercisename{Список упражнений}% + \def\ExerciseName{Упражнение}% + \def\AnswerName{Ответ к упражнению}% + \def\ExerciseListName{Упр.}% + \def\AnswerListName{Ответ}% + \def\ExePartName{Часть}% + \def\ArticleOf{из\ }% +} }{} \newlength{\ExerciseSkipBefore} \setlength{\ExerciseSkipBefore}{1\baselineskip} \newlength{\ExerciseSkipAfter} \setlength{\ExerciseSkipAfter}{0\baselineskip} +\newlength{\AnswerSkipBefore} +\setlength{\AnswerSkipBefore}{0\baselineskip} +\newlength{\AnswerSkipAfter} +\setlength{\AnswerSkipAfter}{0\baselineskip} \newlength{\Exesep} \setlength{\Exesep}{1\baselineskip} \newlength{\Exetopsep} @@ -198,6 +211,8 @@ \def\marker#1#2{\@tempcnta#2\whiledo{\@tempcnta>0}{#1\advance \@tempcnta by -1 }} \def\DifficultyMarker{*} +\newcommand{\AtBeginExercise}{} +\newcommand{\AtBeginAnswer}{} \newcommand{\ExerciseHeaderTitle}{\qquad\ExerciseTitle} \newcommand{\ExerciseHeaderExam}{\ExerciseExam} \newcommand{\ExerciseHeaderYear}{\ \ExerciseYear} @@ -354,7 +369,7 @@ \begingroup\@getExerciseInfo\ExerciseHeader \addcontentsline{\ext@exercise}{\toc@exercise}{\ExerciseName\ \theExercise\ \expandafter{\itshape \ExerciseTitle}\hspace{.66em}} - \endgroup} + \endgroup\AtBeginExercise} \def\endExerciseEnv{\termineliste{1}\@EndExeBox% \vskip\ExerciseSkipAfter} \def\ExerciseCmd{\@InitExe\@ifstar{\global\@ExeStaredtrue\@ExeCmd}% @@ -375,16 +390,16 @@ \global\@Answerfalse\@BeginExeBox\refstepExecounter% \addcontentsline{\ext@exercise}{\toc@exercise}{\ExerciseName\ \theExercise\ \expandafter{\itshape \ExerciseTitle}\hspace{.66em}} - \item\ignorespaces + \item\ignorespaces\AtBeginExercise } \def\defineExePartInEnv{\def\@ExePartHeader{\ExePartHeader}} \def\defineExePartInList{\def\@ExePartHeader{\ExePartListHeader}} \def\defineExerciseEnv{% \defineExePartInEnv - \renewenvironment{Exercise}{\global\beginExerciseEnv}% -{\@ExeStaredfalse\endExerciseEnv} + \renewenvironment{Exercise}{\global\@ExeStaredfalse\global\beginExerciseEnv}% +{\endExerciseEnv} \renewenvironment{Exercise*}{\global\@ExeStaredtrue\beginExerciseEnv}% -{\@ExeStaredfalse\endExerciseEnv} +{\endExerciseEnv} } \newenvironment{Exercise}{}{} \newenvironment{Exercise*}{}{} @@ -639,11 +654,11 @@ \def\@@AnswerEnv[#1]{\setkeys{PPAnswer}{#1}% \global\@Answertrue\@selectAnswer\@BeginExeBox\@@@AnswerEnv} \newcommand{\@@@AnswerEnv}{% - \@QuestionLevel1 - \pagebreak[1]\begingroup\@getAnswerInfo\AnswerHeader\endgroup} -\def\endAnswerEnv{\termineliste{1}\@EndExeBox\termineliste{0}} + \pagebreak[1]\vskip\AnswerSkipBefore\@QuestionLevel1 + \begingroup\@getAnswerInfo\AnswerHeader\endgroup\AtBeginAnswer} +\gdef\endAnswerEnv{\termineliste{1}\@EndExeBox\termineliste{0}\vskip\AnswerSkipAfter} \newenvironment{Answer}{}{} -\def\defineAnswerEnv{ +\gdef\defineAnswerEnv{ \gdef\@AnswerHeaderRef{\AnswerHeader} \renewenvironment{Answer}{\beginAnswerEnv}{\endAnswerEnv}} \defineAnswerEnv @@ -662,10 +677,10 @@ \termineliste{1}\@EndExeBox \fi \global\@Answertrue\@selectAnswer\@BeginExeBox% - \item[\bgroup\@getAnswerInfo\AnswerListHeader\egroup]\ignorespaces + \item[\bgroup\@getAnswerInfo\AnswerListHeader\egroup]\AtBeginAnswer\ignorespaces } \def\defineAnswerCmd{\gdef\@AnswerHeaderRef{\AnswerListHeader}% -\gdef\Answer{\AnswerCmd}} +\def\Answer{\AnswerCmd}} \newif\if@ShipThisExercise \@ShipThisExercisetrue \newif\if@@ShipThisExercise \@@ShipThisExercisetrue |