texlive[65577] Master/texmf-dist: exesheet (18jan23)

commits+karl at tug.org commits+karl at tug.org
Wed Jan 18 21:39:24 CET 2023


Revision: 65577
          http://tug.org/svn/texlive?view=revision&revision=65577
Author:   karl
Date:     2023-01-18 21:39:24 +0100 (Wed, 18 Jan 2023)
Log Message:
-----------
exesheet (18jan23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/exesheet/README.md
    trunk/Master/texmf-dist/doc/latex/exesheet/exesheet.pdf
    trunk/Master/texmf-dist/source/latex/exesheet/exesheet.dtx
    trunk/Master/texmf-dist/tex/latex/exesheet/exesheet.cls
    trunk/Master/texmf-dist/tex/latex/exesheet/exesheet.sty

Modified: trunk/Master/texmf-dist/doc/latex/exesheet/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/exesheet/README.md	2023-01-18 00:48:52 UTC (rev 65576)
+++ trunk/Master/texmf-dist/doc/latex/exesheet/README.md	2023-01-18 20:39:24 UTC (rev 65577)
@@ -10,7 +10,7 @@
 - macros to mark out exercises and subparts,
 - specific settings for enumeration lists, 
 - environments for questions and answers, with conditional display,
-- macros for marking scheme with detailed comments.
+- macros for displaying a marking scheme with detailed comments in margins.
 
 
 ## Installation

Modified: trunk/Master/texmf-dist/doc/latex/exesheet/exesheet.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/exesheet/exesheet.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/exesheet/exesheet.dtx	2023-01-18 00:48:52 UTC (rev 65576)
+++ trunk/Master/texmf-dist/source/latex/exesheet/exesheet.dtx	2023-01-18 20:39:24 UTC (rev 65577)
@@ -23,17 +23,17 @@
 %<class>\ProvidesClass{exesheet}
 %<package>\ProvidesPackage{exesheet}
 %<*class|package>
-[2021/11/15 v1.3 .dtx exesheet file]
+[2023/01/16 v2.0 .dtx exesheet file]
 %</class|package>
-%
 %<*driver>
 \documentclass{ltxdoc}
+%
 % uncomment the following lines if you want to use the exesheet class instead of ltxdoc
 %\usepackage{doc}
 %\AtBeginDocument{\MakeShortVerb{\|}}
 %\providecommand\marg[1]{{\ttfamily\{}\meta{#1}{\ttfamily\}}}
 %\providecommand\oarg[1]{{\ttfamily[}\meta{#1}{\ttfamily]}}
-\usepackage[notoc]{exesheet}
+\usepackage[exetoc=false,marginwidth=unset,display=notes]{exesheet}
 \usepackage{schooldocs}
 \usepackage[utf8]{inputenc}
 \usepackage[T1]{fontenc}
@@ -43,13 +43,18 @@
 \usepackage{hyperref}
 \usepackage{sectsty}
 \usepackage{pstricks}
+\usepackage{array}
+\usepackage{spacingtricks}
+\usepackage{centeredline}
+%
 \psset{unit=1cm}
 \geometry{textwidth=355pt,vmarginratio=1:1,hmarginratio=3:2}
-% altered by schoodocs, now very close from the default geometry used by ltxdoc
-
+% altered by schoodocs, now very close from the default geometry used by ltxdoc.
+% The following instruction gives the same margin width
+% as with display=notes without altering the margin ratio
+\leftnotemarginwidth{0.55} % special setting here
 \newcommand{\ds}{\displaystyle}
 \newcommand{\bs}{\textbackslash}
-
 \definecolor{darkbrown}{rgb}{0.5,0.1,0.1}
 \allsectionsfont{\sffamily\color{darkbrown}}
 \renewcommand{\labelexercisestyle}{\rmfamily\color{black}}
@@ -56,24 +61,12 @@
 \renewcommand{\labelsubpartstyle}{\rmfamily\color{black}}
 \renewcommand{\annexstyle}{\rmfamily\color{black}\MakeUppercase}
 \renewcommand{\correctionstyle}{\rmfamily\color{correctioncolor}}
-
-\displaypts
-%\diplaynotes gives a non desired margin ratio here
-% following instructions simulate \displaynotes without altering the margin ratio
-\setlength{\marginparwidth}{\oddsidemargin}
-\addtolength{\marginparwidth}{1in}
-\addtolength{\marginparwidth}{-\marginparsep}
-\setlength{\marginparwidth}{0.8\marginparwidth}
-\setboolean{marginpoints}{true}
-\setboolean{marginfullnotes}{true}
-
+\renewcommand{\titlestyle}{\LARGE\sffamily\bfseries}
+%
 \DisableCrossrefs
 %\CodelineIndex
 %\RecordChanges
-
-\title{The \textsf{exesheet} class and package}%\thanks{This document
-%    corresponds to \textsf{exesheet}~\fileversion, dated \filedate.}}
-%\author{Antoine Missier \\ \texttt{antoine.missier at ac-toulouse.fr}}
+\title{The \textsf{exesheet} class and package}
 \subject{Antoine Missier \\
     \texttt{antoine.missier at ac-toulouse.fr}}
 \date{\filedate, \fileversion}
@@ -84,6 +77,7 @@
     pdfsubject={LaTeX class and package},
     pdfauthor={Antoine Missier}
 }
+
 \begin{document}
 \DocInput{exesheet.dtx}
 \end{document}
@@ -90,7 +84,7 @@
 %</driver>
 % \fi
 %
-% \CheckSum{613}
+% \CheckSum{1118}
 %
 % \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
@@ -108,19 +102,46 @@
 %   Grave accent  \`     Left brace    \{     Vertical bar  \|
 %   Right brace   \}     Tilde         \~}
 %
-%
 % \changes{v0.0}{2010/09/01}{Initial personal version}
 % \changes{v0.9}{2020/01/02}{Initial documentation in french}
 % \changes{v1.0}{2020/07/22}{Initial public version with documentation in english}
-% \changes{v1.1}{2021/08/30}{Macro tablenum replaced by tablenum1, small modifications due
-% to changes in tasks package}
-% \changes{v1.2}{2021/09/18}{Bug correction in macros tablenum1 and tablenuma, using the translations package for internationalization}
-%\changes{v1.3}{2021/11/15}{Bad spacing in the exe macro and bug correction in the starred version of this macro}
+% \changes{v1.1}{2021/08/30}{
+%    Macro tablenum (also used by siunitx) replaced by tablenum1, 
+%    small modifications due to changes in tasks package}
 %
+% \changes{v1.2}{2021/09/18}{
+%    Bug correction in macros tablenum1 and tablenuma, 
+%    using the translations package for internationalization}
+%
+% \changes{v1.3}{2021/11/15}{
+%    Bad spacing in the exe macro and bug correction in the starred version of this macro}
+%
+% \changes{v2.0}{2022/12/28}{
+%    options toc and setlist with kvoptions (instead of notoc and nosetlist),
+%    introducing the key 'output' instead of old commands questionsonly, answersonly,
+%    introducing the key 'display' instead of old command displaypts, displaypoints,
+%        displaynotes,
+%    introducing the keys 'margin' and 'noteragged' to set how the notes are displayed,
+%    introducing the key 'correct'}
+% \changes{v2.0}{2023/01/02}{
+%    documentation update,
+%    new option checkpts}
+% \changes{v2.0}{2023/01/09}{
+%    new option 'marginwidth', 
+%    modifying hmarginratio from 5:1 to 3:1 when display=notes,
+%    correct management of two side mode documents}
+% \changes{v2.0}{2023/01/16}{
+%    \enskip between titles and their optional argument,
+%    simplifying macros markingstyle and notestyle,
+%    use of ragged2e package,
+%    code revision and simplification,
+%    documentation update}
+%
 % \GetFileInfo{exesheet.dtx}
 %
 % \maketitle
 % \tableofcontents
+% \enlargethispage{1ex}
 %
 % \section{Introduction}
 %
@@ -130,43 +151,53 @@
 % with particular header and footer, appropriate for exercise sheets (among others).
 % See the \textsf{schooldocs} documentation for more details.
 % The \textsf{exesheet} \emph{class} is based on \textsf{article} 
-% and has the same options.
+% and passes to it its unknown options.
 %
 % Many other packages are dedicated to exercise sheets.
 % Most propose to encapsulate each exercise in an environment
-% while \textsf{exesheet} begins each exercise with the |\exercise| command, 
-% which works like a subsection (with same features)
+% whereas \textsf{exesheet} begins each exercise with |\exercise|, 
+% which works like a subsection (with the same features)
 % and is suitable for documents consisting exclusively of exercises.
 % The package provides also alternative formatting, 
 % more relevant for short exercises.
 %
-% Another specificity of the \textsf{exesheet} package is specific settings
-% for enumeration lists, different from \LaTeX\ standard settings,
+% Another specificity of the \textsf{exesheet} package is the particular settings
+% for enumeration lists, 
 % useful for the numbering of questions or answers inside an exercise.
 %
 % Other packages provide often more or less elaborate mechanisms
 % to manage the placement of answers.
-% \textsf{exesheet} has no such ambitions:
-% for all exercises of the sheet, we can display subject only, 
-% answer only or both, but always at the place they are inserted
+% \textsf{exesheet} has no such ambitions, however,
+% for all exercises of the sheet, you can display questions only, 
+% answers only or both, but always at the place they are inserted
 % in the source file. On the other hand this choice may be very flexible:
-% we can do a correct version for all exercises together, or a correct version per exercise,
+% you can do a correct version for all exercises together, or a correction per exercise,
 % per part (subpart of exercise), per question, per sub-question.
 %
-% Finally the original functionality of this package is the display 
-% of a detailed marking scheme,
-% with optional explanations, in the margin of exercise answers.
+% Finally this package enables to display 
+% a detailed marking scheme in the margin,
+% with optional explanations or remarks, 
+% and with consistency control.
 %
-% There are two possible options: \texttt{notoc} (see \ref{par:notoc})
-% and \texttt{nosetlist} (see \ref{par:nosetlist}).
+% Many settings can be changed and several options manage the output document.
+% These options are based on the keyval mechanism: \texttt{key=value}
+% (thanks to Maxime Chupin and Denis Bitouzé for their wise ideas to improve this package).
+% The options can be passed to class or package, \eg
+% \begin{center}
+% |\documentclass[a4paper,11pt,output=answers,display=pts]{exesheet}|
+% \end{center}
+% or later with the |\exesheetset|\marg{options} command.
+% In the example above, \texttt{a4paper,11pt} are options
+% passed to the underlying class \textsf{article}.
 %
 %\medskip
-% In the current document, a frame is used to highlight 
-% examples beside the rest of the documentation.
+% \emph{In the current document, a frame is used to highlight 
+% examples output.}
 %
 % \section{Titles}
+%
 % \subsection{The \texttt{\bs exercise} command}
-
+%
 % \DescribeMacro{\exercise}
 % Each exercise begins with the |\exercise|\oarg{opt} command. 
 % This command typesets \textbf{\exercisename}, as a document
@@ -174,33 +205,35 @@
 % unique for the whole document.
 % The optional parameter \meta{opt} is used to put additional text
 % on the same title line, for example to precise a subject or a marking scheme.
-% |\exercise[ (to begin)]| yields:
+% |\exercise[(to begin)]| yields:
 %
-% \exercise[ (to begin)]
-% \psframe(-0.25,1.3)(12.75,-0.4)
+% \exercise[(to begin)]
+% \psframe(-0.25,1.3)(12.75,-0.3)
 % Try to use this first command now, it's easy.
 %
 % \bigskip
-% |\hrulefill| can be put in the optional argument to produce an horizontal rule.
-%
 % To bring additional text closer to the exercise number, 
-% we can use the |\unskip| command
-% which eliminates preceding space, see the following example, obtained with
-% |\exercise[\unskip : calculation\ \hrulefill]|:
-% \exercise[\unskip: calculation \ \hrulefill]
-% \psframe(-0.25,1.3)(12.75,-0.4)
+% we can use |\unskip| which eliminates preceding space, 
+% and also |\hrulefill| can be put in the optional argument 
+% to produce an horizontal rule.
+% See the following example, obtained with \\
+% |\exercise[\unskip*** (difficult)]|:
+% \exercise[\unskip*** (difficult)]
+% \psframe(-0.25,1.3)(12.75,-0.3)
 % Calculate $1+1$.
 %
 % \bigskip
+% Several settings can be changed by refining the following commands.
+%
+% \medskip
 % \DescribeMacro{\exercisename}
-% The word \emph{\exercisename} has automatic translation 
-% in a few languages\footnote{Translation 
-% is currently integrated into the package for the following languages: French,
-% German, Spanish, Italian, Portuges.}
+% The word ``\exercisename'' has automatic translation in a few languages
+% \footnote{Translation is currently integrated into the package 
+% for the following languages: French, German, Spanish, Italian, Portuges.}
 % according to the loaded language (by \textsf{babel} or \textsf{polyglossia}).
 % It can be redefined, with |\renewcommand|,
-% or else we can use macros from the \textsf{translations} 
-% package (allowing dynamic language change), e.g. (in the preamble)\\
+% or better you can use (in the preamble) macros from the \textsf{translations} 
+% package (allowing dynamic language change), \eg \\
 % |\DeclareTranslation{Swedish}{exesheet-exercise}{\"Ovning}}|.
 %
 % \DescribeMacro{\labelexercise}
@@ -215,19 +248,19 @@
 % \DescribeMacro{\labelexercisestyle}
 % This macro (which is empty by default) allows to define a particular style
 % for exercise titles. In the present document, we defined in the preamble:
-% |\renewcommand{\labelexercisestyle}{\rmfamily\color{black}}|\footnote{In the 
-% present document, to highlight real sections and subsections titles,
+% |\renewcommand{\labelexercisestyle}{\rmfamily\color{black}}|
+% \footnote{In the present document, to highlight real sections and subsections titles,
 % their color and font have been modified with the
 % \texttt{\bs allsectionsfont} macro from the \textsf{sectsty} package.}.
 %
-% \bigskip
+% \medskip
 % \DescribeMacro{\exercise*}
 % The starred version |\exercise*|\oarg{opt}\marg{label}
 % allows to choose another \meta{label} for a particular exercise
 % and removes the numbering. For instance:
-% |\exercise*[(Fermat theorem)]{Problem}| yields:
+% |\exercise*[(Fermat's theorem)]{Problem}| yields:
 %
-% \exercise*[(Fermat theorem)]{Problem}
+% \exercise*[(Fermat's theorem)]{Problem}
 % \psframe(-0.25,1.3)(12.75,-0.7)
 % Prove that there are no positive integers $x, y, z$ such that $x^n+y^n=z^n$
 % for any integer $n$ greater than 2.
@@ -239,25 +272,28 @@
 % with the |\subpart|\oarg{opt} command, typeset like a sub-subsection.
 % \exercise
 % \subpart[(preliminary)]
-% \psframe(-0.25,1.95)(12.75,-1.9)
+% \psframe(-0.25,1.95)(12.75,-1.85)
 % First of all, prepare your cup of tea.
 % \subpart
 % Now you are ready to make the current exercise.
 %
 % \bigskip
+% The following macros manage formatting in the same way as for |\exercise|.
+%
+% \medskip
 % \DescribeMacro{\thesubpart}
 % By default, the subpart numbering uses letters : A, B, C, etc.
 % This numbering type can be redefined with the |\thesubpart| command based on
 % the |subpart| counter, for instance |\renewcommand\thesubpart{\arabic{subpart}}|.
 %
-% \pagebreak
 % \DescribeMacro{\subpartname} \DescribeMacro{\labelsubpart} 
 % \DescribeMacro{\labelsubpartstyle}
-% As for |\exercise|, the |\subpart| command
+% The |\subpart| command
 % uses |\subpartname| (with automatic translation in a few languages 
 % according to the selected language),
-% |\labelsubpart| and |\labelsubpartstyle|, which are editable.
+% |\labelsubpart| and |\labelsubpartstyle|, which can be changed.
 %
+% \medskip
 % \DescribeMacro{\subpart*}
 % Like |\exercise*|, the starred version |\subpart*|\oarg{opt}\marg{label}
 % allows to freely typeset the subpart \marg{label}, for instance
@@ -271,11 +307,12 @@
 % with an optional parameter, added on the same line.
 %
 % \vspace{-\baselineskip}
-% \noindent\psframe(-0.25,-0.3)(12.75,-1.25)
+% \noindent\psframe(-0.25,-0.3)(12.75,-1.3)
 % \annex[(to return)]
 %
+% \bigskip
 % \DescribeMacro{\annexname}
-% The word \emph{\annexname} has automatic translation in a few languages.
+% The word ``\annexname'' has automatic translation in a few languages.
 % It can be extended to other languages or modified by redefining |\annexname|
 % or with macros from the \textsf{translations} package.
 %
@@ -284,14 +321,12 @@
 % defined as follows: |\newcommand\annexstyle{\MakeUppercase}|.
 % This command may be redefined as one wants.
 %
-% \subsection{Exercise titles in table of contents 
-% (notoc package option)} \label{par:notoc}
-% \DescribeMacro{notoc}
-% By default, the titles \emph{\exercisename}, \emph{\subpartname} or \emph{\annexname},
-% appear in the table of contents
+% \subsection{Exercise titles in table of contents} \label{toc}
+% \DescribeMacro{[exetoc=\meta{bool}]}
+% By default, the titles \textbf{\exercisename}, \textbf{\subpartname} 
+% or \textbf{\annexname}, appear in the table of contents
 % (or in the pdf file summary when \textsf{hyperref} package is used). 
-% To avoid this, you can set the boolean \texttt{notoc} to \texttt{true}
-% or call the \textsf{exesheet} package (or class) with \texttt{notoc} option.
+% To avoid this, you can set the option \texttt{exetoc=false} (default is \texttt{true}).
 % But notice that title optional arguments will always be ignored in the table of contents.
 %
 % \subsection{Short exercises: the \texttt{\bs exe} command}
@@ -310,13 +345,13 @@
 %
 % \bigskip
 % \DescribeMacro{\exname} \DescribeMacro{\exlabel} \DescribeMacro{\exsepmark}
-% The abbreviation \emph{\exname} may be changed by
+% The abbreviation \textbf{\exname} may be changed by
 % redefining |\exname| or with macros from the \textsf{translations} package.
 % The |\exlabel| macro calls |\exname| following by a period then the exercise number,
 % and |\exsepmark| typesets a long dash.
-% We may change these features by redefining these commands.
+% One can change these features by redefining these commands.
 %
-% \bigskip
+% \medskip
 % \DescribeMacro{\exe*}
 % The starred version prints no separator as shown below:
 %
@@ -323,37 +358,11 @@
 % \vspace{-\baselineskip}
 % \noindent\psframe(-0.25,-0.35)(12.75,-1.1) 
 % \exe* Another short exercise without separator.
-%
-% \subsection{The \texttt{\bs points} command}
-% \DescribeMacro{\points}
-% The |\points|\marg{pts} command displays the number of points awarded to an exercise.
-% It is intended to be entered in the optional argument of the 
-% |\exercise| command\footnote{This command which has to be used
-% in the optional argument of \texttt{\bs exercise}, as several others presented below, 
-% is incompatible with
-% the \textsf{memoir} class which redefines section commands.}.
-% |\exercise[\points{5}]| yields:
-% \exercise[\points{5}]
-% \psframe(-0.25,1.3)(12.75,-0.4)
-% Try to read this whole document without drinking tea and you get five points.
-%
-% \bigskip
-% \DescribeMacro{\pointsname} \DescribeMacro{\pointname}
-% Like before, the word \emph{points} and in the singular \emph{point}
-% (if \meta{pts} is inferior to 2)
-% get automatic translation in a few languages
-% and are modifiable.
 % 
-% \DescribeMacro{\pointsstyle} \DescribeMacro{pointscolor}
-% The style used by the |\points| command may be redefined with |\pointsstyle|. 
-% The color is set by |pointscolor| with the |\definecolor| command
-% (from the \textsf{xcolor} package by Uwe Kern, loaded by \textsf{exesheet}), 
-% for instance: \\ |\definecolor{pointscolor}{named}{blue}|.
-%
-% 
 % \section{Enumerations and lists}
 %
-% \subsection{List settings (nosetlist package option)} \label{par:nosetlist}
+% \subsection{List settings} \label{setlist}
+% \DescribeEnv{enumerate} \DescribeMacro{\item}
 % Enumeration lists are intended to represent questions and sub-questions
 % inside exercises. For a good highlight,
 % labels are typeset in bold. 
@@ -360,20 +369,23 @@
 % Moreover, they are left aligned, at the start of the line, 
 % without indentation, and the vertical space between items
 % is increased compared with \LaTeX\ standard lists.
-% These settings are done by the |\setlist| command\footnote{Labels
-% may also be changed by the \texttt{\bs labelenumi} and \texttt{\bs labelenumii} commands.}
-% from the \textsf{enumitem} package by Javier Bezos.
-% Lists with \texttt{itemize} environment are kept in their default configuration\footnote{The
-% \texttt{french} option of the \textsf{babel} package
-% alters \texttt{itemize} lists behavior and uses long dash
+% These settings are done by the |\setlist| command
+% \footnote{Labels may also be changed occasionally in an optional argument 
+% \eg \texttt{\bs begin\{enumerate\}[A.]},
+% or globally thanks to \texttt{\bs labelenumi} 
+% and \texttt{\bs labelenumii} commands.}
+% from the \textsf{enumitem} package of Javier Bezos.
+% Lists with \texttt{itemize} environment are kept in their default 
+% configuration
+% \footnote{The \texttt{french} option of the \textsf{babel} package
+% alters \texttt{itemize} lists behavior and uses long dashes
 % as labels for each list level.
 % This behavior is problematic when mathematics follows the dash
 % symbol because the latter may be confused with the minus sign.
-% Modifications of the \texttt{french} option (which supersedes \texttt{frenchb} 
-% of \textsf{babel}) are canceled to restore \LaTeX\ default settings.}.
+% Default \texttt{itemize} lists are restored.}.
 %
 % \vspace{-\baselineskip}
-% \noindent\psframe(-0.25,-0.35)(12.75,-3.9) 
+% \noindent\psframe(-0.25,-0.35)(12.75,-3.6) 
 % \exercise
 % \begin{enumerate}
 % \item First question
@@ -384,47 +396,47 @@
 % \item Second question
 % \end{enumerate}
 %
-% \DescribeMacro{nosetlist}
-% We can avoid enumeration list modifications and restore the \LaTeX\ 
-% default settings by passing the option
-% \texttt{nosetlist} to the \texttt{exesheet} class or package.
+% \smallskip
+% \DescribeMacro{[setlist=\meta{bool}]}
+% One can avoid enumeration list alterations and restore \LaTeX\ 
+% default settings with the option |[setlist=false]| 
+% (default value is \texttt{true} of course).
 %
 % \subsection{List of exercises : the \texttt{exenumerate} environment}
 % \DescribeEnv{exenumerate}
-% When an exercise sheet is made of short independent exercises,
-% it would be ill-advised to display the complete title \emph{\exercisename} for each. 
+% When an exercise sheet is made of short independent questions,
+% it would be ill-advised to display the complete title \textbf{\exercisename} for each. 
 % In addition to the |\exe| command, previously presented,
-% we provide an even lighter solution with the |exenumerate| environment, 
-% which is only an enumeration list in which
-% spaces between items are further increased compared with those of \texttt{enumerate}.
-% Here is an example (the main list is an \texttt{exenumerate} environment but 
-% sub-lists are produced with regular \texttt{enumerate} environments):
+% we provide an even lighter solution with the |exenumerate| environment.
+% It's only an enumeration list in which
+% spaces between items are further increased compared to those of \texttt{enumerate}.
+% Below is an example (the main list is an \texttt{exenumerate} environment but the
+% sub-list is produced with common \texttt{enumerate} environments):
 %
 % \vspace{-\baselineskip}
-% \noindent\psframe(-0.25,-0.3)(12.75,-6.75) 
+% \noindent\psframe(-0.25,-0.3)(12.75,-5.3) 
 % \begin{exenumerate}
-% \item Translate the following sentences in english: 
+% \item Translate the following sentences in English: 
 % \begin{enumerate}
 % \item Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi.
 % \item Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus.
 % \end{enumerate}
-% \item  Translate the following sentence in german:
+% \item  Translate the following sentence in German:
 % \par Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna,
 % vitae ornare odio metus a mi. 
-% \item  Translate the following sentences in french: 
-% \begin{enumerate}
-% \item Cum sociis natoque penatibus 
+% \item  Translate the following sentences in French: 
+% Cum sociis natoque penatibus 
 % et magnis dis parturient montes, nascetur ridiculus mus.
-% \item Nulla ullamcorper vestibulum turpis.
-% \end{enumerate}
 % \end{exenumerate}
+%
+% \medskip
 % The environment takes an optional parameter, like \texttt{enumerate}, 
 % which enables, among others, 
-% to typeset alternative list labels, e.g.
+% to typeset alternative list labels, \eg
 % |\begin{exenumerate}[A.]|.
 % There are many other options (see the \textsf{enumitem} package documentation).
 %
-% \subsection{Items aligned by lines}
+% \subsection{Items aligned by row: \texttt{tablenum1$\mid$a}, \texttt{tablitem}}
 % \DescribeEnv{tablenum1} 
 % \DescribeEnv{tablenuma}
 % \DescribeEnv{tablitem}
@@ -440,7 +452,7 @@
 % |\NewTasksEnvironment| macro, from the \textsf{tasks} package by Clemens Niederberger.
 % They take an optional argument \meta{opt}
 % explained in the documentation of this package, 
-% e.g.\ |label=\arabic*)| produces an Arabic numbering
+% \eg |label=\arabic*)| produces an Arabic numbering
 % following by a closing parenthesis (like in \texttt{enumitem} package).
 % There are also many possibilities to place items in an original way,
 % for instance, the |\item*| command allows to
@@ -461,17 +473,18 @@
 % \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$.
 % \end{tablenum1}
 %
+% \smallskip
 % For \texttt{tablenuma}, labels are
 % letters (a, b, c, \ldots) surrounded
-% by parentheses. This cannot be modified globally
-% (except by redefining the environment with |\RenewTasksEnvironment|).
-% If the \textsf{exesheet} package is called with option \texttt{nosetlist},
+% by parentheses. This cannot be modified globally,
+% except by redefining the environment with |\RenewTasksEnvironment|.
+% If the \textsf{exesheet} package is called with the option \texttt{setlist=false},
 % labels of \texttt{tablenum1} and \texttt{tablenuma} environments
-% are displayed in normal font instead of boldface, with indentation.
+% are displayed with indentation and in normal font instead of bold.
 %
-% \subsection{Items aligned by columns: \texttt{colsenum}}
+% \subsection{Items aligned by column: \texttt{colsenum}, \texttt{colsitem}}
 % \DescribeEnv{colsenum}    
-% To get numbering of items by columns, we have the
+% To get numbering of items by column, we provide the
 % \texttt{colsenum} environment: |\begin{colsenum}|\oarg{opt}\marg{cols}.
 % The mandatory parameter is the number of columns
 % and the optional one will be passed to \texttt{enumerate},
@@ -478,6 +491,7 @@
 % allowing, for example, to change the type of numbering (a, A, etc.).
 % To use this environment, we have to load the
 % \textsf{multicol} package in the preamble.
+% Here an example with |\begin{colsenum}{3}|:
 %
 % \exercise
 % \psframe(-0.25,1.3)(12.75,-2.65)
@@ -489,15 +503,17 @@
 % \item $\ds k(x) = \sum_{i=1}^{\infty}\frac{1}{x^i}$,
 % \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$.
 % \end{colsenum}
+%
+% \medskip
 % \DescribeEnv{colsenum*}
 % We will notice that, on each line, items are not necessarily well
-% aligned, what can produce inelegant effects. 
+% aligned, which can produce inelegant effects. 
 % On the other hand, the \texttt{colsenum} environment doesn't try to align columns 
 % from the bottom by adjusting space between items.
 % If we want to get this
-% (which is the default option in \textsf{multicol}) we have the
+% (which is the default option in \textsf{multicol}), we have the
 % \texttt{colsenum*} environment (same syntax than \texttt{colsenum}).
-% Here what we get in that case, with the same exercise.
+% Here what we get in that case, with the same exercise:
 %
 % \exercise
 % \psframe(-0.25,1.3)(12.75,-2.65)
@@ -509,8 +525,10 @@
 % \item $\ds k(x) = \sum_{i=1}^{\infty}\frac{1}{x^i}$,
 % \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$.
 % \end{colsenum*}
+%
+% \medskip
 % We can see that these alignments are less good than those
-% obtained by numbering of items by line. The numbering of items by columns
+% obtained by row numbering. The column numbering
 % may nevertheless be preferable when there are many items with variable heights,
 % and a number of items which can be different from one column to the other.
 % Moreover, an advantage of \texttt{colsenum} is that the choice of labels 
@@ -517,10 +535,11 @@
 % is automatic depending on the list level (and the language),
 % unlike \texttt{tablenum1} or \texttt{tablenuma}. 
 %
+% \bigskip
 % \DescribeEnv{colsitem} 
 % \DescribeEnv{colsitem*}
 % For \texttt{itemize} lists, the environment \texttt{colsitem}
-% produces items aligned by columns rather than by lines as for
+% produces items aligned by column rather than by lines as for
 % \texttt{tablitem}:
 % |\begin{colsitem}|\oarg{opt}\marg{cols}. The optional parameter,
 % which is passed to the underlying \texttt{itemize} environment, 
@@ -530,18 +549,20 @@
 %
 % \section{Questions and solutions}
 %
-% \subsection{The \texttt{questions} and \texttt{answers} environments}
+% \subsection{Environments \texttt{questions} and \texttt{answers}}
+% \label{output}
+%
 % \DescribeEnv{questions} \DescribeEnv{answers}
 % The package provides the two environments \texttt{questions} and \texttt{answers}
-% to make appear or disappear questions and answers of exercises.
-% Display is controlled by two booleans: \texttt{questions} and \texttt{answers}.
-% Their default value is \texttt{true}.
+% to make optionally appear or disappear questions and answers of exercises.
 %
-% \DescribeMacro{\questionsonly} \DescribeMacro{\answersonly}
-% The |\questionsonly| command allows to display the questions without the answers
-% and |\answersonly| displays the solutions without the questions\footnote{Of course 
-% we can also assign the booleans \texttt{questions} and \texttt{answers} 
-% directly with the \LaTeX\ command \texttt{\bs setboolean}.}.
+% \bigskip
+% \DescribeMacro{[output=\meta{opt}]}
+% The output is controlled by the \texttt{output} key option: it takes three
+% recognized values: \texttt{questions}, \texttt{answers}, \texttt{both}.
+% The \texttt{questions} value allows to display questions without answers,
+% \texttt{answers} displays answers without questions,
+% \texttt{both} (the default option) displays  both.
 % 
 % \bigskip
 % \DescribeMacro{\correctionstyle} \DescribeMacro{correctioncolor}
@@ -549,24 +570,24 @@
 % In the case (by default) where questions and answers are displayed both,
 % answers are then typeset in the style
 % |\correctionstyle|, which uses the color \texttt{correctioncolor}.
-% This color may be chosen with the |\definecolor| macro
+% This color may be changed with the |\definecolor| macro
+% \footnote{from the \textsf{xcolor} package by Uwe Kern 
+% which is loaded by \textsf{exesheet}.}
 % (by default |\definecolor{correctioncolor}{rgb}{0,0.2,0.6}| = kind of dark blue).
-% Moreover, in that case,
+% Moreover, with \texttt{output=both}
 % the title \textbf{\correctionname} is displayed at the beginning
-% of the \texttt{answers} environment.
+% of \texttt{answers} environments.
 % It is defined by the |\correctionname| macro (with translation in a few languages
-% and that we can change:\footnote{Except for English, if you want to change package 
-% keywords you have to do it \emph{after} \texttt{\bs begin\{document\}}
-% because \textsf{babel} will modify these definitions at the end of the preamble.}
-% for example we may prefer \emph{Solution}
-% than \emph{\correctionname}).
+% and that can changed:
+% for example you may prefer ``Solution''
+% than ``\correctionname'').
 % The style defined by |\correctionstyle| will apply to the title
-% but also to the whole environment.
+% as for the whole environment.
 % Here an example.
 %
 % \vspace{-\baselineskip}
-% \noindent\psframe(-0.25,-0.25)(12.75,-6.6) 
-% \exercise[\points{3}] \label{points}
+% \noindent\psframe(-0.25,-0.25)(12.75,-6.7) 
+% \exercise
 % \begin{questions}
 % \begin{enumerate}
 % \item Is the \textsf{exesheet} package useful ? 
@@ -575,7 +596,7 @@
 % \end{questions}
 % \begin{answers}
 % \begin{enumerate}
-% \item Yes, the \textsf{exesheet} package is very useful.
+% \item Yes, the \textsf{exesheet} package is useful for teachers.
 % \item There are many other packages that deal with exercises, and
 % give the ability to produce separately questions and solutions, for example
 % \textsf{exercise} by Paul Pichaureau, \textsf{exercises} by Roger Jud,
@@ -587,14 +608,11 @@
 % \end{enumerate}
 % \end{answers}
 %
-% \DescribeMacro{\points}
-% When only answers are displayed, the text color remains black,
-% the word \emph{\correctionname} is not displayed and the
-% |\points| macro is patched to suppress the display of points.
-% An extended solution for a variable display of points will be discussed
-% in section \ref{totalpoints} with the |\totalpoints| macro.
+% \medskip
+% When only answers are displayed, the text color remains black and
+% the word ``\correctionname'' is not displayed.
 %
-% \subsection{More about \texttt{answers} environment}
+% \subsection{About the title ``\correctionname'' in \texttt{answers} environments}
 % Internally, we have used the |\comment| and |\endcomment| macros
 % from the \textsf{versions} package by Uwe Lück.
 % Other excellent packages allow to manage
@@ -604,119 +622,219 @@
 % \textsf{optional} by Donald Arseneau
 % and \textsf{codesection} by Matthias Pospiech.
 %
-% The \textsf{versions} package used provides furthermore 
+% The \textsf{versions} package provides furthermore 
 % the |\includeversion|\marg{env} and
 % |\excludeversion|\marg{env} macros who allow to make appear or disappear
 % any environment \meta{env} and these optional environments
-% may be nested\footnote{The \textsf{codesection} package also allows
-% such nesting, including in the preamble,
-% as well as the \textsf{optional} package, but the latter only manages short optional code.}.
+% may be nested
+% \footnote{The \textsf{codesection} package also allows
+% such nesting, including in the preamble, as well as 
+% the \textsf{optional} package, but the latter manages only short optional code.}.
 %
 % However the \texttt{questions} and \texttt{answers} environments
 % perform another task, not only making appear or disappear piece of text.
-% Indeed, there is a problem with the title \emph{\correctionname}. 
-% In which format to typeset it and at which level to put it in the table of contents
+% In what format should the output yield the title \textbf{\correctionname} 
+% and at which level should it be put in the table of contents
 % (or in the summary of the pdf file)?
 % In fact it depends on which level the environment has been nested.
-% We can make a single \texttt{answers} environment for all the
-% exercises of the sheet or an \texttt{answers} environment
+% We can make a single \texttt{answers} environment for the whole
+% sheet or an \texttt{answers} environment
 % for each exercise, for each exercise part, for each question or sub-question.
-% In fact, the typeset of the title \emph{\correctionname}
-% and his level in the table of contents will be adjusted automatically.
+% In fact, the typeset of the title \textbf{\correctionname}
+% and his level in the table of contents will be computed by the environment.
 %
-% \DescribeEnv{\oarg{level}}
-% Nevertheless, we can imagine twisted situations in which 
-% the title level will not be correctly calculated.
-% It is then possible to force the level of the title \emph{\correctionname} 
+% \medskip
+% \DescribeEnv{answers\oarg{level}}
+% Nevertheless, one can imagine twisted situations in which 
+% the title level will not be correct.
+% Moreover, the user may want to change the level of the title.
+% It is then possible to force the level of the title ``\correctionname''
 % with |\begin{answers}|\oarg{level}.
 % The optional \meta{level} parameter is defined as follows:
 % 1 for section level titles,
-% 2 for subsections (like \emph{\exercisename}), 
-% 3 for sub-subsections (like \emph{\partname}),
+% 2 for subsections (like \textbf{\exercisename}), 
+% 3 for sub-subsections (like \textbf{\partname}),
 % another number for lower levels
-% (then they will not appear in the table of contents).
+% (that will not appear in the table of contents).
 %
-% \bigskip
+% \pagebreak
 % \DescribeMacro{answers*}
-% The starred version \texttt{answers*} allows to make the title
+% The starred version \texttt{answers*} makes the title
 % \textbf{\correctionname} completely disappear.
 %
-% \subsection{The \texttt{\bs question} command}
-% \DescribeMacro{\question}
-% Instead of the \texttt{questions} and \texttt{answers} environments,
-% we can also use the simple |\question|\marg{ques}\marg{ans} macro
+% \subsection{Commands \texttt{\bs question}, \texttt{\bs answer} and \texttt{\bs answerspace}}
+% \label{answerspace}
+% \DescribeMacro{\question}\DescribeMacro{\answer}
+% Instead of \texttt{questions} and \texttt{answers} environments,
+% we can also use simple |\question|\marg{ques} and |\answer|\marg{ans} macros
 % in which display of \meta{ques} and \meta{ans} arguments 
-% is controlled by the same previous commands |\questionsonly| and |\answersonly|.
-% It can be more readable (in the source code) when questions and answers are short.
-% In the case of displaying both questions and answers,
-% the \emph{\correctionname} title will appear on a new line, in bold,
-% as for levels lower than sub-subsection in the \texttt{answers} environment
-% (and without entries in the table of contents).
-% But this command doesn't work with \texttt{verbatim} inside.
+% are controlled by the same previous key option \texttt{output=\meta{opt}}.
+% It may be more suitable when questions and answers are short, for instance
+% if you want to display the answer after each question item.
+% The title ``\correctionname'' will not appear on the beginning
+% of each answer; answers are typeset with |\correctionstyle|
+% if \texttt{output=both}.
+% But these commands don't work with \texttt{verbatim} text inside,
+% whereas \texttt{questions} and \texttt{answers} environments allow that.
 %
-% \section{Marginal notes for marking scheme}
+% \bigskip
+% \DescribeMacro{\answerspace}
+% Some teachers are used to give to their students documents in which questions are typeset
+% but instead of answers you have blank space, so that the paper is intended to be
+% fulfilled by the students. 
+% For this purpose, thanks to a suggestion of Maxime Chupin,
+% we provide the macro |\answerspace|\oarg{height},
+% in which the parameter height is a valid length, \eg |\answerspace{3cm}|.
 %
-% The \textsf{exesheet} package allows the display of a marking
-% scheme with comments and explanations for answers.
+% \DescribeMacro{[answerspace=\meta{bool}]}
+% This vertical space display is optional and is controlled by the key
+% \texttt{answerspace} which can be \texttt{true} or \texttt{false} (by default).
+% Of course this macro is not intended to be placed inside \texttt{answers}
+% environments, but anywhere else.
 %
-% \pagebreak
-% \subsection{The \texttt{\bs pts} command}
+% \section{Marginal notes for marking scheme} 
+%
+% The \textsf{exesheet} package allows to display in margins a marking
+% scheme with comments and explanations about answers.
+%
+% \subsection{The \texttt{\bs points} command}\label{points}
+% \DescribeMacro{\points}
+% The |\points|\marg{pts} command displays the number of points awarded for an exercise.
+% It is intended to be entered in the optional argument of the 
+% |\exercise| command
+% \footnote{Using this command in the optional argument of 
+% \texttt{\bs exercise} is incompatible with
+% the \textsf{memoir} class which redefines section commands.}.
+% For instance
+% |\exercise[\points{5}]| yields:
+% \exercise[\points{5}]
+% \psframe(-0.25,1.3)(12.75,-0.4)
+% Try to read this document to the end without drinking tea and you get five points.
+%
+% \bigskip
+% When only correction is displayed in an exercise, the |\points| macro is patched 
+% to suppress the display of points.
+% An extended solution for printing answers with the scale will be presented
+% in section \ref{totalpoints}, including a new |\totalpoints| macro.
+%
+% \bigskip
+% \DescribeMacro{\pointsname} \DescribeMacro{\pointname}
+% The word ``\pointsname'' (or in the singular ``\pointname''
+% if \meta{pts} is inferior to 2), is added and, like before,
+% gets automatic translation in a few languages
+% (and can be changed).
+% 
+% \DescribeMacro{\pointsstyle} \DescribeMacro{pointscolor}
+% The style used by the |\points| command may be redefined with |\pointsstyle|. 
+% The color is set by |pointscolor| with the |\definecolor| command,
+% and you can change it, 
+% \eg: |\definecolor{pointscolor}{named}{blue}|.
+%
+% \subsection{The \texttt{\bs pts} command} \label{pts}
 % \DescribeMacro{\pts}
 % When exercises are typeset with the |\exe| macro,
 % or as a list with the \texttt{exenumerate} environment,
-% the marking scheme is displayed in the margin, on the line where
+% the marking scheme can be displayed in the margin, on the line where
 % we put the |\pts|\marg{num} command (in general the first line of the exercise).
 % The \meta{num} parameter is the number of points assigned to the exercise.
+% Below what we obtain with with |\exe\pts{3}... \exe\pts{1.5}...|
 %
 % \vspace{-\baselineskip}
-% \noindent\psframe(-3.5,-0.25)(12.75,-2)
-% \exe \pts{3} The first exercise with marking scheme.
+% \noindent\psframe(-3.0,-0.25)(12.75,-1.95)
+% \exe \pts{3} The first exercise with a marking scheme.
 % \exe \pts{1.5} The second one.
 % 
 % \bigskip
 % \DescribeMacro{\ptsname} \DescribeMacro{\ptname} 
 % \DescribeMacro{ptscolor} \DescribeMacro{\ptsstyle}
-% The abbreviation \textsf{\ptsname} (or \textsf{\ptname} 
+% The abbreviation ``\ptsname'' (or ``\ptname''
 % when the number of points is inferior to 2)
-% is automatically added thanks to the macro |\ptsname| or |\ptname| 
-% (translated in a few languages if \textsf{babel} is loaded).
-% The display color of the points is defined by \texttt{ptscolor} which can be changed
+% is automatically added with macros |\ptsname| or |\ptname| 
+% (translated in a few languages if \textsf{babel} ore \textsf{polyglossia} are loaded).
+% The display color of the points is defined by \texttt{ptscolor}, which can be changed
 % with |\definecolor|: by default |\definecolor{ptscolor}{named}{red}|.
-% The display style is defined by |\ptsstyle|.
+% The display style is defined by |\ptsstyle|: among other things, it adds parenthesis around.
 %
-% \DescribeMacro{\displaypts}
-% The display of the marking scheme, as above, is internally controlled by the
-% \texttt{marginpts} boolean.
-% The |\displaypts| command, which has to be placed in the preamble, 
-% defines \texttt{marginpts} to \texttt{true},
-% places marginal notes to the left (and not to the right which 
-% is the default behavior of \LaTeX)
-% and shifts the text body right to increase the left margin compared 
-% with the right one, with a ratio 3:2,
-% as it is in the present document.
-% This ratio is defined by the
-% |geometry| macro from the \textsf{geometry} package (by Hideo Umeki) 
-% and is valid for the whole document.
+% \bigskip
+% \DescribeMacro{[display=\meta{opt}]} 
+% The display of the marking scheme is controlled by the
+% option key \texttt{display}.
+% By default |display=none| and the marking scheme will not be displayed.
+% Use |display=pts| to make it appear.
+% More details about this key are given in \ref{margin}.
+%
+% \medskip
+% \DescribeMacro{[marginpos=\meta{opt}]} 
+% The side where to place the scale is controlled by the |marginpos| key option
+% whose possible values are (first) \texttt{left} or \texttt{right}.
+% The default is \texttt{left}
+% (although the default behavior of \LaTeX{} is to place marginal notes on the right side). 
+% This option has no effect when
+% |display=none|.
+%
+% For a \emph{two side} document, the default behavior is to typeset text in the outer margin
+% which will be enlarged relatively to the inner margin (that contains the binding).
+% The outer margin is on the right hand side for odd pages and on the left hand side
+% for even pages. So the \texttt{marginpos} key option can take those two additional 
+% values.
+% When you give a \texttt{left} or \texttt{right} value with a two side document,
+% it will be converted to default value, \texttt{outer}, with a warning message.
+%
+% \medskip
+% \DescribeMacro{twoside mode}
+% For a document is in twoside mode, marginal notes sometimes appear on the wrong 
+% side of a page. This is a known bug of \LaTeX\ for which the solution
+% is to call the package \textsf{mparhack} (what is done by \textsf{exesheet}
+% for a twoside mode document) and to \emph{run \LaTeX\ twice}. 
+% If necessary you get a warning message to rerun.
 % 
-% \subsection{The \texttt{\bs totalexe}, \texttt{\bs note} 
-% and \texttt{\bs totalpoints} commands}
-% \label{totalpoints}
+% \subsection{Commands \texttt{\bs totalexe}, \texttt{\bs note*} and \texttt{\bs note}}
+%
+% \label{note}
+% To give a more detailed marking scheme, we get
+% the following commands.
+%
+% \medskip
 % \DescribeMacro{\totalexe}
+% |\totalexe|\marg{num} displays the total number of points of an exercise,
+% by default inside an oval box, with the word ``\ptsname'' (or ``\ptname'') 
+% added and in bold red.
+% In the next example, the exercise title has been obtained with |\exercise[\totalexe{4}]|.
+%
+% \medskip
+% \DescribeMacro{\note*} 
+% For each answer or solution in the correct version, the command
+% |\note*|\marg{num} states the number of points of that question.
+% The appearance is somewhat different from the one obtained with |\pts|:
+% by default the number is displayed without being followed by ``\ptsname'' or ``\ptname'',
+% without parenthesis, and in bold. 
+% In the answer 3 of the next example, just after |\item|, we used: |\note*{1.5}|.
+%
+% \medskip
 % \DescribeMacro{\note}
-% To give a more detailed marking scheme, the \textsf{exesheet} package 
-% provides some extended commands:
-% |\totalexe|\marg{num} to display the total number of points of an exercise
-% and especially |\note|\oarg{pts}\marg{comment},
-% to indicate some marking detail in answers.
-% The optional parameter \meta{pts} is the number of points of the question
-% and the mandatory parameter \meta{comment} is used to give details about the marking scheme.
-% Below the title has been obtained with |\exercise[\totalexe{4}]|
-% and the first comment (on next page) with \\
-% |\note[1]{0,5 for the anti-derivative\\0,5 for simplification of $\ln$}|.
+% The |\note|\marg{comment} macro is used to give details about the marking scheme
+% and to indicate how points are awarded.
+% In a comment argument you can use |\\| to get a line break,
+% or even |\\[|\meta{height}|]| to increase the line break from \meta{height}.
 %
+% \DescribeMacro{\note\oarg{num}}
+% It is often convenient to put |\note*|\marg{num}|\note|\marg{comment} 
+% at the beginning of an answer. In that case \LaTeX\ will place the margin
+% notes one under the other and will protest with: 
+% \texttt{LaTeX Warning: Marginpar on page \ldots\@ moved.} \\
+% This is not a real problem because generally \LaTeX\ is able to
+% manage the placement of these
+% marginal notes, one below the other. Nevertheless, one can avoid unnecessary protests by 
+% compacting both commands in a single one and typing the number of points
+% as an optional argument of note:
+% |\note|\oarg{num}\marg{comment}.
+%
+% The first comment on the following example is obtained (just after |\item|) with\\
+% |\note[1]{0.5 for the anti-derivative\\0.5 for simplifying}|.
+%
 % \exercise[\totalexe{4}] \label{totalexe}
 % \begin{questions}
-% \psframe(-3.5,1.3)(12.75,-3.1)
+% \psframe(-3.5,1.3)(12.75,-14)
 % For each following question, say if the assertion is true or false.
 % Justify the answer carefully.
 % \begin{tablenum1}
@@ -723,16 +841,13 @@
 % \item $\ds \int_{0}^{\sqrt{3}}\frac{1}{x+\sqrt{3}} \,\mathrm{d}x = \ln 2$,
 % \item $\ds \int_{2}^{\mathrm{e}} \frac{1}{x\ln x} \,\mathrm{d}x = -\ln 2$,
 % \item* The function $F$ defined on $\mathbf{R}$ by 
-% $F(x) = \ds \int_{0}^{x}\frac{1}{,t^2+t+1}\,\mathrm{d} t$ is increasing on $\mathbf{R}$.
+% $F(x) = \ds \int_{0}^{x}\frac{1}{t^2+t+1}\,\mathrm{d} t$ is increasing on $\mathbf{R}$.
 % \end{tablenum1}
 % \end{questions}
 % 
-% \pagebreak
 % \begin{answers}
-% \vspace{-\baselineskip}
-% \noindent\psframe(-4.7,0.9)(12.75,-10.25)
 % \begin{enumerate}
-%    \item \note[1]{0,5 for the anti-derivative\\0,5 for simplification of $\ln$}
+%    \item \note[1]{0.5 for the anti-derivative\\0.5 for simplifying}
 %    We calculate:
 %    \[ \int_{0}^{\sqrt{3}}\frac{1}{x+\sqrt{3}}\,\mathrm{d}x
 %        = \bigg[ \ln\left(x+\sqrt{3}\right) \bigg]_0^{\sqrt{3}}
@@ -742,9 +857,9 @@
 %    \]
 %    \textbf{TRUE}.
 %
-%    \item \note[1.5]{1 for the anti-derivative \\0.5 for the integral value \\[2ex]
-%        we could also see that $\frac{1}{x \ln x} >0$ on $[2, \mathrm{e}]$ 
-%       while $-\ln2<0$
+%    \item \note[1.5]{1 for the anti-derivative \\0.5 for final value \\[2ex]
+%        other method: $\frac{1}{x \ln x} >0$ on $[2, \mathrm{e}]$ 
+%        whereas $-\ln2<0$
 %    }
 %    We have $\ds\frac{1}{x \ln x}= \frac{\frac{1}{x}}{\ln x}= \frac{u'(x)}{u(x)}$
 %    with $u(x)=\ln x$, which is positive on $[2, \mathrm{e}]$. Hence
@@ -768,96 +883,260 @@
 % \end{enumerate}
 % \end{answers}
 % In the comment of answer 2, a wider vertical space is produced at line break
-% with the optional argument |\\[2ex]|\footnote{When a marginal note at the end of a page,
-% is followed by another one at the top of the next page,
-% the latter is shifted down.
-% We can raise this note, by adding at the line break
-% a negative vertical space : \texttt{\bs note*\{\bs\bs[-5ex] 2\}}.}.
+% with the optional argument |\\[2ex]|.
 % The last comment, not placed beside the number of points of answer 3,
 % has been produced by placing on the first line after the formula:
 % |\note{0.5 for $F'$\\1 for the sign of $F'$ and conclusion}|.
 %
-% \DescribeMacro{\note*}
-% If we don't want to add comment, we have the
-% |\note*|\marg{pts} command (better than |\note|\oarg{pts}|{}|),
-% used here in answer 3: |\note*{1.5}|.
-%
+% \medskip
 % \DescribeMacro{markingcolor} \DescribeMacro{\markingstyle} \DescribeMacro{\ptsboxlength}
-% The display color of the points, in |\totalexe| and |\note|,
+% The points display color, in |\totalexe| and |\note*|,
 % is defined by \texttt{markingcolor}
 % and the style by |\markingstyle|, which are modifiable.
 % The oval box produced by |\totalexe| is obtained with the |\ovalbox| command
-% of the \textsf{fancybox} package by Timothy Van Zandt,
+% of the \textsf{fancybox} package (by Timothy Van Zandt),
 % with corner arcs set by |\cornersize{1}|.
-% The box length is not adjusted to content but depends of the value
-% of |\ptsboxlength| in order to keep a uniform appearance
+% The length of the box is not adjusted to content but depends on the value
+% of |\ptsboxlength| in order to keep uniform appearance
 % from one exercise to the other.
 %
-% \DescribeMacro{notecolor} \DescribeMacro{\notestyle} \DescribeMacro{\noteragged}
+% \medskip
+% \DescribeMacro{notecolor} \DescribeMacro{\notestyle} 
 % Comment notes are typeset by default in a dark green color
 % defined by |\definecolor{notecolor}{rgb}{0.0,0.4,0.0}|.
-% The style of the comment is set by the |\notestyle| macro and itself uses the
-% |\noteragged| macro. The latter is set by default as |\raggedleft|
-% to obtain a \emph{right} alignment (what is customary for notes
-% in the left margin).
+% The style of the comment is set by the |\notestyle| macro.
+%
+% \subsection{Margin notes options} \label{margin}
+%
+% \DescribeMacro{[display=\meta{opt}]}
+% The \texttt{display} key option controls how the marking scheme
+% will be displayed: as seen previously (subsection \ref{pts}), 
+% \texttt{display=none} displays nothing. With \texttt{display=pts}
+% the numbers passed as argument to |\pts|, |\totalexe|, |\note*|
+% or as optional argument of |\note|\oarg{num}\texttt{\{...\}} will be displayed.
+% The last possible value is \texttt{display=notes} which displays the full marginal
+% notes with points and comments (the mandatory argument of |\note|)
+% as seen in the previous example.
+%
+% \medskip
+% \DescribeMacro{[marginpos=\meta{opt}]}
+% As seen previously in subsection \ref{pts}, the side where to place the scale is controlled 
+% by the \texttt{marginpos} key option
+% whose possible values are \texttt{left} and \texttt{right} 
+% (or \texttt{inner} and \texttt{outer} if the document is in two side mode).
+%
+% \medskip
+% \DescribeMacro{[marginwidth=\meta{opt}]}
+% The key option \texttt{marginwidth} controls margins layout. 
+% The possible values are
+% \texttt{standard}, \texttt{expand} or \texttt{unset}.
+%
+% This option has no effect when \texttt{display=none}.
+% In that case, left and right margins have same width,
+% except for a two side mode document for which the ratio between left and right
+% margin is 2:3. 
+% Otherwise the key \texttt{marginwidth} acts as follow:
+% \begin{description}
+% \item[\texttt{standard}] 
+% The left margin is enlarged and the 
+% right one is reduced, with a ratio of 3:2 (or 2:3 if \texttt{marginpos=left}).
+% The text body is shifted without altering the text width.
+% The margin paragraph width remains relatively short; it depends also on page geometry.
+% This option is not suitable for verbose comments.
 % 
-% \DescribeMacro{\displaypoints}
-% Display of points and comments is optional. It is internally controlled by the booleans
-% \texttt{marginpoints} and \texttt{marginfullnotes}.
-% The |\displaypoints| macro, to place in the preamble, sets  \texttt{marginpoints}
-% to \texttt{true}, chooses the left margin for display marginal notes
-% and sets the ratio between left and right margins to 3:2\footnote{So 
-% that the effect on the margin ratio is correct, the
-% \texttt{\bs displaypoints} macro must be placed after other commands 
-% that could alter the page geometry, for example the \texttt{\bs pagestyle}
-% of the \textsf{schooldocs} package.}.
-% Points will then be displayed without the comments.
+% \item[\texttt{expand}] It is the default value.
+% The behavior is the same than with the
+% \texttt{standard} value if \texttt{display=pts}, but if \texttt{display=notes}
+% the margin is expanded with a ratio of 3:1 (or 1:3) and margin paragraph width
+% is increased.
+%
+% \item[\texttt{unset}] The previous settings may not suit to anyone, 
+% so you have this other option.
+% In that case, no setting will be proceeded on the margin width and you
+% can make your own setting. For that, you have the convenient macro |\geometry|
+% from the \textsf{geometry} package (by Hideo Umeki).
+% For example you can put in the preamble 
+% \centeredline{|\geometry{hmarginratio=2:1,marginparwidth=2.5cm}|.}
+%
+% If \texttt{marginpos=right}, you must invert the ratio, \eg 1:2 instead of 2:1.
+% If \texttt{marginwidth} is not set to \texttt{unset}, 
+% such a command will have no effect.
+% \end{description}
+
+% The margin settings are valid
+% for the whole document and must be set in the preamble.
+%
+% \medskip
+% \DescribeMacro{[noteragged=\meta{opt}]}
+% For the mandatory argument of |\note|, text alignment in margins 
+% is controlled by the package option \texttt{noteragged},
+% which can take the following values: 
+% \texttt{left}, \texttt{right}, \texttt{center}, \texttt{justify} or \texttt{twoside}.
+% The default value is \texttt{noteragged=left}. It means that the text 
+% is right aligned, which is a common behavior for text in the left margin;
+% \texttt{noteragged=right} yields a left aligned text;
+% \texttt{justify} means that the text is justified, which is the default setting
+% of \LaTeX\ marginal notes. 
+% Finally \texttt{noteragged=twoside} is equivalent to \texttt{noteragged=left} for odd pages
+% and \texttt{noteragged=right} for even pages, if the document is in two side mode.
+% It has no effect otherwise (the default value \texttt{noteragged=left} will be taken
+% and a warning message appears in the shell).
+%
+% When \texttt{display} is not set to \texttt{notes}, the \texttt{noteragged} option
+% has no effect because it concerns only text put in mandatory argument of |\note|.
 % 
-% \DescribeMacro{\displaynotes} 
-% The |\displaynotes|\oarg{align} macro, to be placed also in the preamble,
-% defines both booleans to \texttt{true} and allows then the complete display 
-% of points and comments.
-% The ratio between left/right margins is then set to 5/1\footnote{The
-% present document kept a ratio of 3/2 because 
-% the \textsf{ltxdoc} class, used here, leaves large enough margins
-% and previous examples are not concerned with display of comments.}.
-% The optional parameter \meta{align} is used to define alignment:
-% |\raggedleft| by default, but we could use |\centering| or
-% |\raggedright| (not recommended in left margin).
+% \subsection{The \texttt{\bs totalpoints} command} \label{totalpoints}
 %
-% \DescribeMacro{\displaynotesright}
-% The |\displaynotesright|\oarg{align} macro displays a detailed marking scheme
-% with comments in the right margin, with the same type of settings 
-% as |\displaynotes| but an optional parameter \meta{align} set by default
-% to |\raggedleft|.
-%
-% \bigskip
 % \DescribeMacro{\totalpoints}
 % The |\totalpoints|\marg{num} macro is intended
 % to replace |\points| when using a detailed marking scheme.
-% When the scale is not displayed (\texttt{marginpoints} boolean to \texttt{false}),
-% it uses |\points| and when the scale is displayed,
-% it uses |\totalexe|.
+% When the scale is not displayed,
+% it is equivalent to |\points| and when the scale is displayed,
+% it is equivalent to |\totalexe|.
 % For example, in the exercise \ref{totalexe}, we should use
 % |\totalpoints| rather than |\totalexe|,
 % because, when the detailed marking scheme is not displayed, the total points will be typeset
 % as in the exercise \ref{points} rather than in the margin.
 %
+% \subsection{Marking scheme consistency checking}\label{scale}
 %
+% \DescribeMacro{[checkpts=\meta{bool}]}
+% The marking scheme can be checked
+% \footnote{Thanks to Denis Bitouzé for his suggestion about this feature.}
+% with the keyval option \texttt{[checkpts=true]},
+% the default value is \texttt{false}.
 %
+% \medskip
+% For each exercise, the sum of points awarded for each question (with |\pts|, |\note*|
+% or |\note[ ]| is compared to the total of the exercise given in 
+% |\points|, |\totalexe| or |totalpoints|.
+% A warning message appear in the shell to indicate if the scale is valid or not
+% for the exercise. For example:
+% \begin{center}
+% \texttt{Package exesheet warning: Exercise 3: sum of points is 4.5pt instead of 5pt.}
+% \end{center}
+% Depending on your language, you can use comma notation numbers (4,5 as well as 4.5).
+% The checking takes place at the beginning of the next exercise. If no points are specified
+% for the questions, no warning message will be displayed at this level.
+%
+% \medskip
+% \DescribeMacro{\totalsheet}
+% At the end of the sheet, the last exercise is checked, then a global checking
+% is made on the whole sheet. For that, the total points of the sheet must be specified
+% in the preamble with the |\totalsheet|\marg{total} macro
+% (else you get a warning message).
+% If subtotal points have been awarded for exercises, the global comparison
+% is between the sum of these subtotals and the total of points recorded
+% with the |\totalsheet| macro.
+% If not, the audit covers the sum of points awarded for each individual question.
+% A warning message indicates the result of this last checking.
+% Finally a last message indicate if all the scale controls have been successfully
+% passed or not.
+%
+% \section{Options} \label{options}
+%
+% \subsection{Summary of available options}
+%
+% Here we present a summary table of available options. Explanations of use
+% are given in the corresponding sections.
+% The default value is typeset in bold.
+%
+% \begin{center} \ttfamily
+% \setlength{\extrarowheight}{1pt}
+% \begin{tabular}{llc}
+% \hline
+% \textsf{Key} & \textsf{Possible values} & \textsf{See section} \\
+% \hline
+% exetoc & \textbf{true}, false & \ref{toc} \\
+% setlist & \textbf{true}, false & \ref{setlist} \\
+% output & questions, answers, \textbf{both} & \ref{output} \\
+% answerspace & true, \textbf{false} & \ref{answerspace}\\
+% display & \textbf{none}, pts, notes & \ref{pts}, \ref{margin} \\
+% marginpos & \textbf{left} (inner), right (\textbf{outer}) & \ref{pts}, \ref{margin} \\
+% marginwidth & standard, \textbf{expand}, unset &  \ref{margin} \\
+% noteragged & \textbf{left}, right, center, justify, twoside & \ref{margin} \\
+% checkpts & true, \textbf{false} & \ref{scale} \\
+% correct & true, \textbf{false}, conditional & \hyperlink{correct}{see below} \\
+% \hline
+% \end{tabular}
+% \end{center}
+%
+% When an invalid key is passed, an error is produced, but
+% when a value is not recognized, a warning message occur:\\
+% \texttt{Value `\meta{value}'\ is not supported by option `\meta{key}'\ 
+% on input line \ldots} \\
+% For each option, you can set them with class or package calling: \eg \\
+% |\usepackage[output=answers,display=notes,noteragged=right]{exesheet}|
+%
+% \bigskip
+% \DescribeMacro{\exesheetset}
+% You can also use the |\exesheetset|\{list of \meta{key}=\meta{value} options\}
+% command.
+% Nevertheless, only the options \texttt{output}, \texttt{answerspace}, \texttt{display}, 
+% and \texttt{noteragged}, 
+% can be changed dynamically, even in the document body, although this is not really expected.
+% The others are usable in the preamble only.
+% Dynamic options are processed at each call, the others will be processed once,
+% at begin document.
+% \hypertarget{correct}{}
+%
+% \bigskip
+% \DescribeMacro{[correct=\meta{opt}]} 
+% A special option, \texttt{correct}, can be used only when calling the \textsf{exesheet}
+% class or in combination with the \textsf{schooldocs} package.
+% Its effect is to add ``\correctname'' (or its translation)
+% in the document title and headers.
+% Possible values are: \texttt{true}, \texttt{false} (by default) or \texttt{conditional}.
+% The value \texttt{correct=conditional}, means \texttt{true} if answers are displayed,
+% \texttt{false} otherwise.
+%
+% \subsection{Alternative (deprecated) commands}
+% 
+% Previously to version 2.0, we used some special commands to set output and display options.
+% Thanks to a suggestion of Maxime Chupin, keyval options have been implemented 
+% in the package.
+% Although the latter is more convenient,
+% the old commands will be presented here
+% and maintained for now, for compatibility reasons.
+% When using them, a warning message will appear, but these commands still work.
+% However previous options \texttt{nosetlist} and \texttt{notoc}
+% are no longer supported.
+%
+% \bigskip
+% \DescribeMacro{\questionsonly} \DescribeMacro{\answersonly}
+% These two commands are equivalent to respectively \texttt{output=questions} 
+% and \texttt{output=answers}.
+%
+% \medskip
+% \DescribeMacro{\displaypts} \DescribeMacro{\displaypoints} 
+% These two commands are now equivalent to \texttt{display=pts}.
+%
+% \medskip
+% \DescribeMacro{\displaynotes}\DescribeMacro{\displaynotesright}
+% These two commands mean \texttt{display=notes}
+% and moreover \texttt{marginpos=right} for the latter.
+%
 % \StopEventually{}
 %
 % \section{Implementation}
 %
-% \subsection{Class and package basic instructions}
+% \subsection{Options and required packages}
 % The \texttt{exesheet} class is based on the \texttt{article} class
-% and gives it all its options, except explicit options 
-% \texttt{notoc} and \texttt{nosetlist}.
-%
+% and passes to it all its unknown options.
+% |\ProcessKeyvalOptions*| is useless in class, will be done by the package.
 %    \begin{macrocode}
 %<*class>
-\DeclareOption{notoc}{\PassOptionsToPackage{notoc}{exesheet}}
-\DeclareOption{nosetlist}{\PassOptionsToPackage{nosetlist}{exesheet}}
+\RequirePackage{kvoptions}
+\DeclareBoolOption[true]{exetoc}
+\DeclareBoolOption[true]{setlist}
+\DeclareStringOption[both]{output}
+\DeclareStringOption[none]{display}
+\DeclareBoolOption[false]{answerspace}
+\DeclareStringOption[left]{marginpos}
+\DeclareStringOption[expand]{marginwidth}
+\DeclareStringOption[left]{noteragged}
+\DeclareBoolOption[false]{checkpts}
+\DeclareStringOption[false]{correct}
 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
 \ProcessOptions \relax
 \LoadClass{article}
@@ -866,33 +1145,93 @@
 %</class>
 %    \end{macrocode}
 %
-% Then we define initialization instructions of the \textsf{exesheet} package.
+% Then options are defined thanks to \textsf{kvoptions} package (based on \textsf{keyval}).
+% String options are processed in separate macros 
+% defined in the corresponding sections of each.
+% These process macros will be executed when package is loaded
+% (at end of package because |\exs at process...| aren't recognized at the beginning),
+% or at begin document for options whose
+% effect cannot be changed dynamically
+% and must be set in the preamble
+% (they will be processed once).
 %
-% \medskip
-%  The \texttt{shortlabel} option in the \textsf{enumitem} package allows to use labels like in 
-% the \textsf{enumerate} package e.g. 1., a), A. etc.
-%
+% A special case is \texttt{setlist} when used with \textsf{babel-french}.
+% It will then be processed immediately and disabled (see below for explanations).
+% 
 %    \begin{macrocode}
 %<*package>
+\@ifclassloaded{exesheet}{}{
+    \RequirePackage{kvoptions}
+    \DeclareBoolOption[true]{exetoc}
+    \DeclareBoolOption[true]{setlist} 
+    \DeclareStringOption[both]{output}
+    \DeclareStringOption[none]{display}
+    \DeclareBoolOption[false]{answerspace}
+    \DeclareStringOption[left]{marginpos}
+    \DeclareStringOption[expand]{marginwidth}
+    \DeclareStringOption[left]{noteragged}
+    \DeclareBoolOption[false]{checkpts}
+    \DeclareStringOption[false]{correct}
+}
+
+\ProcessKeyvalOptions*
+
+\def\exs at process@dynoptions{
+    \exs at process@output
+    \exs at process@display 
+    \exs at process@noteragged
+}
+
+\AtEndOfPackage{\exs at process@dynoptions}
+\AtBeginDocument{
+    \newif\ifexesheet at multicol
+    \@ifpackageloaded{multicol}{
+        \exesheet at multicoltrue}{\exesheet at multicolfalse}
+        % to set the rule to the right color in answers environments
+    \exs at process@setlist
+    \exs at process@marginpos
+    \exs at process@marginwidth
+    \exs at process@checkpts
+    \exs at process@correct
+    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{setlist}
+    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{marginpos}
+    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{marginwidth}
+    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{checkpts}
+    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{correct}
+}
+
+%    \end{macrocode}
+% \begin{macro}{\exesheetset}
+% The macro |\exesheetset| can receive keyval options.
+% It can be used anywhere in the document to modify some settings,
+% but has no effect on non dynamic options if called outside the preamble;
+% thanks to |\DisableKeyValOption| a warning message occur in that case.
+%    \begin{macrocode}  
+\def\exesheetset#1{\setkeys{exesheet}{#1}\exs at process@dynoptions}
+
+%    \end{macrocode}
+% \end{macro}
+% Now we load several packages.
+% The \texttt{shortlabel} option in the \textsf{enumitem} package allows to use labels like in 
+% the \textsf{enumerate} package \eg 1., a), A. etc.
+% The \textsf{mparhack} package (by Tom Sgouros and Stefan Ulrich)
+% is loaded only for two side mode documents.
+%    \begin{macrocode}
 \RequirePackage{ifthen}
-\newboolean{notoc}
-\newboolean{nosetlist}
-\DeclareOption{notoc}{\setboolean{notoc}{true}}
-\DeclareOption{nosetlist}{\setboolean{nosetlist}{true}}
-\ProcessOptions \relax
+\RequirePackage{geometry}
 \RequirePackage{xcolor}
 \RequirePackage[shortlabels]{enumitem}
 \RequirePackage{tasks}
 \RequirePackage{versions}
-%\@ifpackageloaded{doc}{}{\RequirePackage{verbatim}}
-\RequirePackage{geometry}
 \RequirePackage{fancybox}
 \RequirePackage{translations}
+\RequirePackage{ragged2e}
+\ifthenelse{\boolean{@twoside}}{\RequirePackage{mparhack}}{}
 
 %    \end{macrocode}
 %
 % \subsection{Internationalization}
-% Here we define the keywords and their translation in French, German, Spanish
+% Here we define keywords and their translation in French, German, Spanish
 % Italian, Portuguese, thanks to macros of the \textsf{translations} package 
 % by Clemens Niederberger. It detects the used language 
 % loaded by \textsf{babel} or \textsf{polyglossia}.
@@ -899,7 +1238,7 @@
 %
 % Accented characters cannot be used here because they are not recognized 
 % if \textsf{inputenc} is loaded after \textsf{exesheet}.
-% So we have used the basic \LaTeX\ commands to produce them.
+% So we have used basic \LaTeX\ control sequences to produce them.
 %
 %    \begin{macrocode}
 \DeclareTranslationFallback{exesheet-exercise}{Exercise}
@@ -939,8 +1278,8 @@
 \DeclareTranslation{German}{exesheet-points}{Punkte}
 \DeclareTranslation{German}{exesheet-point}{Punkt}
 \DeclareTranslation{German}{exesheet-correction}{Verbesserung}
-\DeclareTranslation{German}{exesheet-pts}{Pkte}
-\DeclareTranslation{German}{exesheet-pt}{Pkt}
+\DeclareTranslation{German}{exesheet-pts}{P.}
+\DeclareTranslation{German}{exesheet-pt}{P.}
 
 \DeclareTranslation{Spanish}{exesheet-exercise}{Ejercicio}
 \DeclareTranslation{Spanish}{exesheet-subpart}{Parte}
@@ -984,27 +1323,12 @@
 
 %    \end{macrocode}
 %
-% \subsection{Colors}
-% The color \texttt{pointscolor} is used by the macro |\points| 
-% and \texttt{markingcolor} by the macros |\totalexe|, |\note*| 
-% and also for the optional argument of |\note|;
-% \texttt{notecolor} is used by the mandatory argument of |\note|.
+% \subsection{Titles}
 %
-%    \begin{macrocode}
-\definecolor{pointscolor}{named}{red}
-\definecolor{ptscolor}{named}{red}
-\definecolor{markingcolor}{named}{red}
-\definecolor{notecolor}{rgb}{0.0, 0.4, 0.0} % kind of dark green
-\definecolor{correctioncolor}{rgb}{0,0.2,0.6} % kind of dark blue
-
-%    \end{macrocode}
-%
-% \medskip
-% \subsection{Titles}
 % The \texttt{exercise} counter numbers exercises for the whole document 
 % regardless of any section.
 % To reset the counter at some point, just write |\setcounter{exercise}{0}|
-% and if we want an automatic reset at each section,
+% and for an automatic reset at each section,
 % add in the preamble \\
 % |\makeatletter \@addtoreset{exercise}{section} \makeatother|.
 %
@@ -1011,34 +1335,39 @@
 % The parts counter depends on \texttt{exercise} and is reset
 % at each new exercise.
 %
-% The |\labelexercisestyle| and |\labelsubpartstyle| commands
-% are empty, but allow to customize the style, for instance:\\
+% Commands |\labelexercisestyle| and |\labelsubpartstyle|
+% are empty, but allow to personalize the style, for instance:\\
 % |\renewcommand\labelexercisestyle{\sffamily}|.
 %
-% By default, the table of contents displays the titles of exercises and parts.
-% The \texttt{notoc} boolean is used to modify this behavior.
-% If we want to display only exercise titles but not parts,
-% we can place in the preamble |\setcounter{tocdepth}{2}|.
+% The |\exe at check| macro checks the marking scheme, it will be defined
+% in section \ref{MSoptions}.
+% By default, the table of contents displays the titles of exercises and parts,
+% |\ifexesheet at exetoc| is \texttt{true}.
+% To display in it only exercise titles but not parts,
+% place in the preamble |\setcounter{tocdepth}{2}|.
 %
 % \begin{macro}{\exercise}
 %    \begin{macrocode}
 \newcounter{exercise}
 
-\newcommand{\labelexercise}{\exercisename~\theexercise}
+\newcommand{\labelexercise}{\exercisename\space \theexercise}
 \newcommand{\labelexercisestyle}{}
-\newcommand*{\@exercise}[1][]{%     
+\newcommand*{\@exercise}[1][]{%
+    \ifexesheet at checkpts \exe at check{\labelexercise} \fi
+    % curiously the \execheck must be done before \refstepcounter !
     \refstepcounter{exercise}
-    \subsection*{\labelexercisestyle\labelexercise\ #1}
-    \ifthenelse{\boolean{notoc}}{}{
+    \subsection*{\labelexercisestyle\labelexercise\enskip #1}
+    \ifexesheet at exetoc
         \addcontentsline{toc}{subsection}{\labelexercise}
-    }
+    \fi
 }
 \newcommand*{\@@exercise}[2][]{%
-    \subsection*{\labelexercisestyle #2 #1}
+    \ifexesheet at checkpts \exe at check{#2} \fi
+    \subsection*{\labelexercisestyle #2\enskip #1}
     \setcounter{subpart}{0} % resets the parts counter
-    \ifthenelse{\boolean{notoc}}{}{
+    \ifexesheet at exetoc
         \addcontentsline{toc}{subsection}{#2}
-    }
+    \fi
 }
 \newcommand{\exercise}{\@ifstar{\@@exercise}{\@exercise}}
 
@@ -1052,17 +1381,17 @@
 \newcommand{\labelsubpart}{\subpartname~\thesubpart}
 \newcommand{\labelsubpartstyle}{}
 \newcommand*{\@subpart}[1][]{%
-    \refstepcounter{subpart}%    
-    \subsubsection*{\labelsubpartstyle\labelsubpart\ #1}
-    \ifthenelse{\boolean{notoc}}{}{
+    \refstepcounter{subpart}%
+    \subsubsection*{\labelsubpartstyle\labelsubpart\enskip #1}
+    \ifexesheet at exetoc
         \addcontentsline{toc}{subsubsection}{\labelsubpart}
-    }
+    \fi
 }
 \newcommand*{\@@subpart}[2][]{%
-    \subsubsection*{\labelsubpartstyle #2 #1}
-    \ifthenelse{\boolean{notoc}}{}{
+    \subsubsection*{\labelsubpartstyle #2\enskip #1}
+    \ifexesheet at exetoc
         \addcontentsline{toc}{subsubsection}{#2}
-    }
+    \fi
 }
 \newcommand{\subpart}{\@ifstar{\@@subpart}{\@subpart}}
 
@@ -1073,9 +1402,9 @@
 \newcommand{\annexstyle}{\MakeUppercase}
 \newcommand*{\annex}[1][]{%
     \subsection*{\mbox{}\hfill\annexstyle{\annexname} #1\hfill\mbox{}}
-    \ifthenelse{\boolean{notoc}}{}{
+    \ifexesheet at exetoc
         \addcontentsline{toc}{subsection}{\annexname}
-    }
+    \fi
 }
 
 %    \end{macrocode}
@@ -1092,87 +1421,59 @@
 
 %    \end{macrocode}
 % \end{macro}
-% \begin{macro}{\points (ini)}
-%    \begin{macrocode}    
-\newcommand{\pointsstyle}{%
-    \small\mdseries\sffamily\color{pointscolor}\fbox}
-\newcommand*{\points}[1]{\hfill
-    \pointsstyle{#1~%
-        \ifthenelse{\lengthtest{#1 cm < 2cm}}{\pointname}{\pointsname}%
-    }
-}
-
-%    \end{macrocode}
-% Percent symbols are necessary to avoid spaces between the
-% |\fbox| and its inner text.
-% Note that, without |\lengthtest|, the test |#1 < 2| doesn't work with decimal numbers.
-% % \end{macro}
 %
 % \subsection{Enumerations and lists}
 %
-% When using \textsf{babel} with the \texttt{french} option\footnote{The \texttt{french} option
-% of \textsf{babel} supersedes the \texttt{frenchb} option.},
+% \begin{macro}{\exenumerate}
+% The |\setlist| command comes from the \textsf{enumitem} package
+% (|\setenumerate| is obsolete). By default |itemsep=1ex| for lists of first level,
+% and |leftmargin=1.5em| allows to align labels on the start of lines.
+%    \begin{macrocode}
+\newenvironment{exenumerate}[1][]{%
+    \setlist[enumerate]{font=\bfseries}
+    \setlist[enumerate,1]{leftmargin=1.5em,
+        itemsep=3ex plus 1ex minus 1ex,topsep=3ex plus 1ex minus 1ex}
+    \setlist[enumerate,3]{noitemsep,nolistsep}
+    \setlist[itemize]{noitemsep,nolistsep}
+    \begin{enumerate}[#1]
+        }{\end{enumerate}}
+
+%    \end{macrocode}
+% \end{macro}
+% When using \textsf{babel} with the option \texttt{french},
 % \texttt{itemize} lists are modified with the same dash label for each list level. 
 % These modifications are canceled here to restore default 
 % \LaTeX\ \texttt{itemize} lists (labels and spaces).
-% As for |\exetranslate|,
-% we have create the |\standardfrenchlists| command who must be called into
+% We have create the |\standardfrenchlists| command which must be called into
 % |AtBeginDocument| or not, depending on whether
 % \textsf{exesheet} is loaded before \textsf{babel} or after.
-%
-% The |\setlist| command comes from the \textsf{enumitem} package
-% (|\setenumerate| is deprecated). By default |itemsep=1ex| for lists of first level,
-% and |leftmargin=1.5em| allows to align labels on the start of lines.
-%
 %    \begin{macrocode}
 \newcommand\standardfrenchlists{%
-    \@ifpackagewith{babel}{frenchb}{
-        \frenchbsetup{StandardLists=true}}{}
     \@ifpackagewith{babel}{french}{
-        \@ifundefined{frenchsetup}{
-            \frenchbsetup{StandardLists=true}}{
-            \frenchsetup{StandardLists=True}}
+        \frenchsetup{StandardLists=true}
     }{}
 }
-\ifthenelse{\boolean{nosetlist}}{}{
-    \AtBeginDocument{% if loaded before babel package
-        \standardfrenchlists}
-    \standardfrenchlists % necessary when loaded after babel
+\ifexesheet at setlist
+    \standardfrenchlists % necessary when exesheet is loaded after babel
+    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{setlist}
+\fi
+
+\def\exs at process@setlist{% must be executed at begin document
+  \ifexesheet at setlist
+    \standardfrenchlists % if exesheet is loaded before babel package
     \setlist[enumerate]{font=\bfseries}
     \setlist[enumerate,1]{topsep=1.5ex plus 1ex minus 1ex,leftmargin=1.5em}
-}
-
+  \fi
 %    \end{macrocode}
-% \begin{macro}{\exenumerate}
-%    \begin{macrocode}
-\newenvironment{exenumerate}[1][]{%
-    \setlist[enumerate]{font=\bfseries}
-    \setlist[enumerate,1]{leftmargin=1.5em,
-        itemsep=3ex plus 1ex minus 1ex,topsep=3ex plus 1ex minus 1ex}
-    \setlist[enumerate,3]{noitemsep,nolistsep}
-    \setlist[itemize]{noitemsep,nolistsep}
-    \begin{enumerate}[#1]
-        }{\end{enumerate}}
 
-%    \end{macrocode}
-% \end{macro}
 % \DescribeEnv{tablenum1} \DescribeEnv{tablenuma}
 % The |\NewTasks| command comes from the \textsf{tasks} package.
-% It allows to define the environments \texttt{tablenum1}, \texttt{tablenuma}
+% It allows to define environments \texttt{tablenum1}, \texttt{tablenuma}
 % and \texttt{tablitem}.
-% The horizontal spaces are adjusted to get a good alignment with
+% Horizontal spaces are adjusted to get good alignments with
 % items of other \texttt{enumerate} (or \texttt{itemize}) environments.
-%
 %    \begin{macrocode}
-\ifthenelse{\boolean{nosetlist}}{
-    \NewTasksEnvironment[label=\arabic*.,
-        column-sep=1em,
-        after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2)
-    \NewTasksEnvironment[label=(\alph*),
-        column-sep=1em,label-align=right,
-        item-indent=2.15em,label-width=1.6em,label-offset=0.5em,
-        after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2)
-}{% by default
+  \ifexesheet at setlist
     \NewTasksEnvironment[label=\arabic*.,label-format=\bfseries,
         column-sep=1em,label-align=right,
         item-indent=1.5em,label-width=1em,label-offset=0.5em,
@@ -1181,8 +1482,16 @@
         column-sep=1em,label-align=right,
         item-indent=2.15em,label-width=1.6em,label-offset=0.5em,
         after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2)
-}
-\PackageWarning{exesheet}{Environment tablenum is deprecated and replaced by tablenum1}
+  \else
+    \NewTasksEnvironment[label=\arabic*.,
+        column-sep=1em,
+        after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2)
+    \NewTasksEnvironment[label=(\alph*),
+        column-sep=1em,label-align=right,
+        item-indent=2.15em,label-width=1.6em,label-offset=0.5em,
+        after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2)
+  \fi
+} % end of macro \exs at process@setlist
 
 %    \end{macrocode}
 % \DescribeEnv{tablitem}
@@ -1193,46 +1502,52 @@
     after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablitem}[\item](2)
 
 %    \end{macrocode}
-% \DescribeEnv{colsenum} \DescribeEnv{colsenum*}
+% \DescribeEnv{colsenum}
 %    \begin{macrocode}
 \newenvironment{colsenum}[2][]{%
     \setlength{\multicolsep}{2ex}
     \raggedcolumns % default is \flushcolumns
     \begin{multicols}{#2} % #2 = number of columns
-        \begin{enumerate}[#1] % #1 = options of enumerate
-            }{
-        \end{enumerate}
+    \begin{enumerate}[#1] % #1 = options of enumerate
+    }{
+    \end{enumerate}
     \end{multicols}
 }
 
+%    \end{macrocode}
+% \DescribeEnv{colsenum*}
+%    \begin{macrocode}
 \newenvironment{colsenum*}[2][]{%
     \setlength{\multicolsep}{2ex}
     \begin{multicols}{#2} % #2 = number of columns
-        \begin{enumerate}[#1] % #1 = options of enumerate
-            }{
-        \end{enumerate}
+    \begin{enumerate}[#1] % #1 = options of enumerate
+    }{
+    \end{enumerate}
     \end{multicols}
 }
 
 %    \end{macrocode}
-% \DescribeEnv{colsitem} \DescribeEnv{colsitem*}
+% \DescribeEnv{colsitem}
 %    \begin{macrocode}
 \newenvironment{colsitem}[2][]{%
     \setlength{\multicolsep}{2ex}
     \raggedcolumns
     \begin{multicols}{#2}
-        \begin{itemize}[#1]
-            }{
-        \end{itemize}
+    \begin{itemize}[#1]
+    }{
+    \end{itemize}
     \end{multicols}
 }
 
+%    \end{macrocode}
+% \DescribeEnv{colsitem*}
+%    \begin{macrocode}
 \newenvironment{colsitem*}[2][]{%
     \setlength{\multicolsep}{2ex}
     \begin{multicols}{#2}
-        \begin{itemize}[#1]
-            }{
-        \end{itemize}
+    \begin{itemize}[#1]
+    }{
+    \end{itemize}
     \end{multicols}
 }
 
@@ -1240,29 +1555,41 @@
 %
 % \subsection{Questions and answers}
 %
-% \DescribeMacro{\questionsonly} \DescribeMacro{\answersonly}
-% The \texttt{questions} and \texttt{answers} booleans
+% \begin{macro}{\exs at process@output}
+% |exesheet at questions| and |exesheet at answers| booleans
 % control the display of corresponding environments.
-% When created, a boolean has the \texttt{false} value by default,
-% but we define them to \texttt{true}.
-% The |\questionsonly| and |\answersonly| macros are used as user interface
-% to display only one of the two environments.
+% They are set by the \texttt{output} key option in the
+% |\exs at process@output| macro.
 %    \begin{macrocode}
-\newboolean{questions}
-\newboolean{answers}
-\setboolean{questions}{true}
-\setboolean{answers}{true}
-\newcommand{\questionsonly}{
-    \setboolean{questions}{true}\setboolean{answers}{false}}
-\newcommand{\answersonly}{
-    \setboolean{questions}{false}\setboolean{answers}{true}}
+\newboolean{exesheet at questions}\setboolean{exesheet at questions}{true}
+\newboolean{exesheet at answers}\setboolean{exesheet at answers}{true}
 
+\def\exs at process@output{
+    \ifthenelse{\equal{\exesheet at output}{questions}}{
+        \setboolean{exesheet at questions}{true}
+        \setboolean{exesheet at answers}{false}
+    }{% else if
+    \ifthenelse{\equal{\exesheet at output}{answers}}{
+        \setboolean{exesheet at questions}{false}
+        \setboolean{exesheet at answers}{true}
+    }{% else if
+    \ifthenelse{\equal{\exesheet at output}{both}}{
+        \setboolean{exesheet at questions}{true}
+        \setboolean{exesheet at answers}{true}
+    }{% else
+    \PackageWarning{exesheet}{Value `\exesheet at output'
+         is not supported by option `output'}
+    }}}
+}
+
 %    \end{macrocode}
+% \end{macro}
 %
 % \begin{environment}{questions}
-% It is the |\comment| and |\endcomment| macros, provided by the  \textsf{versions} package,
+% We use the \textsf{versions} package  by Uwe Lück
+% who provides |\comment| and |\endcomment| macros, 
 % that allow the magic of conditional displays (we can also find them 
-% in the \textsf{verbatim} or \textsf{version} packages).
+% in \textsf{verbatim} or \textsf{version} packages).
 % The noteworthy \textsf{codesection} package, allows to encapsulate 
 % optional code between the macros |\BeginCodeSection|\marg{skip} 
 % and |\EndCodeSection|\marg{skip},
@@ -1269,26 +1596,32 @@
 % both in the text body and in the preamble,
 % but these macros cannot be used inside an environment 
 % as we did here for |\comment| and |\endcomment|.
+%
+% Some tests are made by |\ifthenelse{\bolean{...}}|
+% because |\comment| and |\endcomment| causes some hassle 
+% with the \TeX\ structure |\if| \ldots |\else| \ldots |\fi|.
+% The two counters |exe at ini| and |subpart at ini| are used in
+% the following |\set at toclevel| macro.
 %    \begin{macrocode}
 \newcounter{exe at ini}
 \newcounter{subpart at ini}
 
 \newenvironment{questions}{
-    \ifthenelse{\boolean{questions}}{
+    \ifthenelse{\boolean{exesheet at questions}}{%
         \setcounter{exe at ini}{\value{exercise}}
         \setcounter{subpart at ini}{\value{subpart}}
-    }{\comment}}%
-{\ifthenelse{\boolean{questions}}{}{\endcomment}}
+    }{\comment}
+}{\ifthenelse{\boolean{exesheet at questions}}{}{\endcomment}}
 
 %    \end{macrocode}
 % \end{environment}
 % \begin{environment}{answers}
-% The internal macro |\set at toclevel| calculates the title level
-% of the word \emph{\correctionname} to display at the start of an
+% The internal macro |\set at toclevel| calculates the title level (counter |toc at level|)
+% to get a correct typesetting of the word ``\correctionname'' at the start of an
 % \texttt{answers} environment (when \texttt{questions} and \texttt{answers} are
-% displayed together). The principle is to compare the state of the counters
+% displayed together). The principle is to compare the state of counters
 % \texttt{exercise} and \texttt{subpart} with those saved at the time of
-% the call of \texttt{questions}. The |\@enumdepth| counter indicates the 
+% the call of the \texttt{questions} environment. The |\@enumdepth| counter indicates the 
 % \texttt{enumerate} list level in which we are (0 = out of lists).
 % The optional parameter of the \texttt{answers} environment allows to force this title level.
 %    \begin{macrocode}
@@ -1297,107 +1630,496 @@
     \ifthenelse{\equal{#1}{}}{
         \ifthenelse{\value{exercise} > \value{exe at ini}}{
             \setcounter{@toclevel}{1}
-        }{\ifthenelse{\equal{\the\@enumdepth}{0}}{
-                % we're not in an enumerate environment
-                \ifthenelse{\(\value{subpart} > \value{subpart at ini}\)
-                    \or \(\value{subpart} = 0\)}{
-                    \setcounter{@toclevel}{2}
-                }{\setcounter{@toclevel}{3}}
-            }{\setcounter{@toclevel}{4}}}
+        }{% else
+        \ifthenelse{\equal{\the\@enumdepth}{0}}{
+            % we're not in an enumerate environment
+            \ifthenelse{\(\value{subpart} > \value{subpart at ini}\)
+                \or \(\value{subpart} = 0\)}{
+              \setcounter{@toclevel}{2}
+            }{\setcounter{@toclevel}{3}}
+        }{\setcounter{@toclevel}{4}}}
     }{\setcounter{@toclevel}{#1}}}
 
+%    \end{macrocode}
+% The internal macro |\typeset at correctionname|,
+% typesets the word ``\correctionname'' at the right level.
+%    \begin{macrocode}
+\definecolor{correctioncolor}{rgb}{0,0.2,0.6} % kind of dark blue
 \newcommand{\correctionstyle}{\color{correctioncolor}}
 
+\newcommand{\typeset at correctionname}{
+    \ifthenelse{\value{@toclevel} = 1}{
+        \section*{\correctionstyle\correctionname}
+        \ifexesheet at exetoc
+            \addcontentsline{toc}{section}{\correctionname}
+        \fi
+        \setcounter{exercise}{0}
+    }{% else if
+    \ifthenelse{\value{@toclevel} = 2}{%
+        \subsection*{\correctionstyle\correctionname}
+        \ifexesheet at exetoc
+            \addcontentsline{toc}{subsection}{\correctionname}
+        \fi
+        \setcounter{subpart}{0}
+    }{% else if
+    \ifthenelse{\value{@toclevel} = 3}{%
+        \subsubsection*{\correctionstyle\correctionname}
+        \ifexesheet at exetoc
+            \addcontentsline{toc}{subsubsection}{\correctionname}
+        \fi
+    }{% else
+    \par\textbf{\correctionstyle\correctionname}\par
+    }}}
+}
+
+%    \end{macrocode}
+% Then we can write the \texttt{answers} environment.
+%    \begin{macrocode}
 \newenvironment{answers}[1][]{% #1 is the optional level
-    \ifthenelse{\boolean{answers}}{%
-        \ifthenelse{\boolean{questions}}{%
+    \ifthenelse{\boolean{exesheet at answers}}{%
+        \ifthenelse{\boolean{exesheet at questions}}{
             \set at toclevel[#1]
-            \ifthenelse{\value{@toclevel} = 1}{
-                \section*{\correctionstyle\correctionname}
-                \ifthenelse{\boolean{notoc}}{}{
-                    \addcontentsline{toc}{section}{\correctionname}}
-                \setcounter{exercise}{0}
-            }{\ifthenelse{\value{@toclevel} = 2}{%
-                    \subsection*{\correctionstyle\correctionname}
-                    \ifthenelse{\boolean{notoc}}{}{
-                        \addcontentsline{toc}{subsection}{\correctionname}}
-                    \setcounter{subpart}{0}
-                }{\ifthenelse{\value{@toclevel} = 3}{%
-                        \subsubsection*{\correctionstyle\correctionname}
-                        \ifthenelse{\boolean{notoc}}{}{
-                            \addcontentsline{toc}{subsubsection}{
-                                \correctionname}}
-                    }{\par\textbf{\correctionstyle\correctionname}\par
-                    }%
-                }%
-            }%
+            \typeset at correctionname
             \correctionstyle%
-        }{}%
+            \ifexesheet at multicol
+                \renewcommand{\columnseprulecolor}{\color{correctioncolor}}
+            \fi
+        }{}
     }{\comment}
-}{\ifthenelse{\boolean{answers}}{}{\endcomment}}
+}{\ifthenelse{\boolean{exesheet at answers}}{}{\endcomment}}
 
-\newenvironment{answers*}{\ifthenelse{\boolean{answers}}{}{\comment}}%
-{\ifthenelse{\boolean{answers}}{}{\endcomment}}
+\newenvironment{answers*}{
+    \ifthenelse{\boolean{exesheet at answers}}{}{\comment}
+}{\ifthenelse{\boolean{exesheet at answers}}{}{\endcomment}}
 
 %    \end{macrocode}
-% In the \texttt{answers} environment, if we place |\correctionstyle|
-% before |\subsubsection|, the preceding vertical space may be too wide.
+% In the \texttt{answers} environment, when placing |\correctionstyle|
+% before |\subsubsection| (case of |\typeset at correctionname|),
+% the preceding vertical space may be too wide.
+% \end{environment}
 %
-% \end{environment}
 % \begin{macro}{\question}
 %    \begin{macrocode}
-\newcommand{\question}[2]{%
-    \ifthenelse{\boolean{questions}}{#1}{}
-    \bgroup
-    \ifthenelse{\boolean{answers}}{
-        \ifthenelse{\boolean{questions}}{
-            \ifx#2\empty\else
-                \par\correctionstyle\textbf{\correctionname}\par
+\newcommand{\question}[1]{\ifexesheet at questions #1\fi}
+
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\answer}
+%    \begin{macrocode}
+\newcommand{\answer}[1]{%
+    \ifexesheet at answers%
+        \ifexesheet at questions \correctionstyle #1\else #1\fi
+    \fi
+}
+
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\answerspace}
+% The \texttt{answerspace} macro was a suggestion of Maxime Chupin
+% to permit students to write answers on the given paper.
+%    \begin{macrocode}
+\newcommand\answerspace[1]{
+    \ifexesheet at answerspace \par\vspace{#1} \fi}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsection{Marking scheme options processing} \label{MSoptions}
+%
+% Options \texttt{display}, \texttt{marginpos}, \texttt{marginwidth} 
+% and \texttt{noteragged} are processed with the following internal commands.
+%
+% \medskip
+% The \texttt{display} key option sets the value of the two booleans
+% |exesheet at pts| and |exesheet at notes|. 
+% |exesheet at pts| controls the display of the content of |\pts| and of optional arguments
+% of |\note|,
+% whereas |exesheet at notes| controls mandatory arguments of |\note|.
+%
+% \begin{macro}{\exs at process@display}
+%    \begin{macrocode}
+\newboolean{exesheet at pts}
+\newboolean{exesheet at notes}
+
+\def\exs at process@display{
+    \ifthenelse{\equal{\exesheet at display}{pts}}{
+        \setboolean{exesheet at pts}{true}
+        \setboolean{exesheet at notes}{false}
+    }{% else if
+    \ifthenelse{\equal{\exesheet at display}{notes}}{
+        \setboolean{exesheet at pts}{true}
+        \setboolean{exesheet at notes}{true}
+    }{% else if
+    \ifthenelse{\equal{\exesheet at display}{none}}{
+        \setboolean{exesheet at pts}{false}
+        \setboolean{exesheet at notes}{false}
+    }{% else
+    \PackageWarning{exesheet}{Value `\exesheet at display'
+         is not supported by option `display'}
+    }}}
+}
+
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\exs at process@marginpos}
+% The \texttt{marginpos} key option takes value \texttt{left} (the default) or \texttt{right}
+% (or \texttt{inner} and \texttt{outer}). In practice \texttt{inner} is equivalent to
+% \texttt{left}
+% but, in two side mode, \texttt{left} (the default value) or \texttt{right} 
+% are converted to \texttt{outer} (the default value for two side mode).
+%    \begin{macrocode}
+\newboolean{exesheet at leftmargin}
+
+\def\exs at process@marginpos{
+    \ifthenelse{\equal{\exesheet at marginpos}{left}}{
+        \if at twoside%
+            \PackageWarningNoLine{exesheet}{Default `marginpos' option
+                \MessageBreak
+                for two side documents is `outer'.\MessageBreak
+                Use `inner' to change the side}
+            \def\exesheet at marginpos{outer}
+            \setboolean{exesheet at leftmargin}{false}
+            \normalmarginpar
+        \else% default
+            \setboolean{exesheet at leftmargin}{true}
+            \reversemarginpar
+        \fi
+    }{% else if
+    \ifthenelse{\equal{\exesheet at marginpos}{right}}{
+        \if at twoside%
+            \PackageWarningNoLine{exesheet}{Default `marginpos' option
+                \MessageBreak
+                for two side documents is `outer'.\MessageBreak
+                Use `inner' to change the side}
+            \def\exesheet at marginpos{outer}
+        \fi
+        \setboolean{exesheet at leftmargin}{false}
+        \normalmarginpar
+    }{% else if
+    \ifthenelse{\equal{\exesheet at marginpos}{inner}}{
+        \setboolean{exesheet at leftmargin}{true}
+        \reversemarginpar
+    }{% else if
+    \ifthenelse{\equal{\exesheet at marginpos}{outer}}{
+        \setboolean{exesheet at leftmargin}{false}
+        \normalmarginpar
+    }{% else
+    \PackageWarningNoLine{exesheet}{Value `\exesheet at marginpos'
+         is not supported by option `marginpos'}
+    }}}}
+}
+
+%    \end{macrocode}
+% \end{macro}
+% \begin{macro}{\exs at process@marginwidth}
+% The \texttt{marginwidth} option changes the ratio between left and right margins
+% depending on what has to be displayed in the margin (only points or full 
+% notes)
+% \footnote{So that the effect on the margin ratio is correct, this option is processed
+% at begin document, after other commands 
+% that also could alter page geometry.}.
+%
+% When \texttt{display=notes}, the additional length \texttt{1\,in} matches 
+% the default free space to the left of |\oddsidemargin|.
+%
+% The macros |\standardmarginwidthfactor| and |\largemarginwidthfactor|
+% represent the ratio between total margin width and |\marginparwidth|.
+%
+%    \begin{macrocode}
+\def\standardmarginwidthfactor{0.6}
+\def\largemarginwidthfactor{0.8}
+
+\newcommand*{\leftnotemarginwidth}[1]{
+    \setlength{\marginparwidth}{\oddsidemargin}
+    \addtolength{\marginparwidth}{1in}
+    \addtolength{\marginparwidth}{-\marginparsep}
+    \setlength{\marginparwidth}{#1\marginparwidth}
+}
+
+\newcommand*\rightnotemarginwidth[1]{
+    \setlength{\marginparwidth}{\paperwidth}
+    \addtolength{\marginparwidth}{-\textwidth}
+    \addtolength{\marginparwidth}{-\oddsidemargin}
+    \addtolength{\marginparwidth}{-\marginparsep}
+    \addtolength{\marginparwidth}{-1in}
+    \setlength{\marginparwidth}{#1\marginparwidth} 
+}
+
+\def\exesheet at smallmargins{
+    \geometry{hmarginratio=1:1}
+    \leftnotemarginwidth{\standardmarginwidthfactor} % right gives the same
+}
+\def\exesheet at standardmargins{
+    \ifexesheet at leftmargin
+        \geometry{hmarginratio=3:2}
+        \leftnotemarginwidth{\standardmarginwidthfactor}
+    \else
+        \geometry{hmarginratio=2:3}
+        \rightnotemarginwidth{\standardmarginwidthfactor}
+    \fi
+}
+\def\exesheet at largemargins{
+    \ifexesheet at leftmargin
+        \geometry{hmarginratio=3:1}
+        \leftnotemarginwidth{\largemarginwidthfactor}
+    \else
+        \geometry{hmarginratio=1:3}
+        \rightnotemarginwidth{\largemarginwidthfactor}
+    \fi
+}
+
+\def\exs at process@marginwidth{
+    \ifthenelse{\equal{\exesheet at marginwidth}{standard}}{
+        \ifthenelse{\equal{\exesheet at display}{none}}{
+            \if at twoside
+                \exesheet at standardmargins
+            \else
+                \exesheet at smallmargins
             \fi
-        }{}
-        #2}{}
-    \egroup
+        }{% else display=pts or notes
+            \exesheet at standardmargins
+        }
+    }{% else if
+    \ifthenelse{\equal{\exesheet at marginwidth}{expand}}{
+        \ifthenelse{\equal{\exesheet at display}{none}}{
+            \if at twoside
+                \exesheet at standardmargins
+            \else
+                \exesheet at smallmargins
+            \fi
+        }{% else if
+        \ifthenelse{\equal{\exesheet at display}{pts}}{
+            \exesheet at standardmargins
+        }{% else display=notes
+            \exesheet at largemargins
+        }}
+    }{% else if  
+        \ifthenelse{\equal{\exesheet at marginwidth}{unset}}{
+        % do nothing
+    }{% else
+    \PackageWarningNoLine{exesheet}{Value `\exesheet at marginwidth'
+         is not supported by option `marginwidth'}
+    }}}
 }
 
 %    \end{macrocode}
 % \end{macro}
-% \begin{macro}{\points (patched)}
+% For a two side mode document, the package \textsf{geometry} doesn't set the margin 
+% paragraph width correctly by default, it's too large. So we made here an explicit setting
+% useful in the case of \texttt{marginwidth=unset}. Otherwise, the setting is
+% made by the \texttt{marginwidth} key option.
+% 
 %    \begin{macrocode}
-\let\@oldpoints\points
-\renewcommand*{\points}[1]{%
-    \ifthenelse{\boolean{questions}}{\@oldpoints{#1}}{}}
+\if at twoside \rightnotemarginwidth{0.5} \fi
 
 %    \end{macrocode}
+% \begin{macro}{\exs at process@noteragged}
+% The noteragged option takes one of the following values:
+% \texttt{left}, \texttt{right}, \texttt{center}, \texttt{justify} or \texttt{twoside}.
+%
+% |\marginpar| with optional parameter makes the job for a two side document.
+% We then use |\noteraggedleft| and |\noteraggedright| instead of |\noteragged|.
+% % Commands |\RaggedLeft|, |\RaggedRight|, |\Centering| and |\justifying|
+% come from the \textsf{ragged2e} package by Martin Schröder.
+% They give better results as standard commands
+% |\raggedleft|, |\raggedright| (or |\centering|).
+% The default \LaTeX\ setting for marginal notes is justifying.
+%    \begin{macrocode}
+\newcommand{\noteragged}{}
+\newcommand{\noteraggedleft}{}
+\newcommand{\noteraggedright}{}
+
+\def\exs at process@noteragged{
+    \ifthenelse{\equal{\exesheet at noteragged}{left}}{
+        \if at twoside
+            \renewcommand{\noteraggedleft}{\RaggedLeft}
+            \renewcommand{\noteraggedright}{\RaggedLeft}
+        \else
+            \renewcommand{\noteragged}{\RaggedLeft}
+        \fi
+    }{% else if
+    \ifthenelse{\equal{\exesheet at noteragged}{right}}{
+        \if at twoside
+            \renewcommand{\noteraggedleft}{\RaggedRight}
+            \renewcommand{\noteraggedright}{\RaggedRight}
+        \else
+            \renewcommand{\noteragged}{\RaggedRight}
+        \fi
+    }{% else if
+    \ifthenelse{\equal{\exesheet at noteragged}{center}}{
+        \if at twoside
+            \renewcommand{\noteraggedleft}{\Centering}
+            \renewcommand{\noteraggedright}{\Centering}
+        \else
+            \renewcommand{\noteragged}{\Centering}
+        \fi
+    }{% else if
+    \ifthenelse{\equal{\exesheet at noteragged}{justify}}{
+          \renewcommand{\noteraggedleft}{\justifying} % equiv to nothing
+          \renewcommand{\noteraggedright}{\justifying}
+          \renewcommand{\noteragged}{\justifying}
+    % justify is the default LaTeX setting
+    }{% else  if
+    \ifthenelse{\equal{\exesheet at noteragged}{twoside}}{
+        \if at twoside
+            \renewcommand{\noteraggedleft}{\RaggedLeft}
+            \renewcommand{\noteraggedright}{\RaggedRight}
+        \else
+            \PackageWarning{exesheet}{Invalid option `noteragged=twoside'
+             when the document \MessageBreak is not in two side mode}
+        \fi
+    }{% else
+    \PackageWarning{exesheet}{Value `\exesheet at noteragged'
+         is not supported by option `noteragged'}
+    }}}}}
+}
+
+%    \end{macrocode}
 % \end{macro}
+% 
+% \begin{macro}{\exs at process@checkpts}
+% The scale control option is based on length calculus.
+% By default these calculus are local but we need to make them global,
+% therefore the two first macros |\gsetlength| and |\gaddtolength|.
+% In them we must avoid to produce a too large space at the place
+% where |\marginpar| is called, therefore all \% symbols at end of lines.
 %
-% \subsection{Marginal notes}
+% For each question, points assigned will be added in |\sum at pts|
+% and, for each exercise, points are accumulated in |\sum at exe|.
+% These lengths are compared to |\exe at total| and |\sheet at total|.
+% |\exe at check| is called at the beginning of each exercise 
+% (when macro |\points|, |\totalexe| or |\totalpoints| is called)
+% to check the previous one,
+% and also in the |\exs at process@checkpts| at end of document
+% to check the last exercise.
+%    \begin{macrocode}
+\newlength{\sheet at total}
+\newlength{\sum at exe}
+\newlength{\exe at total}
+\newlength{\sum at pts}
+\def\exe at label{none}
+\newboolean{scale at valid}
+\setboolean{scale at valid}{true}
+
+\gdef\gsetlength#1#2{% to get global length values
+    \begingroup
+        \setlength\skip@{#2}% local assignment to a scratch register
+        \global#1=\skip@%     global assignment to #1
+    \endgroup               % \skip@ is restored by end of group
+}
+
+\gdef\gaddtolength#1#2{% percent symbol necessary here !
+    \begingroup
+        \setlength\skip@{#1}%
+        \addtolength\skip@{#2}%
+        \global#1=\skip@%
+    \endgroup
+}
+
+\def\exe at check#1{
+    \ifthenelse{\lengthtest{\sum at pts = 0pt}\or\equal{\exe at label}{none}}{
+    % do not check, no \pts or first exercise begins
+    }{
+        \ifthenelse{\lengthtest{\exe at total = \sum at pts}}{
+            \PackageWarningNoLine{exesheet}{\exe at label:
+                scale \the\exe at total\space is valid}
+        }{
+        \PackageWarningNoLine{exesheet}{\exe at label:
+            sum of points is 
+            \the\sum at pts\space instead of \the\exe at total}
+        \setboolean{scale at valid}{false}
+        }
+        \gsetlength{\sum at pts}{0pt}
+    }
+    \def\exe at label{#1} % for the next exercise
+}
+
+\def\exs at process@checkpts{
+    \ifexesheet at checkpts
+        \ifthenelse{\lengthtest{\sheet at total = 0pt}}{
+            \PackageWarningNoLine{exesheet}{Option checkpts is true;
+                \MessageBreak
+                but you didn't use \string\totalsheet\space
+                in the preamble. \MessageBreak
+                See the documentation for more information}
+        }{}
+        \gsetlength{\sum at exe}{0pt}
+        \gsetlength{\exe at total}{0pt}
+        \gsetlength{\sum at pts}{0pt}
+        \AtEndDocument{
+            \ifthenelse{\equal{\exe at label}{none}}{
+                \ifthenelse{\lengthtest{\sheet at total = \sum at pts}}{
+                    \PackageWarningNoLine{exesheet}{Sum of points
+                        is valid: \the\sheet at total}  
+                }{
+                    \PackageWarningNoLine{exesheet}{Inconsistent 
+                        sum of points: 
+                        \the\sum at pts\space instead of \the\sheet at total}
+                    \setboolean{scale at valid}{false}
+                }
+            }{
+                \exe at check{end}
+                \ifthenelse{\lengthtest{\sheet at total = \sum at exe}}{
+                    \PackageWarningNoLine{exesheet}{Sum of points
+                        is valid: \the\sheet at total}
+                }{
+                    \PackageWarningNoLine{exesheet}{Inconsistent
+                        sum of points:
+                        \the\sum at exe\space instead of \the\sheet at total}
+                    \setboolean{scale at valid}{false}
+                }
+            }
+            \ifthenelse{\boolean{scale at valid}}{
+                \PackageWarningNoLine{exesheet}{Scale is valid}
+            }{
+                \PackageWarningNoLine{exesheet}{Scale is NOT valid ! 
+                    See above}
+            }
+        }
+    \fi
+}
+
+%    \end{macrocode}
+% \end{macro}
 %
-% The commands |\displaypts|, |\displaypoints| and |\displaynotes|
-% change the ratio between left and right margins\footnote{So 
-% that the effect on the margin ratio is correct, these
-% macros must be called, in the preamble, after other commands 
-% that also could alter the page geometry.}.
+% \subsection{Margin notes commands}
 %
-% \DescribeMacro{\pts} \DescribeMacro{\displaypts}
+% \begin{macro}{\points}
 %    \begin{macrocode}
-\newboolean{marginpts}
-\newcommand*{\pointmark}[1]{%
-    \ifthenelse{\lengthtest{#1 cm < 2cm}}{#1 \ptname}{#1 \ptsname}}
+\definecolor{pointscolor}{named}{red}
+\newcommand{\pointsstyle}{%
+    \small\mdseries\sffamily\color{pointscolor}\fbox}
+\newcommand*{\exesheet at points}[1]{\hfill
+    \pointsstyle{#1~%
+        \ifthenelse{\lengthtest{#1pt < 2pt}}{\pointname}{\pointsname}}
+    \ifexesheet at checkpts\gaddtolength{\sum at exe}{#1pt}\fi%
+}
+\newcommand*{\points}[1]{%
+    \ifthenelse{\boolean{exesheet at questions}}{\exesheet at points{#1}}{}}
+
+%    \end{macrocode}
+% Percent symbols are necessary to avoid spaces between the
+% |\fbox| and its inner text.
+% Without |\lengthtest|, the test |#1 < 2| doesn't work with decimal numbers
+% but it works with lengths.
+% \end{macro}
+% \DescribeMacro{\pts}
+%    \begin{macrocode}
+\definecolor{ptscolor}{named}{red}
 \newcommand{\ptsstyle}[1]{%
     \footnotesize\centering\sffamily\color{ptscolor} (#1)}
+\newcommand*{\ptsmark}[1]{%
+    \ifthenelse{\lengthtest{#1pt < 2pt}}{#1 \ptname}{#1 \ptsname}}
 \newcommand*{\pts}[1]{%
-    \ifthenelse{\boolean{marginpts}}{%
-        \mbox{}% 
-        \marginpar{\hspace{0pt}%
-            \ptsstyle{\pointmark{#1}}}%
-    }{}%
+    \ifexesheet at pts%
+        \mbox{}%
+        \marginpar{\hspace{0pt}\ptsstyle{\ptsmark{#1}}}%
+        \ifexesheet at checkpts%
+            \gaddtolength{\sum at pts}{#1pt}%
+        \fi%
+    \fi%
     \ignorespaces
 }
-\newcommand{\displaypts}{%
-    \reversemarginpar
-    \geometry{hmarginratio=3:2}
-    \setboolean{marginpts}{true}
-}
 
 %    \end{macrocode}
 %
@@ -1404,55 +2126,87 @@
 % \begin{macro}{\totalexe}
 % In the following macros using
 % |\marginpar|, percent symbols and |\ignorespaces| are necessary 
-% to avoid too much space in the text (or the margin)
+% to avoid an enlarged blank space in the text (or the margin)
 % where these macros are inserted.
 %    \begin{macrocode}
+\definecolor{markingcolor}{named}{red}
+\newcommand{\markingstyle}[1]{\footnotesize\sffamily% 
+    \centering\color{markingcolor}\textbf{#1}}
+    % inner arguments allow boxed styles
 \newlength{\ptsboxlength}
 \setlength{\ptsboxlength}{3.1em}
 \cornersize{1}
-\newcommand*{\totalexe}[1]{% 
-    \ifthenelse{\boolean{marginpoints}}{%
+\newcommand*{\totalexe}[1]{%
+    \ifexesheet at pts%
         \mbox{}%
-        \marginpar{\markingstyle{\ovalbox{%
-                    \makebox[\ptsboxlength]{\pointmark{#1}}}%
-            }}%        
-    }{}%
+        \marginpar{\hspace{0pt}\markingstyle{\ovalbox{%
+            \makebox[\ptsboxlength]{\ptsmark{#1}}}}}%
+    \fi%
+    \ifexesheet at checkpts%
+        \gsetlength{\exe at total}{#1pt}%
+        \gaddtolength{\sum at exe}{#1pt}%
+    \fi%
     \ignorespaces
 }
 
 %    \end{macrocode}
 % \end{macro}
+% \begin{macro}{\totalsheet}
+%    \begin{macrocode}
+\newcommand*{\totalsheet}[1]{
+    \gsetlength{\sheet at total}{#1pt}
+}
+
+%    \end{macrocode}
+% \end{macro}
 %
-% \begin{macro}{\note}
-% The booleans \texttt{marginpoints} and \texttt{marginfullnotes} control
-% the display of marginal notes. If \texttt{marginpoints} is \texttt{false},
-% \texttt{marginfullnotes} will be ignored.
-% The |\noteragged| command is initialized outside |\displaynotes|
-% such that we can use the |\note| command without |\displaynotes| (see further).
+% \begin{macro}{\note} 
+% Boolean \texttt{exesheet at pts} and \texttt{exesheet at notes} control
+% the display of marginal notes. If \texttt{exesheet at pts} is \texttt{false},
+% \DescribeMacro{\note*}
+% \texttt{exesheet at notes} will be ignored.
+% |\noindent| is necessary when using |\justifying| from the \textsf{ragged2e}
+% package.
+% Inside the |\note at marginpar| macro, double braces around |\markingstyle|
+% avoid some unattended style in the mandatory argument of |\note|. 
+% A vicious error occur when using |\if| \ldots |\fi| structure inside
+% the |\note at marginpar| macro instead of |\ifthenelse| 
+% (but only if |@twoside| is \texttt{true}).
 %    \begin{macrocode}
-\newboolean{marginpoints}
-\newboolean{marginfullnotes}
-
-\newcommand{\markingstyle}[1]{\hspace{0pt}\footnotesize\sffamily%
-    \centering\color{markingcolor}\textbf{#1}}
-\newcommand{\noteragged}{\raggedleft}
-\newcommand{\notestyle}[1]{\hspace{0pt}\footnotesize\sffamily%
-    \noteragged\noindent\color{notecolor} #1}
+\definecolor{notecolor}{rgb}{0.0, 0.4, 0.0} % kind of dark green  
+\newcommand{\notestyle}[1]{\footnotesize\sffamily\color{notecolor} #1}
+\newcommand{\note at marginpar}[1]{%
+    \if at twoside%
+        \marginpar[\noteraggedleft #1]{\noteraggedright #1}%
+    \else%
+        \marginpar{\noteragged #1}%
+    \fi%
+}
 \newcommand{\@note}[2][]{%
-    \ifthenelse{\boolean{marginpoints}}{%
+    \ifexesheet at pts%
         \mbox{}%
-        \marginpar{%
-            \ifthenelse{\equal{#1}{}}{}{\markingstyle{#1}\\}%
-            \ifthenelse{\boolean{marginfullnotes}}{\notestyle #2}{}%
+        \note at marginpar{%
+            \ifthenelse{\equal{#1}{}}{}{{%
+                \noindent\hspace{0pt}\markingstyle{#1}\\}}%
+            \ifthenelse{\boolean{exesheet at notes}}{%
+                \noindent\hspace{0pt}\notestyle #2%
+            }{}%
         }%
-    }{}%
+    \fi%
+    \ifexesheet at checkpts%
+        \ifthenelse{\equal{#1}{}}{}{%
+            \gaddtolength{\sum at pts}{#1pt}}%
+    \fi%
     \ignorespaces
 }
 \newcommand{\@@note}[1]{%
-    \ifthenelse{\boolean{marginpoints}}{%
+    \ifexesheet at pts%
         \mbox{}%
-        \marginpar{\markingstyle{#1}}%
-    }{}%
+        \marginpar{\noindent\hspace{0pt}\markingstyle{#1}}%
+    \fi%
+    \ifexesheet at checkpts%
+        \gaddtolength{\sum at pts}{#1pt}%
+    \fi%
     \ignorespaces
 }
 \newcommand{\note}{\@ifstar{\@@note}{\@note}}
@@ -1459,57 +2213,97 @@
 
 %    \end{macrocode}
 % \end{macro}
+% \begin{macro}{\totalpoints}
+%    \begin{macrocode}
+\newcommand{\totalpoints}{%
+    \ifthenelse{\boolean{exesheet at pts}}{\totalexe}{\points}}
+
+%    \end{macrocode}
+% \end{macro}
 %
-% \DescribeMacro{\displaypoints} \DescribeMacro{\displaynotes}
-%\DescribeMacro{\displaynotesright}
-% In |\displaynotes|, the additional length \texttt{1\,in} matches 
-% the default free space to the left of |\oddsidemargin|.
+% \subsection{The \texttt{correct} option and other (deprecated) commands}
 %
+% \begin{macro}{\exs at process@correct}
 %    \begin{macrocode}
+\def\exs at process@correct{     
+    \ifthenelse{\equal{\exesheet at correct}{false}}{
+        % do nothing
+    }{% else
+    \@ifpackageloaded{schooldocs}{
+        \ifthenelse{\equal{\exesheet at correct}{true}}{
+            \correct
+        }{% else
+        \ifthenelse{\equal{\exesheet at correct}{conditional}}{
+            \ifexesheet at answers \correct \fi
+        }{}}
+    }{
+        \PackageWarningNoLine{exesheet}{Package `schooldocs' must be loaded
+            \MessageBreak
+            to use the `correct' option}
+    }}
+}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% The following macros are maintained for now
+% only for compatibility reasons.
+%    \begin{macrocode}
+\newcommand{\questionsonly}{
+    \PackageWarning{exesheet}{Command \string\questionsonly\space 
+        is deprecated, \MessageBreak
+        use `output=questions' as package option instead}
+    \renewcommand\exesheet at output{questions}
+    \exs at process@output
+}
+\newcommand{\answersonly}{
+    \PackageWarning{exesheet}{Command \string\answersonly\space 
+        is deprecated, \MessageBreak
+        use `output=answers' as package option instead}
+    \renewcommand\exesheet at output{answers}
+    \exs at process@output
+}
+\newcommand{\displaypts}{%
+    \PackageWarning{exesheet}{Command \string\displaypts\space 
+        is deprecated, \MessageBreak
+        use `display=pts' as package option instead}
+    \renewcommand\exesheet at display{pts}
+    \exs at process@display
+}
 \newcommand{\displaypoints}{%
-    \reversemarginpar
-    \geometry{hmarginratio=3:2}
-    \setboolean{marginpoints}{true}
+    \PackageWarning{exesheet}{Command \string\displaypoints\space 
+        is deprecated, \MessageBreak
+        use `display=pts' as package option instead}
+    \renewcommand\exesheet at display{pts}
+    \exs at process@display
 }
-
-\newcommand*{\displaynotes}[1][\raggedleft]{%
-    \reversemarginpar
+\newcommand*{\displaynotes}[1][\RaggedLeft]{%
+    % \renewcommand{\noteragged}{#1} no effect now!
+    \PackageWarning{exesheet}{Command \string\displaynotes\space 
+        is deprecated, \MessageBreak
+        use `display=notes' as package option instead}
+    \renewcommand\exesheet at display{notes}
+    \exs at process@display
     \renewcommand{\noteragged}{#1}
-    \geometry{hmarginratio=5:1}
-    \setlength{\marginparwidth}{\oddsidemargin}
-    \addtolength{\marginparwidth}{1in}
-    \addtolength{\marginparwidth}{-\marginparsep}
-    \setlength{\marginparwidth}{0.8\marginparwidth}
-    \setboolean{marginpoints}{true}
-    \setboolean{marginfullnotes}{true}
 }
-
-\newcommand*{\displaynotesright}[1][\raggedright]{%
-    \normalmarginpar
+\newcommand*{\displaynotesright}[1][\RaggedRight]{%
+    % \renewcommand{\noteragged}{#1} no effect now!
+    \PackageWarning{exesheet}{Command \string\displaynotes\space 
+        is deprecated, \MessageBreak
+        use `display=notes, margin=right' as package options instead}
+    \renewcommand\exesheet at display{notes}
+    \exs at process@display
+    \renewcommand\exesheet at margin{right}
     \renewcommand{\noteragged}{#1}
-    \geometry{hmarginratio=1:5}
-    \setlength{\marginparwidth}{\paperwidth}
-    \addtolength{\marginparwidth}{-\textwidth}
-    \addtolength{\marginparwidth}{-\oddsidemargin}
-    \addtolength{\marginparwidth}{-\marginparsep}
-    \addtolength{\marginparwidth}{-1in}
-    \setlength{\marginparwidth}{0.8\marginparwidth}
-    \setboolean{marginpoints}{true}
-    \setboolean{marginfullnotes}{true}
 }
-%    \end{macrocode}
-% The formatting of marginal notes can possibly be made more regular 
-% with the \textsf{ragged2e} package, not loaded by \textsf{exesheet}.
-% We will then have to enter, as an optional parameter of |\displaypoints|:
-% |\RaggedLeft|, |\Centering|, |\RaggedRight| or |justifying|.
-%
-% \begin{macro}{\totalpoints}
-%    \begin{macrocode}
-\newcommand{\totalpoints}{%
-    \ifthenelse{\boolean{marginpoints}}{\totalexe}{\points}}
+
+\PackageInfo{exesheet}{Environment `tablenum' is deprecated \MessageBreak
+    and replaced by `tablenum1'. \MessageBreak
+    Options `notoc' and `nosetlist' \MessageBreak
+    are no longer supported\@gobble} 
+    % gobble allow to suppress line number
 %</package>
 %    \end{macrocode}
-% \end{macro}
 %
 % \Finale
 \endinput

Modified: trunk/Master/texmf-dist/tex/latex/exesheet/exesheet.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/exesheet/exesheet.cls	2023-01-18 00:48:52 UTC (rev 65576)
+++ trunk/Master/texmf-dist/tex/latex/exesheet/exesheet.cls	2023-01-18 20:39:24 UTC (rev 65577)
@@ -22,10 +22,19 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
 \ProvidesClass{exesheet}
-[2021/11/15 v1.3 .dtx exesheet file]
+[2023/01/16 v2.0 .dtx exesheet file]
 
-\DeclareOption{notoc}{\PassOptionsToPackage{notoc}{exesheet}}
-\DeclareOption{nosetlist}{\PassOptionsToPackage{nosetlist}{exesheet}}
+\RequirePackage{kvoptions}
+\DeclareBoolOption[true]{exetoc}
+\DeclareBoolOption[true]{setlist}
+\DeclareStringOption[both]{output}
+\DeclareStringOption[none]{display}
+\DeclareBoolOption[false]{answerspace}
+\DeclareStringOption[left]{marginpos}
+\DeclareStringOption[expand]{marginwidth}
+\DeclareStringOption[left]{noteragged}
+\DeclareBoolOption[false]{checkpts}
+\DeclareStringOption[false]{correct}
 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
 \ProcessOptions \relax
 \LoadClass{article}

Modified: trunk/Master/texmf-dist/tex/latex/exesheet/exesheet.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/exesheet/exesheet.sty	2023-01-18 00:48:52 UTC (rev 65576)
+++ trunk/Master/texmf-dist/tex/latex/exesheet/exesheet.sty	2023-01-18 20:39:24 UTC (rev 65577)
@@ -22,21 +22,60 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
 \ProvidesPackage{exesheet}
-[2021/11/15 v1.3 .dtx exesheet file]
+[2023/01/16 v2.0 .dtx exesheet file]
 
+\@ifclassloaded{exesheet}{}{
+    \RequirePackage{kvoptions}
+    \DeclareBoolOption[true]{exetoc}
+    \DeclareBoolOption[true]{setlist}
+    \DeclareStringOption[both]{output}
+    \DeclareStringOption[none]{display}
+    \DeclareBoolOption[false]{answerspace}
+    \DeclareStringOption[left]{marginpos}
+    \DeclareStringOption[expand]{marginwidth}
+    \DeclareStringOption[left]{noteragged}
+    \DeclareBoolOption[false]{checkpts}
+    \DeclareStringOption[false]{correct}
+}
+
+\ProcessKeyvalOptions*
+
+\def\exs at process@dynoptions{
+    \exs at process@output
+    \exs at process@display
+    \exs at process@noteragged
+}
+
+\AtEndOfPackage{\exs at process@dynoptions}
+\AtBeginDocument{
+    \newif\ifexesheet at multicol
+    \@ifpackageloaded{multicol}{
+        \exesheet at multicoltrue}{\exesheet at multicolfalse}
+        % to set the rule to the right color in answers environments
+    \exs at process@setlist
+    \exs at process@marginpos
+    \exs at process@marginwidth
+    \exs at process@checkpts
+    \exs at process@correct
+    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{setlist}
+    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{marginpos}
+    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{marginwidth}
+    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{checkpts}
+    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{correct}
+}
+
+\def\exesheetset#1{\setkeys{exesheet}{#1}\exs at process@dynoptions}
+
 \RequirePackage{ifthen}
-\newboolean{notoc}
-\newboolean{nosetlist}
-\DeclareOption{notoc}{\setboolean{notoc}{true}}
-\DeclareOption{nosetlist}{\setboolean{nosetlist}{true}}
-\ProcessOptions \relax
+\RequirePackage{geometry}
 \RequirePackage{xcolor}
 \RequirePackage[shortlabels]{enumitem}
 \RequirePackage{tasks}
 \RequirePackage{versions}
-\RequirePackage{geometry}
 \RequirePackage{fancybox}
 \RequirePackage{translations}
+\RequirePackage{ragged2e}
+\ifthenelse{\boolean{@twoside}}{\RequirePackage{mparhack}}{}
 
 \DeclareTranslationFallback{exesheet-exercise}{Exercise}
 \DeclareTranslationFallback{exesheet-subpart}{Part}
@@ -75,8 +114,8 @@
 \DeclareTranslation{German}{exesheet-points}{Punkte}
 \DeclareTranslation{German}{exesheet-point}{Punkt}
 \DeclareTranslation{German}{exesheet-correction}{Verbesserung}
-\DeclareTranslation{German}{exesheet-pts}{Pkte}
-\DeclareTranslation{German}{exesheet-pt}{Pkt}
+\DeclareTranslation{German}{exesheet-pts}{P.}
+\DeclareTranslation{German}{exesheet-pt}{P.}
 
 \DeclareTranslation{Spanish}{exesheet-exercise}{Ejercicio}
 \DeclareTranslation{Spanish}{exesheet-subpart}{Parte}
@@ -118,29 +157,26 @@
 \newcommand*\ptsname{\GetTranslation{exesheet-pts}}
 \newcommand*\ptname{\GetTranslation{exesheet-pt}}
 
-\definecolor{pointscolor}{named}{red}
-\definecolor{ptscolor}{named}{red}
-\definecolor{markingcolor}{named}{red}
-\definecolor{notecolor}{rgb}{0.0, 0.4, 0.0} % kind of dark green
-\definecolor{correctioncolor}{rgb}{0,0.2,0.6} % kind of dark blue
-
 \newcounter{exercise}
 
-\newcommand{\labelexercise}{\exercisename~\theexercise}
+\newcommand{\labelexercise}{\exercisename\space \theexercise}
 \newcommand{\labelexercisestyle}{}
 \newcommand*{\@exercise}[1][]{%
+    \ifexesheet at checkpts \exe at check{\labelexercise} \fi
+    % curiously the \execheck must be done before \refstepcounter !
     \refstepcounter{exercise}
-    \subsection*{\labelexercisestyle\labelexercise\ #1}
-    \ifthenelse{\boolean{notoc}}{}{
+    \subsection*{\labelexercisestyle\labelexercise\enskip #1}
+    \ifexesheet at exetoc
         \addcontentsline{toc}{subsection}{\labelexercise}
-    }
+    \fi
 }
 \newcommand*{\@@exercise}[2][]{%
-    \subsection*{\labelexercisestyle #2 #1}
+    \ifexesheet at checkpts \exe at check{#2} \fi
+    \subsection*{\labelexercisestyle #2\enskip #1}
     \setcounter{subpart}{0} % resets the parts counter
-    \ifthenelse{\boolean{notoc}}{}{
+    \ifexesheet at exetoc
         \addcontentsline{toc}{subsection}{#2}
-    }
+    \fi
 }
 \newcommand{\exercise}{\@ifstar{\@@exercise}{\@exercise}}
 
@@ -151,16 +187,16 @@
 \newcommand{\labelsubpartstyle}{}
 \newcommand*{\@subpart}[1][]{%
     \refstepcounter{subpart}%
-    \subsubsection*{\labelsubpartstyle\labelsubpart\ #1}
-    \ifthenelse{\boolean{notoc}}{}{
+    \subsubsection*{\labelsubpartstyle\labelsubpart\enskip #1}
+    \ifexesheet at exetoc
         \addcontentsline{toc}{subsubsection}{\labelsubpart}
-    }
+    \fi
 }
 \newcommand*{\@@subpart}[2][]{%
-    \subsubsection*{\labelsubpartstyle #2 #1}
-    \ifthenelse{\boolean{notoc}}{}{
+    \subsubsection*{\labelsubpartstyle #2\enskip #1}
+    \ifexesheet at exetoc
         \addcontentsline{toc}{subsubsection}{#2}
-    }
+    \fi
 }
 \newcommand{\subpart}{\@ifstar{\@@subpart}{\@subpart}}
 
@@ -167,9 +203,9 @@
 \newcommand{\annexstyle}{\MakeUppercase}
 \newcommand*{\annex}[1][]{%
     \subsection*{\mbox{}\hfill\annexstyle{\annexname} #1\hfill\mbox{}}
-    \ifthenelse{\boolean{notoc}}{}{
+    \ifexesheet at exetoc
         \addcontentsline{toc}{subsection}{\annexname}
-    }
+    \fi
 }
 
 \newcommand{\exlabel}{\exname.~\theexercise}
@@ -180,31 +216,6 @@
     \par\noindent\textbf{\exlabel}~}
 \newcommand{\exe}{\@ifstar{\@@exe}{\@exe}}
 
-\newcommand{\pointsstyle}{%
-    \small\mdseries\sffamily\color{pointscolor}\fbox}
-\newcommand*{\points}[1]{\hfill
-    \pointsstyle{#1~%
-        \ifthenelse{\lengthtest{#1 cm < 2cm}}{\pointname}{\pointsname}%
-    }
-}
-
-\newcommand\standardfrenchlists{%
-    \@ifpackagewith{babel}{frenchb}{
-        \frenchbsetup{StandardLists=true}}{}
-    \@ifpackagewith{babel}{french}{
-        \@ifundefined{frenchsetup}{
-            \frenchbsetup{StandardLists=true}}{
-            \frenchsetup{StandardLists=True}}
-    }{}
-}
-\ifthenelse{\boolean{nosetlist}}{}{
-    \AtBeginDocument{% if loaded before babel package
-        \standardfrenchlists}
-    \standardfrenchlists % necessary when loaded after babel
-    \setlist[enumerate]{font=\bfseries}
-    \setlist[enumerate,1]{topsep=1.5ex plus 1ex minus 1ex,leftmargin=1.5em}
-}
-
 \newenvironment{exenumerate}[1][]{%
     \setlist[enumerate]{font=\bfseries}
     \setlist[enumerate,1]{leftmargin=1.5em,
@@ -214,15 +225,24 @@
     \begin{enumerate}[#1]
         }{\end{enumerate}}
 
-\ifthenelse{\boolean{nosetlist}}{
-    \NewTasksEnvironment[label=\arabic*.,
-        column-sep=1em,
-        after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2)
-    \NewTasksEnvironment[label=(\alph*),
-        column-sep=1em,label-align=right,
-        item-indent=2.15em,label-width=1.6em,label-offset=0.5em,
-        after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2)
-}{% by default
+\newcommand\standardfrenchlists{%
+    \@ifpackagewith{babel}{french}{
+        \frenchsetup{StandardLists=true}
+    }{}
+}
+\ifexesheet at setlist
+    \standardfrenchlists % necessary when exesheet is loaded after babel
+    \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{setlist}
+\fi
+
+\def\exs at process@setlist{% must be executed at begin document
+  \ifexesheet at setlist
+    \standardfrenchlists % if exesheet is loaded before babel package
+    \setlist[enumerate]{font=\bfseries}
+    \setlist[enumerate,1]{topsep=1.5ex plus 1ex minus 1ex,leftmargin=1.5em}
+  \fi
+
+  \ifexesheet at setlist
     \NewTasksEnvironment[label=\arabic*.,label-format=\bfseries,
         column-sep=1em,label-align=right,
         item-indent=1.5em,label-width=1em,label-offset=0.5em,
@@ -231,8 +251,16 @@
         column-sep=1em,label-align=right,
         item-indent=2.15em,label-width=1.6em,label-offset=0.5em,
         after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2)
-}
-\PackageWarning{exesheet}{Environment tablenum is deprecated and replaced by tablenum1}
+  \else
+    \NewTasksEnvironment[label=\arabic*.,
+        column-sep=1em,
+        after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2)
+    \NewTasksEnvironment[label=(\alph*),
+        column-sep=1em,label-align=right,
+        item-indent=2.15em,label-width=1.6em,label-offset=0.5em,
+        after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2)
+  \fi
+} % end of macro \exs at process@setlist
 
 \NewTasksEnvironment[label=\labelitemi,
     label-align=right,
@@ -243,9 +271,9 @@
     \setlength{\multicolsep}{2ex}
     \raggedcolumns % default is \flushcolumns
     \begin{multicols}{#2} % #2 = number of columns
-        \begin{enumerate}[#1] % #1 = options of enumerate
-            }{
-        \end{enumerate}
+    \begin{enumerate}[#1] % #1 = options of enumerate
+    }{
+    \end{enumerate}
     \end{multicols}
 }
 
@@ -252,9 +280,9 @@
 \newenvironment{colsenum*}[2][]{%
     \setlength{\multicolsep}{2ex}
     \begin{multicols}{#2} % #2 = number of columns
-        \begin{enumerate}[#1] % #1 = options of enumerate
-            }{
-        \end{enumerate}
+    \begin{enumerate}[#1] % #1 = options of enumerate
+    }{
+    \end{enumerate}
     \end{multicols}
 }
 
@@ -262,9 +290,9 @@
     \setlength{\multicolsep}{2ex}
     \raggedcolumns
     \begin{multicols}{#2}
-        \begin{itemize}[#1]
-            }{
-        \end{itemize}
+    \begin{itemize}[#1]
+    }{
+    \end{itemize}
     \end{multicols}
 }
 
@@ -271,30 +299,42 @@
 \newenvironment{colsitem*}[2][]{%
     \setlength{\multicolsep}{2ex}
     \begin{multicols}{#2}
-        \begin{itemize}[#1]
-            }{
-        \end{itemize}
+    \begin{itemize}[#1]
+    }{
+    \end{itemize}
     \end{multicols}
 }
 
-\newboolean{questions}
-\newboolean{answers}
-\setboolean{questions}{true}
-\setboolean{answers}{true}
-\newcommand{\questionsonly}{
-    \setboolean{questions}{true}\setboolean{answers}{false}}
-\newcommand{\answersonly}{
-    \setboolean{questions}{false}\setboolean{answers}{true}}
+\newboolean{exesheet at questions}\setboolean{exesheet at questions}{true}
+\newboolean{exesheet at answers}\setboolean{exesheet at answers}{true}
 
+\def\exs at process@output{
+    \ifthenelse{\equal{\exesheet at output}{questions}}{
+        \setboolean{exesheet at questions}{true}
+        \setboolean{exesheet at answers}{false}
+    }{% else if
+    \ifthenelse{\equal{\exesheet at output}{answers}}{
+        \setboolean{exesheet at questions}{false}
+        \setboolean{exesheet at answers}{true}
+    }{% else if
+    \ifthenelse{\equal{\exesheet at output}{both}}{
+        \setboolean{exesheet at questions}{true}
+        \setboolean{exesheet at answers}{true}
+    }{% else
+    \PackageWarning{exesheet}{Value `\exesheet at output'
+         is not supported by option `output'}
+    }}}
+}
+
 \newcounter{exe at ini}
 \newcounter{subpart at ini}
 
 \newenvironment{questions}{
-    \ifthenelse{\boolean{questions}}{
+    \ifthenelse{\boolean{exesheet at questions}}{%
         \setcounter{exe at ini}{\value{exercise}}
         \setcounter{subpart at ini}{\value{subpart}}
-    }{\comment}}%
-{\ifthenelse{\boolean{questions}}{}{\endcomment}}
+    }{\comment}
+}{\ifthenelse{\boolean{exesheet at questions}}{}{\endcomment}}
 
 \newcounter{@toclevel}
 \newcommand{\set at toclevel}[1][]{
@@ -301,157 +341,510 @@
     \ifthenelse{\equal{#1}{}}{
         \ifthenelse{\value{exercise} > \value{exe at ini}}{
             \setcounter{@toclevel}{1}
-        }{\ifthenelse{\equal{\the\@enumdepth}{0}}{
-                % we're not in an enumerate environment
-                \ifthenelse{\(\value{subpart} > \value{subpart at ini}\)
-                    \or \(\value{subpart} = 0\)}{
-                    \setcounter{@toclevel}{2}
-                }{\setcounter{@toclevel}{3}}
-            }{\setcounter{@toclevel}{4}}}
+        }{% else
+        \ifthenelse{\equal{\the\@enumdepth}{0}}{
+            % we're not in an enumerate environment
+            \ifthenelse{\(\value{subpart} > \value{subpart at ini}\)
+                \or \(\value{subpart} = 0\)}{
+              \setcounter{@toclevel}{2}
+            }{\setcounter{@toclevel}{3}}
+        }{\setcounter{@toclevel}{4}}}
     }{\setcounter{@toclevel}{#1}}}
 
+\definecolor{correctioncolor}{rgb}{0,0.2,0.6} % kind of dark blue
 \newcommand{\correctionstyle}{\color{correctioncolor}}
 
+\newcommand{\typeset at correctionname}{
+    \ifthenelse{\value{@toclevel} = 1}{
+        \section*{\correctionstyle\correctionname}
+        \ifexesheet at exetoc
+            \addcontentsline{toc}{section}{\correctionname}
+        \fi
+        \setcounter{exercise}{0}
+    }{% else if
+    \ifthenelse{\value{@toclevel} = 2}{%
+        \subsection*{\correctionstyle\correctionname}
+        \ifexesheet at exetoc
+            \addcontentsline{toc}{subsection}{\correctionname}
+        \fi
+        \setcounter{subpart}{0}
+    }{% else if
+    \ifthenelse{\value{@toclevel} = 3}{%
+        \subsubsection*{\correctionstyle\correctionname}
+        \ifexesheet at exetoc
+            \addcontentsline{toc}{subsubsection}{\correctionname}
+        \fi
+    }{% else
+    \par\textbf{\correctionstyle\correctionname}\par
+    }}}
+}
+
 \newenvironment{answers}[1][]{% #1 is the optional level
-    \ifthenelse{\boolean{answers}}{%
-        \ifthenelse{\boolean{questions}}{%
+    \ifthenelse{\boolean{exesheet at answers}}{%
+        \ifthenelse{\boolean{exesheet at questions}}{
             \set at toclevel[#1]
-            \ifthenelse{\value{@toclevel} = 1}{
-                \section*{\correctionstyle\correctionname}
-                \ifthenelse{\boolean{notoc}}{}{
-                    \addcontentsline{toc}{section}{\correctionname}}
-                \setcounter{exercise}{0}
-            }{\ifthenelse{\value{@toclevel} = 2}{%
-                    \subsection*{\correctionstyle\correctionname}
-                    \ifthenelse{\boolean{notoc}}{}{
-                        \addcontentsline{toc}{subsection}{\correctionname}}
-                    \setcounter{subpart}{0}
-                }{\ifthenelse{\value{@toclevel} = 3}{%
-                        \subsubsection*{\correctionstyle\correctionname}
-                        \ifthenelse{\boolean{notoc}}{}{
-                            \addcontentsline{toc}{subsubsection}{
-                                \correctionname}}
-                    }{\par\textbf{\correctionstyle\correctionname}\par
-                    }%
-                }%
-            }%
+            \typeset at correctionname
             \correctionstyle%
-        }{}%
+            \ifexesheet at multicol
+                \renewcommand{\columnseprulecolor}{\color{correctioncolor}}
+            \fi
+        }{}
     }{\comment}
-}{\ifthenelse{\boolean{answers}}{}{\endcomment}}
+}{\ifthenelse{\boolean{exesheet at answers}}{}{\endcomment}}
 
-\newenvironment{answers*}{\ifthenelse{\boolean{answers}}{}{\comment}}%
-{\ifthenelse{\boolean{answers}}{}{\endcomment}}
+\newenvironment{answers*}{
+    \ifthenelse{\boolean{exesheet at answers}}{}{\comment}
+}{\ifthenelse{\boolean{exesheet at answers}}{}{\endcomment}}
 
-\newcommand{\question}[2]{%
-    \ifthenelse{\boolean{questions}}{#1}{}
-    \bgroup
-    \ifthenelse{\boolean{answers}}{
-        \ifthenelse{\boolean{questions}}{
-            \ifx#2\empty\else
-                \par\correctionstyle\textbf{\correctionname}\par
+\newcommand{\question}[1]{\ifexesheet at questions #1\fi}
+
+\newcommand{\answer}[1]{%
+    \ifexesheet at answers%
+        \ifexesheet at questions \correctionstyle #1\else #1\fi
+    \fi
+}
+
+\newcommand\answerspace[1]{
+    \ifexesheet at answerspace \par\vspace{#1} \fi}
+
+\newboolean{exesheet at pts}
+\newboolean{exesheet at notes}
+
+\def\exs at process@display{
+    \ifthenelse{\equal{\exesheet at display}{pts}}{
+        \setboolean{exesheet at pts}{true}
+        \setboolean{exesheet at notes}{false}
+    }{% else if
+    \ifthenelse{\equal{\exesheet at display}{notes}}{
+        \setboolean{exesheet at pts}{true}
+        \setboolean{exesheet at notes}{true}
+    }{% else if
+    \ifthenelse{\equal{\exesheet at display}{none}}{
+        \setboolean{exesheet at pts}{false}
+        \setboolean{exesheet at notes}{false}
+    }{% else
+    \PackageWarning{exesheet}{Value `\exesheet at display'
+         is not supported by option `display'}
+    }}}
+}
+
+\newboolean{exesheet at leftmargin}
+
+\def\exs at process@marginpos{
+    \ifthenelse{\equal{\exesheet at marginpos}{left}}{
+        \if at twoside%
+            \PackageWarningNoLine{exesheet}{Default `marginpos' option
+                \MessageBreak
+                for two side documents is `outer'.\MessageBreak
+                Use `inner' to change the side}
+            \def\exesheet at marginpos{outer}
+            \setboolean{exesheet at leftmargin}{false}
+            \normalmarginpar
+        \else% default
+            \setboolean{exesheet at leftmargin}{true}
+            \reversemarginpar
+        \fi
+    }{% else if
+    \ifthenelse{\equal{\exesheet at marginpos}{right}}{
+        \if at twoside%
+            \PackageWarningNoLine{exesheet}{Default `marginpos' option
+                \MessageBreak
+                for two side documents is `outer'.\MessageBreak
+                Use `inner' to change the side}
+            \def\exesheet at marginpos{outer}
+        \fi
+        \setboolean{exesheet at leftmargin}{false}
+        \normalmarginpar
+    }{% else if
+    \ifthenelse{\equal{\exesheet at marginpos}{inner}}{
+        \setboolean{exesheet at leftmargin}{true}
+        \reversemarginpar
+    }{% else if
+    \ifthenelse{\equal{\exesheet at marginpos}{outer}}{
+        \setboolean{exesheet at leftmargin}{false}
+        \normalmarginpar
+    }{% else
+    \PackageWarningNoLine{exesheet}{Value `\exesheet at marginpos'
+         is not supported by option `marginpos'}
+    }}}}
+}
+
+\def\standardmarginwidthfactor{0.6}
+\def\largemarginwidthfactor{0.8}
+
+\newcommand*{\leftnotemarginwidth}[1]{
+    \setlength{\marginparwidth}{\oddsidemargin}
+    \addtolength{\marginparwidth}{1in}
+    \addtolength{\marginparwidth}{-\marginparsep}
+    \setlength{\marginparwidth}{#1\marginparwidth}
+}
+
+\newcommand*\rightnotemarginwidth[1]{
+    \setlength{\marginparwidth}{\paperwidth}
+    \addtolength{\marginparwidth}{-\textwidth}
+    \addtolength{\marginparwidth}{-\oddsidemargin}
+    \addtolength{\marginparwidth}{-\marginparsep}
+    \addtolength{\marginparwidth}{-1in}
+    \setlength{\marginparwidth}{#1\marginparwidth}
+}
+
+\def\exesheet at smallmargins{
+    \geometry{hmarginratio=1:1}
+    \leftnotemarginwidth{\standardmarginwidthfactor} % right gives the same
+}
+\def\exesheet at standardmargins{
+    \ifexesheet at leftmargin
+        \geometry{hmarginratio=3:2}
+        \leftnotemarginwidth{\standardmarginwidthfactor}
+    \else
+        \geometry{hmarginratio=2:3}
+        \rightnotemarginwidth{\standardmarginwidthfactor}
+    \fi
+}
+\def\exesheet at largemargins{
+    \ifexesheet at leftmargin
+        \geometry{hmarginratio=3:1}
+        \leftnotemarginwidth{\largemarginwidthfactor}
+    \else
+        \geometry{hmarginratio=1:3}
+        \rightnotemarginwidth{\largemarginwidthfactor}
+    \fi
+}
+
+\def\exs at process@marginwidth{
+    \ifthenelse{\equal{\exesheet at marginwidth}{standard}}{
+        \ifthenelse{\equal{\exesheet at display}{none}}{
+            \if at twoside
+                \exesheet at standardmargins
+            \else
+                \exesheet at smallmargins
             \fi
+        }{% else display=pts or notes
+            \exesheet at standardmargins
+        }
+    }{% else if
+    \ifthenelse{\equal{\exesheet at marginwidth}{expand}}{
+        \ifthenelse{\equal{\exesheet at display}{none}}{
+            \if at twoside
+                \exesheet at standardmargins
+            \else
+                \exesheet at smallmargins
+            \fi
+        }{% else if
+        \ifthenelse{\equal{\exesheet at display}{pts}}{
+            \exesheet at standardmargins
+        }{% else display=notes
+            \exesheet at largemargins
+        }}
+    }{% else if
+        \ifthenelse{\equal{\exesheet at marginwidth}{unset}}{
+        % do nothing
+    }{% else
+    \PackageWarningNoLine{exesheet}{Value `\exesheet at marginwidth'
+         is not supported by option `marginwidth'}
+    }}}
+}
+
+\if at twoside \rightnotemarginwidth{0.5} \fi
+
+\newcommand{\noteragged}{}
+\newcommand{\noteraggedleft}{}
+\newcommand{\noteraggedright}{}
+
+\def\exs at process@noteragged{
+    \ifthenelse{\equal{\exesheet at noteragged}{left}}{
+        \if at twoside
+            \renewcommand{\noteraggedleft}{\RaggedLeft}
+            \renewcommand{\noteraggedright}{\RaggedLeft}
+        \else
+            \renewcommand{\noteragged}{\RaggedLeft}
+        \fi
+    }{% else if
+    \ifthenelse{\equal{\exesheet at noteragged}{right}}{
+        \if at twoside
+            \renewcommand{\noteraggedleft}{\RaggedRight}
+            \renewcommand{\noteraggedright}{\RaggedRight}
+        \else
+            \renewcommand{\noteragged}{\RaggedRight}
+        \fi
+    }{% else if
+    \ifthenelse{\equal{\exesheet at noteragged}{center}}{
+        \if at twoside
+            \renewcommand{\noteraggedleft}{\Centering}
+            \renewcommand{\noteraggedright}{\Centering}
+        \else
+            \renewcommand{\noteragged}{\Centering}
+        \fi
+    }{% else if
+    \ifthenelse{\equal{\exesheet at noteragged}{justify}}{
+          \renewcommand{\noteraggedleft}{\justifying} % equiv to nothing
+          \renewcommand{\noteraggedright}{\justifying}
+          \renewcommand{\noteragged}{\justifying}
+    % justify is the default LaTeX setting
+    }{% else  if
+    \ifthenelse{\equal{\exesheet at noteragged}{twoside}}{
+        \if at twoside
+            \renewcommand{\noteraggedleft}{\RaggedLeft}
+            \renewcommand{\noteraggedright}{\RaggedRight}
+        \else
+            \PackageWarning{exesheet}{Invalid option `noteragged=twoside'
+             when the document \MessageBreak is not in two side mode}
+        \fi
+    }{% else
+    \PackageWarning{exesheet}{Value `\exesheet at noteragged'
+         is not supported by option `noteragged'}
+    }}}}}
+}
+
+\newlength{\sheet at total}
+\newlength{\sum at exe}
+\newlength{\exe at total}
+\newlength{\sum at pts}
+\def\exe at label{none}
+\newboolean{scale at valid}
+\setboolean{scale at valid}{true}
+
+\gdef\gsetlength#1#2{% to get global length values
+    \begingroup
+        \setlength\skip@{#2}% local assignment to a scratch register
+        \global#1=\skip@%     global assignment to #1
+    \endgroup               % \skip@ is restored by end of group
+}
+
+\gdef\gaddtolength#1#2{% percent symbol necessary here !
+    \begingroup
+        \setlength\skip@{#1}%
+        \addtolength\skip@{#2}%
+        \global#1=\skip@%
+    \endgroup
+}
+
+\def\exe at check#1{
+    \ifthenelse{\lengthtest{\sum at pts = 0pt}\or\equal{\exe at label}{none}}{
+    % do not check, no \pts or first exercise begins
+    }{
+        \ifthenelse{\lengthtest{\exe at total = \sum at pts}}{
+            \PackageWarningNoLine{exesheet}{\exe at label:
+                scale \the\exe at total\space is valid}
+        }{
+        \PackageWarningNoLine{exesheet}{\exe at label:
+            sum of points is
+            \the\sum at pts\space instead of \the\exe at total}
+        \setboolean{scale at valid}{false}
+        }
+        \gsetlength{\sum at pts}{0pt}
+    }
+    \def\exe at label{#1} % for the next exercise
+}
+
+\def\exs at process@checkpts{
+    \ifexesheet at checkpts
+        \ifthenelse{\lengthtest{\sheet at total = 0pt}}{
+            \PackageWarningNoLine{exesheet}{Option checkpts is true;
+                \MessageBreak
+                but you didn't use \string\totalsheet\space
+                in the preamble. \MessageBreak
+                See the documentation for more information}
         }{}
-        #2}{}
-    \egroup
+        \gsetlength{\sum at exe}{0pt}
+        \gsetlength{\exe at total}{0pt}
+        \gsetlength{\sum at pts}{0pt}
+        \AtEndDocument{
+            \ifthenelse{\equal{\exe at label}{none}}{
+                \ifthenelse{\lengthtest{\sheet at total = \sum at pts}}{
+                    \PackageWarningNoLine{exesheet}{Sum of points
+                        is valid: \the\sheet at total}
+                }{
+                    \PackageWarningNoLine{exesheet}{Inconsistent
+                        sum of points:
+                        \the\sum at pts\space instead of \the\sheet at total}
+                    \setboolean{scale at valid}{false}
+                }
+            }{
+                \exe at check{end}
+                \ifthenelse{\lengthtest{\sheet at total = \sum at exe}}{
+                    \PackageWarningNoLine{exesheet}{Sum of points
+                        is valid: \the\sheet at total}
+                }{
+                    \PackageWarningNoLine{exesheet}{Inconsistent
+                        sum of points:
+                        \the\sum at exe\space instead of \the\sheet at total}
+                    \setboolean{scale at valid}{false}
+                }
+            }
+            \ifthenelse{\boolean{scale at valid}}{
+                \PackageWarningNoLine{exesheet}{Scale is valid}
+            }{
+                \PackageWarningNoLine{exesheet}{Scale is NOT valid !
+                    See above}
+            }
+        }
+    \fi
 }
 
-\let\@oldpoints\points
-\renewcommand*{\points}[1]{%
-    \ifthenelse{\boolean{questions}}{\@oldpoints{#1}}{}}
+\definecolor{pointscolor}{named}{red}
+\newcommand{\pointsstyle}{%
+    \small\mdseries\sffamily\color{pointscolor}\fbox}
+\newcommand*{\exesheet at points}[1]{\hfill
+    \pointsstyle{#1~%
+        \ifthenelse{\lengthtest{#1pt < 2pt}}{\pointname}{\pointsname}}
+    \ifexesheet at checkpts\gaddtolength{\sum at exe}{#1pt}\fi%
+}
+\newcommand*{\points}[1]{%
+    \ifthenelse{\boolean{exesheet at questions}}{\exesheet at points{#1}}{}}
 
-\newboolean{marginpts}
-\newcommand*{\pointmark}[1]{%
-    \ifthenelse{\lengthtest{#1 cm < 2cm}}{#1 \ptname}{#1 \ptsname}}
+\definecolor{ptscolor}{named}{red}
 \newcommand{\ptsstyle}[1]{%
     \footnotesize\centering\sffamily\color{ptscolor} (#1)}
+\newcommand*{\ptsmark}[1]{%
+    \ifthenelse{\lengthtest{#1pt < 2pt}}{#1 \ptname}{#1 \ptsname}}
 \newcommand*{\pts}[1]{%
-    \ifthenelse{\boolean{marginpts}}{%
+    \ifexesheet at pts%
         \mbox{}%
-        \marginpar{\hspace{0pt}%
-            \ptsstyle{\pointmark{#1}}}%
-    }{}%
+        \marginpar{\hspace{0pt}\ptsstyle{\ptsmark{#1}}}%
+        \ifexesheet at checkpts%
+            \gaddtolength{\sum at pts}{#1pt}%
+        \fi%
+    \fi%
     \ignorespaces
 }
-\newcommand{\displaypts}{%
-    \reversemarginpar
-    \geometry{hmarginratio=3:2}
-    \setboolean{marginpts}{true}
-}
 
+\definecolor{markingcolor}{named}{red}
+\newcommand{\markingstyle}[1]{\footnotesize\sffamily%
+    \centering\color{markingcolor}\textbf{#1}}
+    % inner arguments allow boxed styles
 \newlength{\ptsboxlength}
 \setlength{\ptsboxlength}{3.1em}
 \cornersize{1}
 \newcommand*{\totalexe}[1]{%
-    \ifthenelse{\boolean{marginpoints}}{%
+    \ifexesheet at pts%
         \mbox{}%
-        \marginpar{\markingstyle{\ovalbox{%
-                    \makebox[\ptsboxlength]{\pointmark{#1}}}%
-            }}%
-    }{}%
+        \marginpar{\hspace{0pt}\markingstyle{\ovalbox{%
+            \makebox[\ptsboxlength]{\ptsmark{#1}}}}}%
+    \fi%
+    \ifexesheet at checkpts%
+        \gsetlength{\exe at total}{#1pt}%
+        \gaddtolength{\sum at exe}{#1pt}%
+    \fi%
     \ignorespaces
 }
 
-\newboolean{marginpoints}
-\newboolean{marginfullnotes}
+\newcommand*{\totalsheet}[1]{
+    \gsetlength{\sheet at total}{#1pt}
+}
 
-\newcommand{\markingstyle}[1]{\hspace{0pt}\footnotesize\sffamily%
-    \centering\color{markingcolor}\textbf{#1}}
-\newcommand{\noteragged}{\raggedleft}
-\newcommand{\notestyle}[1]{\hspace{0pt}\footnotesize\sffamily%
-    \noteragged\noindent\color{notecolor} #1}
+\definecolor{notecolor}{rgb}{0.0, 0.4, 0.0} % kind of dark green
+\newcommand{\notestyle}[1]{\footnotesize\sffamily\color{notecolor} #1}
+\newcommand{\note at marginpar}[1]{%
+    \if at twoside%
+        \marginpar[\noteraggedleft #1]{\noteraggedright #1}%
+    \else%
+        \marginpar{\noteragged #1}%
+    \fi%
+}
 \newcommand{\@note}[2][]{%
-    \ifthenelse{\boolean{marginpoints}}{%
+    \ifexesheet at pts%
         \mbox{}%
-        \marginpar{%
-            \ifthenelse{\equal{#1}{}}{}{\markingstyle{#1}\\}%
-            \ifthenelse{\boolean{marginfullnotes}}{\notestyle #2}{}%
+        \note at marginpar{%
+            \ifthenelse{\equal{#1}{}}{}{{%
+                \noindent\hspace{0pt}\markingstyle{#1}\\}}%
+            \ifthenelse{\boolean{exesheet at notes}}{%
+                \noindent\hspace{0pt}\notestyle #2%
+            }{}%
         }%
-    }{}%
+    \fi%
+    \ifexesheet at checkpts%
+        \ifthenelse{\equal{#1}{}}{}{%
+            \gaddtolength{\sum at pts}{#1pt}}%
+    \fi%
     \ignorespaces
 }
 \newcommand{\@@note}[1]{%
-    \ifthenelse{\boolean{marginpoints}}{%
+    \ifexesheet at pts%
         \mbox{}%
-        \marginpar{\markingstyle{#1}}%
-    }{}%
+        \marginpar{\noindent\hspace{0pt}\markingstyle{#1}}%
+    \fi%
+    \ifexesheet at checkpts%
+        \gaddtolength{\sum at pts}{#1pt}%
+    \fi%
     \ignorespaces
 }
 \newcommand{\note}{\@ifstar{\@@note}{\@note}}
 
+\newcommand{\totalpoints}{%
+    \ifthenelse{\boolean{exesheet at pts}}{\totalexe}{\points}}
+
+\def\exs at process@correct{
+    \ifthenelse{\equal{\exesheet at correct}{false}}{
+        % do nothing
+    }{% else
+    \@ifpackageloaded{schooldocs}{
+        \ifthenelse{\equal{\exesheet at correct}{true}}{
+            \correct
+        }{% else
+        \ifthenelse{\equal{\exesheet at correct}{conditional}}{
+            \ifexesheet at answers \correct \fi
+        }{}}
+    }{
+        \PackageWarningNoLine{exesheet}{Package `schooldocs' must be loaded
+            \MessageBreak
+            to use the `correct' option}
+    }}
+}
+
+\newcommand{\questionsonly}{
+    \PackageWarning{exesheet}{Command \string\questionsonly\space
+        is deprecated, \MessageBreak
+        use `output=questions' as package option instead}
+    \renewcommand\exesheet at output{questions}
+    \exs at process@output
+}
+\newcommand{\answersonly}{
+    \PackageWarning{exesheet}{Command \string\answersonly\space
+        is deprecated, \MessageBreak
+        use `output=answers' as package option instead}
+    \renewcommand\exesheet at output{answers}
+    \exs at process@output
+}
+\newcommand{\displaypts}{%
+    \PackageWarning{exesheet}{Command \string\displaypts\space
+        is deprecated, \MessageBreak
+        use `display=pts' as package option instead}
+    \renewcommand\exesheet at display{pts}
+    \exs at process@display
+}
 \newcommand{\displaypoints}{%
-    \reversemarginpar
-    \geometry{hmarginratio=3:2}
-    \setboolean{marginpoints}{true}
+    \PackageWarning{exesheet}{Command \string\displaypoints\space
+        is deprecated, \MessageBreak
+        use `display=pts' as package option instead}
+    \renewcommand\exesheet at display{pts}
+    \exs at process@display
 }
-
-\newcommand*{\displaynotes}[1][\raggedleft]{%
-    \reversemarginpar
+\newcommand*{\displaynotes}[1][\RaggedLeft]{%
+    % \renewcommand{\noteragged}{#1} no effect now!
+    \PackageWarning{exesheet}{Command \string\displaynotes\space
+        is deprecated, \MessageBreak
+        use `display=notes' as package option instead}
+    \renewcommand\exesheet at display{notes}
+    \exs at process@display
     \renewcommand{\noteragged}{#1}
-    \geometry{hmarginratio=5:1}
-    \setlength{\marginparwidth}{\oddsidemargin}
-    \addtolength{\marginparwidth}{1in}
-    \addtolength{\marginparwidth}{-\marginparsep}
-    \setlength{\marginparwidth}{0.8\marginparwidth}
-    \setboolean{marginpoints}{true}
-    \setboolean{marginfullnotes}{true}
 }
-
-\newcommand*{\displaynotesright}[1][\raggedright]{%
-    \normalmarginpar
+\newcommand*{\displaynotesright}[1][\RaggedRight]{%
+    % \renewcommand{\noteragged}{#1} no effect now!
+    \PackageWarning{exesheet}{Command \string\displaynotes\space
+        is deprecated, \MessageBreak
+        use `display=notes, margin=right' as package options instead}
+    \renewcommand\exesheet at display{notes}
+    \exs at process@display
+    \renewcommand\exesheet at margin{right}
     \renewcommand{\noteragged}{#1}
-    \geometry{hmarginratio=1:5}
-    \setlength{\marginparwidth}{\paperwidth}
-    \addtolength{\marginparwidth}{-\textwidth}
-    \addtolength{\marginparwidth}{-\oddsidemargin}
-    \addtolength{\marginparwidth}{-\marginparsep}
-    \addtolength{\marginparwidth}{-1in}
-    \setlength{\marginparwidth}{0.8\marginparwidth}
-    \setboolean{marginpoints}{true}
-    \setboolean{marginfullnotes}{true}
 }
-\newcommand{\totalpoints}{%
-    \ifthenelse{\boolean{marginpoints}}{\totalexe}{\points}}
+
+\PackageInfo{exesheet}{Environment `tablenum' is deprecated \MessageBreak
+    and replaced by `tablenum1'. \MessageBreak
+    Options `notoc' and `nosetlist' \MessageBreak
+    are no longer supported\@gobble}
+    % gobble allow to suppress line number
 \endinput
 %%
 %% End of file `exesheet.sty'.



More information about the tex-live-commits mailing list.