% \iffalse meta-comment
%
% Copyright (C) 2003, 2004, 2008, 2010 by Yvon Henel, 
% dit « le TeXnicien de surface »
% <le.texnicien.de.surface@wanadoo.fr>
% --------------------------------------------------------------------
% 
% This file may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, either version 1.2 of this license
% or (at your option) any later version.  The latest version of this
% license is in:
%
% http://www.latex-project.org/lppl.txt
%
% and version 1.2 or later is part of all distributions of LaTeX
% version 1999/12/01 or later.
%
% \fi
%
% \iffalse
%<package|doc-sty>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package|doc-sty>\def\fileversion{v1}  
%<package|doc-sty>\def\filedate{2010/04/09}
%<package>\def\fileinfo{fichier modroman par Le TeXnicien de surface}
%<doc-sty>\def\fileinfo{fichier MODRdoctools par Le TeXnicien de surface}
%<package>\ProvidesPackage{modroman}
%<doc-sty>\ProvidesPackage{MODRdoctools}
%<package|doc-sty>   [\filedate\space\fileversion\space\fileinfo] 
%<*driver>
\documentclass{ltxdoc}
\usepackage{xspace,url,multicol}
\usepackage{modroman}[2010/04/09]
\usepackage[latin9]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english,frenchb]{babel}
\usepackage{MODRdoctools}
\IfFileExists{lmodern.sty}{\usepackage{lmodern}}{}%
\usepackage[pdfpagelabels,
            colorlinks=true,
            linkcolor=blue,
            urlcolor=blue,
            citecolor=blue]{hyperref}


% commenter la ligne suivante pour avoir un document avec le code
% \OnlyDescription
% comment out the preceding line to obtain the full code 
% with explanations in French only, sorry.
\EnableCrossrefs         
\CodelineIndex
\RecordChanges
\GlossaryPrologue{%
  \section*{{Changements / Changes}}%
  \markboth{{Changements}}{{Changements}}}
\IndexPrologue{\section*{Index}\markboth{Index}{Index}%
  Les nombres en italique renvoient à la page où l'entrée est décrite ; les
  nombres soulignés renvoient à la ligne de code de la définition ; les
  nombres en caractères romains renvoient à la ligne de code où l'entrée est
  utilisée.

  \begin{otherlanguage}{english}\itshape{}
    Numbers written in italic refer to the page where the
    corresponding entry is described; numbers underlined refer to the
    code line of the definition; numbers in roman refer to the code
    lines where the entry is used.
  \end{otherlanguage}}
\def\generalname{Général / \emph{General}}
\begin{document}
  \DocInput{modroman.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{506}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \changes{v0.1}{2003/04/20}{Version initiale\EnAnglais{Initial
% version}}
% 
% \changes{v0.2}{2004/02/11}{Ajout des options upourv et
% vpourv\EnAnglais{Add options upourv and vpourv}}
% 
% \changes{v0.3}{2004/05/18}{Correction de bogue: 101 s'écrit enfin
% cj\EnAnglais{Bug corrected: 101 is at last written cj}}
% 
% \changes{v0.3}{2004/05/18}{Quelques actions cosmétiques sur la
% documentation\EnAnglais{Some cosmetic actions on the documentation}}
% 
% \changes{v0.3}{2004/05/18}{Attirail pour *nix et
% CTAN\EnAnglais{Provides CTAN-ware and *nix tool}}
% 
% \changes{v1}{2010/04/03}{Réécriture complete du code, versions
% purement développables\EnAnglais{Rewriting of the code, purely
% expandable versions}}
% 
% \changes{v1}{2010/04/03}{Renommage des macros
% internes\EnAnglais{Renaming of the internal macros}}
% 
% \changes{v1}{2010/04/04}{Nouvelles options: ifinal, jfinal,
% sansmod\EnAnglais{New options: ifinal, jfinal, sansmod}}
% 
% \changes{v1}{2010/04/04}{Utilisation de l'extension
% \texttt{etoolbox}\EnAnglais{Uses the \texttt{etoolbox} package}}
% 
% \changes{v1}{2010/04/04}{Réorganisation de la
% documentation\EnAnglais{Reorganisation of the documentation}}
% 
% \GetFileInfo{modroman.sty}
%
% \DoNotIndex{\newcommand,\newenvironment,\fi,\ ,\ifx,\if,\ifnum,^^A 
% \def,\csname,\endcsname,\expandafter,\ExecuteOptions,\else,^^A 
% \afterassignment,\let,\@ifdefinable,\ProcessOptions,^^A 
% \renewcommand,\newcounter,\providecommand,\numexpr,^^A 
% \newtoggle,\toggletrue,\togglefalse,\iftoggle,\nottoggle,^^A 
% \csuse,^^A 
% \ifthenelse,\equal,^^A 
% \Roman,\roman,\romannumeral,\@Roman,^^A 
% \DeclareOption,\RequirePackage,\newcount,\relax,{}}
%
% \title{L'extension \textsf{modroman}\thanks{%
% Ce document correspond au fichier 
% \textsf{modroman}~\fileversion, du \filedate.}\quad
% The package \textsf{modroman}\thanks{%
% This document corresponds to the file
% \textsf{modroman}~\fileversion, dated \filedate.}}
% 
% \author{\href{mailto:le.texnicien.de.surface@wanadoo.fr}{Le \TeX
% nicien de surface}}
%
% \maketitle
%
% \begin{abstract}
%   \MODRdescrofr
% 
%   La documentation française pour l'utilisateur finale est désormais
%   disponible sous le nom de \texttt{modroman-fr}.
% \end{abstract}
% \begin{otherlanguage}{english}
%   \begin{abstract}
%     \MODRdescroen
% 
%     The English documentation for the final user of the package
%     \Pkg{modroman} is available in the file \texttt{modroman-en}.
%   \end{abstract}
% \end{otherlanguage}
%
% \StopEventually{\input{MODRbiblio}\newpage\PrintIndex\PrintChanges}
% 
% \iffalse
%<*doc-sty>
\RequirePackage{ifthen}
\newcommand{\TO}{\textemdash\ \ignorespaces}
\newcommand{\TF}{\unskip\ \textemdash\xspace}
\newcommand{\CAD}{%
  \iflanguage{frenchb}{c.-à-d.}{%
    \iflanguage{english}{i.~e.}{%
    \PackageError{MODRdoctools}%
      {undefined language}%
      {fix it before going on}}}\xspace}
\newcommand\BOP{\discretionary{}{}{}}
\newcommand\Option[1]{\textsc{#1}}
\newcommand\Pkg[1]{\textsf{#1}}
\newcommand\NOUVO{%
  \marginpar{\hspace*{\stretch{1}}%
    \textbf{N (v1)}\hspace*{.5em}}\xspace} 
\newcommand\DescribeOption[1]{\leavevmode\@bsphack
  \marginpar{\raggedleft \textsc{#1}}\index{#1 (option)}\@esphack}
\newcommand\PD{\textbf{[PD]}}
\newcommand\LT{\textbf{[\LaTeX]}}
\newcommand\TX{\textbf{[\TeX]}}

\newcounter{EXEMPLE}
\newcommand\Exemple[1]{\setcounter{EXEMPLE}{#1}\modroman{EXEMPLE}}

\newcommand\UnExemple[2]{\par\noindent\cs{nb#1}\texttt{\{#2\}}
  \(\longrightarrow\) \csuse{nb#1}{#2}\par} 
\newcommand\Exemples[1]{%
  \par\noindent\hrulefill\par\noindent
  \iflanguage{frenchb}{\textbf{Exemples}}{%
    \iflanguage{english}{\textbf{Examples}}{}}
  \UnExemple{#1}{1}\UnExemple{#1}{11}%
  \UnExemple{#1}{444}%
  \UnExemple{#1}{888}\UnExemple{#1}{1999}%
  \par\noindent\hrulefill\par}

\newenvironment{Anglais}[1][***]{%
  \par\ifthenelse{\equal{#1}{***}}{\noindent}{}%
  \begin{otherlanguage}{english}\itshape}%
  {\end{otherlanguage}}
\newcommand\EnAnglais[1]{ / \emph{\foreignlanguage{english}{#1}}}
\newcommand\MODRdescrofr{%
  Cette petite extension fournit des macros qui permettent d'écrire
  les nombres en chiffres romains avec quelques modifications. 

  On dispose de macros permettant d'obtenir \og \nbshortroman{1}\fg
  pour~1 et \og \nbshortroman{18}\fg pour~18; \og
  \nblongroman{999}\fg ou \og \nbLongRoman{999}\fg pour~999.

  Avec l'option \Option{upourv} \TO opposée de \Option{vpourv} option
  par défaut\TF on obtient \og xuj\fg pour~15. Avec l'option
  \Option{ifinal} \TO opposée de \Option{jfinal} option par défaut\TF
  on peut obtenir \og xiiii\fg pour~14.
  
  Certaines macros s'utilisent comme le \cs{romannumeral} de \TeX,
  d'autres, purement développables, sont destinées à formater un
  compteur \TO comme le \cs{roman} de \LaTeX\TF ou un nombre.

  Elle offre aussi une macro \TO
  \cs{printntimes}\marg{nombre}\marg{texte}\TF qui permet d'obtenir
  \meta{nombre} fois le \marg{texte} comme
  \texttt{\printntimes{10}{*}} obtenu avec
  \texttt{\cs{printntimes}\{10\}\{*\}}.}

\newcommand\MODRdescroen{%
  This short package provides macros which enable one to write roman
  numerals with some modifications.

  It provides macros with which one can obtain `\nbshortroman{1}'
  for~1 and `\nbshortroman{18}' for~18; `\nblongroman{999}' or
  `\nbLongRoman{999}' for~999.

  With option \Option{upourv} \TO opposite of \Option{vpourv} default
  option \TF one obtains `xuj' for~15. With option \Option{ifinal} \TO
  opposite of \Option{jfinal} default option\TF one can obtain `xiiii'
  for~14.

  Some of the macros are used as \TeX{} \cs{romannumeral}, others,
  purely expandable, are devoted to format a counter \TO as \LaTeX{}
  \cs{roman}\TF or a number.

  It also provides a macro \TO
  \cs{printntimes}\marg{number}\marg{text}\TF which produces
  \meta{number} times the \marg{text} as e.g.
  \texttt{\printntimes{10}{*}} obtained with
  \texttt{\cs{printntimes}\{10\}\{*\}}.}
%</doc-sty>
% \fi
%
% \iffalse
%<*biblio>
\begin{thebibliography}{9}
\bibitem{tlachand} T.~\textsc{Lachand-Robert}.
\emph{La maîtrise de \TeX{} et \LaTeX{}}.
Masson, Paris, Milan, Barcelone, \oldstylenums{1995}.
\textsc{isbn} : \texttt{2-225-84832-7}.
\bibitem{source2e} Johannes \textsc{Braams}, David
  \textsc{Carlisle}, Alan \textsc{Jeffrey}, Leslie \textsc{Lamport},
  Frank \textsc{Mittelbach}, Chris \textsc{Rowley}, Rainer
  \textsc{Schöpf}. \emph{The \LaTeXe{} sources}. 2009/09/24.
\end{thebibliography}
%</biblio>
% \fi
% 
% \iffalse
%<*package> 
% \fi
% \section{Le code/The Code}
% 
% Si les années qui passent ne me rendent pas beaucoup plus malin,
% elles ont un avantage: à force de lire des documentations
% d'extension, je finis par en connaitre davantage et il m'arrive de
% buter par hasard sur la solution à un problème que je n'avais fait
% qu'entrevoir.
% \begin{Anglais}
%   As the years go by I don't really become more clever but, for I
%   read not a few documentations of packages I happen to know a bit
%   more and I happen to stumble upon the solution to a problem I had
%   just caught a glimpse of.
% \end{Anglais}
% 
% Je n'oublie pas les idées --~nombreuses~-- , les exemples
% --~détaillés~-- et les explications --~claires~-- fournis par
% T.~\textsc{Lachand}-\textsc{Robert} dans~\cite{tlachand} mais je
% m'abreuve désormais aussi à d'autres sources --
% \texttt{source2e}~\cite{source2e} pour être précis -- et c'est là
% que j'ai trouvé l'\emph{astuce} qui me permet de fournir cette
% nouvelle version de \Pkg{modroman}. Le lecteur intéressé jettera
% un coup d'\oe il sur la définition de la macro \cs{Roman} et ses macros
% auxiliaires.
% \begin{Anglais}[1]
%   I don't forget what I owe to T.~\textsc{Lachand}-\textsc{Robert}
%   in~\cite{tlachand} -- numerous ideas, detailed examples, clear
%   explanations -- but I now use other sources --
%   \texttt{source2e}~\cite{source2e} to be accurate. That is where I
%   have found the \emph{trick} which enables me to provide this new
%   version of \Pkg{modroman}. The reader who would like to know
%   more should have a look at the definition of the macro \cs{Roman}
%   and its auxiliary macros.
% \end{Anglais}
% 
% Il est temps de présenter le code.
% \begin{Anglais}[1]
%   And now for the code.
% \end{Anglais}
% 
% Je charge, et j'utilise, désormais l'extension \Pkg{etoolbox}. Les
% \emph{toggle}s \TO en français \og touche à bascule\fg, je parlerai
% désormais de \og bascule\fg\TF correspondent à des booléens mais qui
% offrent quelques avantages par rapport aux traditionnels \cs{if} de
% \TeX. Je définis les options dont les cinq qui apparaissent avec la
% version~1.
% \begin{Anglais}[1]
%   I load, and use, the package \Pkg{etoolbox}. The \emph{toggle}s
%   are booleans which provides some interresting properties different
%   from those of the traditionnal \cs{if} of \TeX. I define the
%   options among which the five ones appearing with the version~1.
% \end{Anglais}
% 
% Les macros internes de l'extension portent toutes un nom commençant
% par \cs{M@DR@}. Pour elles je ne fais pas de vérification avant
% définition à moins qu'elle ne soit faite automatiquement comme avec
% \cs{newcommand}.
% \begin{Anglais}[1]
%   The internal macros of this package have all a name which begins
%   with \cs{M@DR@}. I don't check if those are definable unless it is
%   automatically done as when using \cs{newcommand}.
% \end{Anglais}
%    \begin{macrocode}
\RequirePackage{ifthen}
\RequirePackage{etoolbox}
%    \end{macrocode}
% Quatre bascules pour 5~options toutes placées à \texttt{faux} pour
% commencer.
% \begin{Anglais}
%   Four toggles for 5~options, all of them set to \texttt{false} at
%   the beginning.
% \end{Anglais}
%    \begin{macrocode}
\newtoggle{M@DR@upourv}\togglefalse{M@DR@upourv}
\newtoggle{M@DR@ifinal}\togglefalse{M@DR@ifinal}
\newtoggle{M@DR@longrn}\togglefalse{M@DR@longrn}
\newtoggle{M@DR@majrn}\togglefalse{M@DR@majrn}
\newtoggle{M@DR@sansmod}\togglefalse{M@DR@sansmod}
%    \end{macrocode}
%    \begin{macrocode}
\DeclareOption{vpourv}{\togglefalse{M@DR@upourv}}
\DeclareOption{upourv}{\toggletrue{M@DR@upourv}}
\DeclareOption{jfinal}{\togglefalse{M@DR@ifinal}}
\DeclareOption{ifinal}{\toggletrue{M@DR@ifinal}}
\DeclareOption{long}  {\toggletrue{M@DR@longrn}}
\DeclareOption{court} {\togglefalse{M@DR@longrn}}
\DeclareOption{maj}  {\toggletrue{M@DR@majrn}}
\DeclareOption{min} {\togglefalse{M@DR@majrn}}
\DeclareOption{sansmod}{\toggletrue{M@DR@sansmod}}
\DeclareOption*{\PackageError{modroman}{%
The option \CurrentOption\space is not known!\MessageBreak 
}{%
The possible options are (the first is the default):\MessageBreak  
``vpourv'' or ``upourv''\MessageBreak 
``jfinal'' or ``ifinal''\MessageBreak 
``court'' or ``long''\MessageBreak 
``min'' or ``maj''\MessageBreak 
``sansmod''.}}
\ExecuteOptions{vpourv,jfinal,court,min}
\ProcessOptions\relax
%    \end{macrocode}
% Si les bascules |M@DR@upourv|, |M@DR@longrn| et
% |M@DR@|\BOP|maj|\BOP|rn| sont fausses et que la bascule
% |M@DR@ifinal| est vraie, on fait comme si l'on avait passé l'option
% |sansmod| vu que ça revient à ça.
% \begin{Anglais}
%   If the toggles |M@DR@upourv|, |M@DR@majrn| and
%   |M@DR@|\BOP|long|\BOP|rn| are false and the toggle
%   |M@DR@|\BOP|i|\BOP|fi|\BOP|nal| is true, it is as if one had
%   chosen the option |sansmod|, in any case the result is the same.
% \end{Anglais}
%    \begin{macrocode}
\nottoggle{M@DR@upourv}{%
  \iftoggle{M@DR@ifinal}{%
    \nottoggle{M@DR@longrn}{%
      \nottoggle{M@DR@majrn}{%
        \toggletrue{M@DR@sansmod}}{}}{}}{}}{}
%    \end{macrocode}
% 
% J'ai besoin d'un compteur, je le déclare à la mode \LaTeX{} ce qui
% permet de ne pas pertuber la gestion des compteurs dont \LaTeX{} se
% charge mais qui obligera, plus bas, à utiliser \cs{c@M@DR@romt@mp}
% qui est le nom \TeX{} du compteur.
% \begin{Anglais}[1]
%   I need a counter and I declare it \emph{à la} \LaTeX{} so not to
%   disturb the management \LaTeX{} does of the counters but, below, I
%   will have to use \cs{c@M@DR@romt@mp} which is the name of the
%   counter for \TeX.
% \end{Anglais}
%    \begin{macrocode}
\newcounter{M@DR@romt@mp}
%    \end{macrocode}
% Suivant l'option choisie parmi \Option{upourv} et \Option{vpourv} je
% définis la commande \cs{M@DR@v} qui contient la représentation du
% chiffre romain \og v\fg.
% \begin{Anglais}
%   According to the option chosen among \Option{upourv} and
%   \Option{vpourv}, I define the macro \cs{M@DR@v} which contains the
%   representation of the roman digit `v'.
% \end{Anglais}
%    \begin{macrocode}
\iftoggle{M@DR@upourv}{\newcommand*\M@DR@v{u}}{\newcommand*\M@DR@v{v}}
%    \end{macrocode}
% Je fais la même chose pour \cs{M@DR@j} qui contient la
% représentation du i final \TO comme dans \nbroman{8}\TF, en accord
% avec les options \Option{ifinal} ou \Option{jfinal}.
% \begin{Anglais}
%   I do the same for \cs{M@DR@j} which contains the representation of
%   the final i \TO as seen in \nbroman{8}\TF, according to the option
%   \Option{ifinal} or \Option{jfinal}.
% \end{Anglais}
%    \begin{macrocode}
\iftoggle{M@DR@ifinal}{\newcommand*\M@DR@j{i}}{\newcommand*\M@DR@j{j}}
%    \end{macrocode}
% Maintenant, les représentations des autres chiffres romains.
% \begin{Anglais}
%   Now the representations of the other roman digits.
% \end{Anglais}
%    \begin{macrocode}
\newcommand*\M@DR@m{m}
\newcommand*\M@DR@d{d}
\newcommand*\M@DR@c{c}
\newcommand*\M@DR@l{l}
\newcommand*\M@DR@x{x}
\newcommand*\M@DR@i{i}
\newcommand*\M@DR@isol{i}
%    \end{macrocode}
% 
% \begin{macro}{\RedefineMRmdclxvij} Une macro qui permet à
%   l'utilisateur de redéfinir les représentations des chiffres
%   romains. Elle permet quelques effets amusants comme le montre la
%   macro \cs{printntimes}.
% 
%   Elle a 9~arguments dont un par optionnel, si l'argument optionnel
%   est égal à |M@DR@***| \TO cas par défaut\TF \cs{M@DR@isol} prend
%   la même valeur que \cs{M@DR@i} \CAD que le \og i isolé\fg pour~1
%   et le \og i intermédiaire\fg \TO celui de \og
%   \nbshortroman{12}\fg\TF ont la même forme, sinon l'argument
%   optionnel fixe la valeur de \cs{M@DR@isol}.
%   \begin{Anglais}[1]
%     The macro \cs{RedefineMRmdclxvij} enables the user to redefine
%     the roman digits. It makes possible some funny tricks of which
%     \cs{printntimes} is but an example.
% 
%     It takes 9~arguments the first of which is optional. If that
%     argument equals |M@DR@***| \TO default value\TF \cs{M@DR@isol}
%     has the same value as \cs{M@DR@i} \CAD the `isolated i' for~1
%     and the `intermediary i' \TO the one in
%     `\nbshortroman{12}'\TF has the same shape, else the optional
%     argument set the value of \cs{M@DR@isol}.
%   \end{Anglais}
%    \begin{macrocode}
\newcommand*\RedefineMRmdclxvij[9][M@DR@***]{%
  \ifthenelse{\equal{#1}{M@DR@***}}%
    {\renewcommand*\M@DR@isol{#8}}%
    {\renewcommand*\M@DR@isol{#1}}%
  \renewcommand*\M@DR@m{#2}%
  \renewcommand*\M@DR@d{#3}%
  \renewcommand*\M@DR@c{#4}%
  \renewcommand*\M@DR@l{#5}%
  \renewcommand*\M@DR@x{#6}%
  \renewcommand*\M@DR@v{#7}%
  \renewcommand*\M@DR@i{#8}%
  \renewcommand*\M@DR@j{#9}}
%    \end{macrocode}
% \end{macro}
% 
% \subsection{Version courte minuscule / Short lowercase version}
% 
% \begin{macro}{\shortroman}
%   Cette macro prend un seul argument qui est un nom de compteur
%   \LaTeX \TO p.~ex. \texttt{machin}. Elle se contente de lancer
%   \cs{M@DR@shortmodromain} sur le compteur \TeX{} associé \TO
%   \cs{c@machin}.
%   \begin{Anglais}
%     The macro takes one argument which is the name of a \LaTeX{}
%     counter \TO e.g. \texttt{thingummy}. It just passes to
%     \cs{M@DR@shortmodromain} the \TeX{} associated counter \TO
%     \cs{c@thingummy}.
%   \end{Anglais}
%    \begin{macrocode}
\newcommand\shortroman[1]{%
  \expandafter\M@DR@shortmodromain\csname c@#1\endcsname}
%    \end{macrocode}
% Si le compteur a pour valeur~1, on obtient \og \cs{M@DR@isol}\fg
% sinon on lance
% \cs{M@DR@}\BOP|En|\BOP|short|\BOP|mod|\BOP|ro|\BOP|main| sur la
% représentation du compteur en nombre romain minuscule suivi de |@@|
% qui servira de sentinelle ci-dessous.
% \begin{Anglais}
%   If the value of the counter is~1, one obtains `\cs{M@DR@isol}'
%   else the lowercase roman numeral representation of the counter,
%   completed by |@@| which will be used below as a sentry, is passed
%   to \cs{M@DR@}\BOP|En|\BOP|short|\BOP|mod|\BOP|ro|\BOP|main|.
% \end{Anglais}
%    \begin{macrocode}
\newcommand\M@DR@shortmodromain[1]{%
  \ifnum #1=1 \M@DR@isol\else
  \expandafter\M@DR@shmdromain\romannumeral #1@@\fi}
%    \end{macrocode}
% La macro \cs{M@DR@shmdromain} prend deux arguments; ce seront
% deux chiffres romains ou |@|.
% \begin{Anglais}
%   The macro \cs{M@DR@shmdromain} takes two arguments which
%   will be two roman digits or |@|.
% \end{Anglais}
%    \begin{macrocode}
\def\M@DR@shmdromain#1#2{%
  \ifx#1@%
%    \end{macrocode}
% L'aventure s'achève ici si le 1\ier argument est~|@| sinon on
% poursuit en regardant si on a un~|v| auquel cas on place
% \cs{M@DR@v}.
% \begin{Anglais}
%   Here finishes the adventure if the 1st argument is~|@| else it
%   goes on and looks if we have a~|v| in which case we place
%   \cs{M@DR@v}.
% \end{Anglais}
%    \begin{macrocode}
  \else
    \if#1v\M@DR@v
%    \end{macrocode}
% Sinon, on regarde si on a un |i|
% \begin{Anglais}Else it tests for an~|i|\end{Anglais}
%    \begin{macrocode}
    \else
      \if#1i%
%    \end{macrocode}
% puis on regarde le 2\ieme argument et si ce dernier est un |@| c'est
% que le~|i| est final et on place \cs{M@DR@j} sinon on place
% \cs{M@DR@i}
% \begin{Anglais}
%   then it looks at the 2nd argument. If that argument is a~|@| then
%   the~|i| is final and we put \cs{M@DR@j} else we put \cs{M@DR@i}
% \end{Anglais}
%    \begin{macrocode}
        \ifx#2@\M@DR@j\else\M@DR@i\fi
%    \end{macrocode}
% dans les autres cas \TO \CAD le 1\ier argument n'est ni |v| ni
% |i|\TF on place la bonne macro en la construisant à la volée avec le
% \cs{csuse} de \Pkg{etoolbox}.
% \begin{Anglais}
%   in the other cases \TO i.~e. the 1st argument is neither~|v|
%   nor~|i| \TF we place the correct macro by building it on fly with
%   the \cs{csuse} of \Pkg{etoolbox}.
% \end{Anglais}
%    \begin{macrocode}
      \else\csuse{M@DR@#1}%
      \fi
    \fi
%    \end{macrocode}
% On termine en appelant une macro auxiliaire en replaçant le 2\ieme
% argument en tête.
% \begin{Anglais}
%   We end by calling an auxiliary macro putting back the 2nd argument
%   at the head.
% \end{Anglais}
%    \begin{macrocode}
  \M@DR@shmdromainAux#2\fi}
%    \end{macrocode}
% Le \emph{truc} du \cs{fi} permet de fermer correctement le test
% principal de
% \cs{M@DR@}\BOP|En|\BOP|short|\BOP|mod|\BOP|ro|\BOP|main|.
% \begin{Anglais}
%   The \emph{trick} of \cs{fi} enables us to correctly close the main
%   test of \cs{M@DR@}\BOP|En|\BOP|short|\BOP|mod|\BOP|ro|\BOP|main|.
% \end{Anglais}
%    \begin{macrocode}
\def\M@DR@shmdromainAux#1\fi{\fi\M@DR@shmdromain#1}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\nbshortroman}
%   Cette macro prend un nombre et le passe à
%   \cs{M@DR@shortmodromain}. Les accolades dans la définition sont
%   absolument nécessaires si on ne veut pas que seul le 1\ier chiffre
%   soit traité.
% \begin{Anglais}
%   The macro \cs{nbshortroman} takes a number as only
%   argument. The curly braces in the definition are absolutely
%   indispensable for without them only the first digit would be taken
%   into account.
% \end{Anglais}
%    \begin{macrocode}
\newcommand\nbshortroman[1]{\M@DR@shortmodromain{#1}}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\shortromannumeral}
%   Cette macro s'emploie comme \cs{romannumeral} de \TeX. Elle doit
%   être suivie d'un nombre et elle mange les espaces qui le suivent.
%   Grace à \cs{afterassignment}, la macro
%   \cs{M@DR@}\BOP|short|\BOP|mod|\BOP|ro|\BOP|main| reçoit le
%   compteur comme argument après qu'il a reçu pour valeur le nombre
%   qui doit suivre.
%   \begin{Anglais}
%     The macro is used as \TeX{} \cs{romannumeral}. It must be
%     followed by a number and eats the spaces that follow it. Thanks
%     to \cs{afterassignment}, the macro
%     \cs{M@DR@}\BOP|short|\BOP|mod|\BOP|ro|\BOP|main| receives the
%     counter after it has been assigned the number which must follow.
%   \end{Anglais}
%    \begin{macrocode}
\newcommand\shortromannumeral{%
  \afterassignment\M@DR@shortmodrom@naux \c@M@DR@romt@mp=}
\def\M@DR@shortmodrom@naux{\M@DR@shortmodromain\c@M@DR@romt@mp}
%    \end{macrocode}
% \end{macro}
% 
% \subsection{Version longue minuscule / Long Lowercase Version}
% 
% Cette fois il s'agit d'écrire les nombres romains \emph{à
% l'ancienne} \CAD sans utiliser la préposition pour soustraire. Dans
% ce cas 49 est écrit \nblongroman{49}.
% \begin{Anglais}[1]
%   Now the aim is to write roman numerals the \emph{old way}
%   i.~e. without using the preposition to subtract. In that case 49
%   is written \nblongroman{49}.
% \end{Anglais}
% 
% \begin{macro}{\longroman}
% Macro pour l'utilisateur, elle attend un nom de compteur \LaTeX{}
% pour unique argument.
% \begin{Anglais}
%   User macro which must be given a \LaTeX{} counter name as only
%   argument.
% \end{Anglais}
%    \begin{macrocode}
\newcommand\longroman[1]{%
  \expandafter\M@DR@longmodromain\csname c@#1\endcsname}
%    \end{macrocode}
% Macro auxiliaire qui ressemble à \cs{M@DR@shortmodromain} sauf
% qu'elle n'ajoute qu'un |@| comme sentinelle.
% \begin{Anglais}
%   Auxiliary macro which looks like \cs{M@DR@shortmodromain} but add
%   just one |@| as a sentry.
% \end{Anglais}
%    \begin{macrocode}
\def\M@DR@longmodromain#1{%
  \ifnum#1=1 \M@DR@isol\else
  \expandafter\M@DR@Faire\romannumeral #1@\fi}
%    \end{macrocode}
% J'ai besoin de connaitre deux chiffres romains pour décider d'une
% action mais je ne peux pas prendre un groupe de deux chiffres
% directement.  Les macros \cs{M@DR@Faire@}|<une lettre>| sont là pour
% conserver la mémoire du dernier chiffre lu et agir en fonction du
% suivant.
% \begin{Anglais}
%   I need to know two roman digits to decide which action to perform
%   but I can't take a group of two letters directly. The
%   \cs{M@DR@Faire@}\BOP|<one letter>| are there to keep the memory of
%   the last read digit and act according to the next.
% \end{Anglais}
%    \begin{macrocode}
\def\M@DR@Faire#1{\ifx#1@\else\csuse{M@DR@Faire@#1}\fi}
%    \end{macrocode}
% La macro \cs{M@DR@Faireaux} ferme le \cs{if} principal et relance la
% procédure.
% \begin{Anglais}
%   The macro \cs{M@DR@Faireaux} closes the main \cs{if} and restart
%   the process.
% \end{Anglais}
%    \begin{macrocode}
\def\M@DR@Faireaux\fi{\fi\M@DR@Faire}
%    \end{macrocode}
% Pour les lettres |m|, |d|, |l| et |v| les choses sont simples.
% \begin{Anglais}
%   For the letters |m|, |d|, |l|, and |v| things are simples.
% \end{Anglais}
%    \begin{macrocode}
\def\M@DR@Faire@m\fi{\fi\M@DR@m\M@DR@Faire}
\def\M@DR@Faire@d\fi{\fi\M@DR@d\M@DR@Faire}
\def\M@DR@Faire@l\fi{\fi\M@DR@l\M@DR@Faire}
\def\M@DR@Faire@v\fi{\fi\M@DR@v\M@DR@Faire}
%    \end{macrocode}
% Cas du |i| qui sera réécrit ou pas suivant la valeur du chiffre
% suivant. Une condition supplémentaire pour le~|i|, il faut écrire
% \cs{M@DR@j} lorsque le~|i| est final.
% \begin{Anglais}
%   The case of |i| which will be rewritten or not according to the
%   value of the next digit. An additional condition for~|i|, we have
%   to write \cs{M@DR@j} if it is final.
% \end{Anglais}
%    \begin{macrocode}
\def\M@DR@Faire@i\fi{\fi\M@DR@Faire@i@aux}
\def\M@DR@Faire@i@aux#1{%
  \ifx#1@\M@DR@j%
  \else\if#1x\M@DR@v\M@DR@i\M@DR@i\M@DR@i\M@DR@j%
    \else\if#1v\M@DR@i\M@DR@i\M@DR@i\M@DR@j%
      \else \M@DR@i\M@DR@Faire@i@auxaux\fi\fi
  \M@DR@Faireaux\fi}
\def\M@DR@Faire@i@auxaux\fi\fi\M@DR@Faireaux{\fi\fi \M@DR@Faire@i}
%    \end{macrocode}
% Cas du |x|, pas de |x| final.
% \begin{Anglais}The cas of |x|, no final |x|.\end{Anglais}
%    \begin{macrocode}
\def\M@DR@Faire@x\fi{\fi \M@DR@Faire@x@aux}
\def\M@DR@Faire@x@aux#1{%
  \ifx#1@\M@DR@x%
  \else
    \if#1c\M@DR@l\M@DR@x\M@DR@x\M@DR@x\M@DR@x
    \else
      \if#1l\M@DR@x\M@DR@x\M@DR@x\M@DR@x
      \else \M@DR@x\M@DR@FaireAuxAux#1\fi\fi
  \M@DR@Faireaux\fi}
\def\M@DR@FaireAuxAux#1\fi\fi\M@DR@Faireaux\fi{\fi\fi\fi\M@DR@Faire#1}
%    \end{macrocode}
% Cas du |c|, pas de |c| final non plus.
% \begin{Anglais}The case of |c|, no final |c| either.\end{Anglais}
%    \begin{macrocode}
\def\M@DR@Faire@c\fi{\fi \M@DR@Faire@c@aux}
\def\M@DR@Faire@c@aux#1{%
  \ifx#1@\M@DR@c% FIN
  \else
    \if#1d\M@DR@c\M@DR@c\M@DR@c\M@DR@c
    \else
     \if#1m\M@DR@d\M@DR@c\M@DR@c\M@DR@c\M@DR@c
     \else \M@DR@c\M@DR@FaireAuxAux#1\fi\fi
  \M@DR@Faireaux\fi}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\nblongroman}
%    \begin{macrocode}
\newcommand\nblongroman[1]{\M@DR@longmodromain{#1}}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\longromannumeral}
%    \begin{macrocode}
\newcommand\longromannumeral{%
  \afterassignment\M@DR@longmodrom@naux \c@M@DR@romt@mp=}
\def\M@DR@longmodrom@naux{\M@DR@longmodromain\c@M@DR@romt@mp}
%    \end{macrocode}
% \end{macro}
% \subsection{Version longue capitale / Long Uppercase Version}
% 
% L'idée principale est la même que ci-dessus sauf que on ne fait pas
% appel au macro \cs{M@DR@}\BOP|<une lettre>| car la version courte,
% fournie par \LaTeX{} avec \cs{Roman} ne permet pas les
% fantaisies. Si l'on voulait des effets spéciaux, il suffirait
% d'utiliser la version longue minuscule et jouer avec 
% \cs{Re}\BOP|de|\BOP|fi|\BOP|ne|\BOP|MR|\BOP|md|\BOP|cl|\BOP|xv|\BOP|ij|.
% \begin{Anglais}[1]
%   The main idea is the same as above but here I don't use macro
%   \cs{M@DR@}\BOP|<one letter>| for the short version provided for by
%   \LaTeX{} with \cs{Roman} doesn't allow fancy work. If one wants
%   special effects, one can use the long lowercase version and play
%   with
%   \cs{Re}\BOP|de|\BOP|fi|\BOP|ne|\BOP|MR|\BOP|md|\BOP|cl|\BOP|xv|\BOP|ij|.
% \end{Anglais}
%    \begin{macrocode}
\def\M@DR@LongRomain#1{%
  \ifnum#1=1 I\else
  \expandafter\M@DR@FAIRE\romannumeral #1@\fi}
%    \end{macrocode}
%    \begin{macrocode}
\def\M@DR@FAIRE#1{\ifx#1@\else\csuse{M@DR@FAIRE#1}\fi}
%    \end{macrocode}
%    \begin{macrocode}
\def\M@DR@FAIREaux\fi{\fi \M@DR@FAIRE}
%    \end{macrocode}
%    \begin{macrocode}
\def\M@DR@FAIREm\fi{\fi M\M@DR@FAIRE}
\def\M@DR@FAIREd\fi{\fi D\M@DR@FAIRE}
\def\M@DR@FAIREl\fi{\fi L\M@DR@FAIRE}
\def\M@DR@FAIREv\fi{\fi V\M@DR@FAIRE}
%    \end{macrocode}
% Cas du |i|.\begin{Anglais}The case of |i|.\end{Anglais}
%    \begin{macrocode}
\def\M@DR@FAIREi\fi{\fi \M@DR@FAIREIaux}
\def\M@DR@FAIREIaux#1{%
  \ifx#1@I% FIN
  \else\if#1xVIIII\else\if#1vIIII\else I\M@DR@FAIREAuxAux#1\fi\fi
  \M@DR@FAIREaux\fi}
%    \end{macrocode}
% Cas du |x|.\begin{Anglais}The case of |x|.\end{Anglais}
%    \begin{macrocode}
\def\M@DR@FAIREx\fi{\fi \M@DR@FAIREXaux}
\def\M@DR@FAIREXaux#1{%
  \ifx#1@X% FIN
  \else\if#1cLXXXX\else\if#1lXXXX\else X\M@DR@FAIREAuxAux#1\fi\fi
  \M@DR@FAIREaux\fi}
\def\M@DR@FAIREAuxAux#1\fi\fi\M@DR@FAIREaux\fi{\fi\fi\fi\M@DR@FAIRE#1}
%    \end{macrocode}
%  Cas du |c|.\begin{Anglais}The case of |c|.\end{Anglais}
%    \begin{macrocode}
\def\M@DR@FAIREc\fi{\fi \M@DR@FAIRECaux}
\def\M@DR@FAIRECaux#1{%
  \ifx#1@C% FIN
  \else\if#1dCCCC\else\if#1mDCCCC\else C\M@DR@FAIREAuxAux#1\fi\fi
  \M@DR@FAIREaux\fi}
%    \end{macrocode}
% \begin{macro}{\LongRoman}
%    \begin{macrocode}
\newcommand\LongRoman[1]{%
  \expandafter\M@DR@LongRomain\csname c@#1\endcsname}
%    \end{macrocode} 
% \end{macro}
% \begin{macro}{\nbLongRoman}
%    \begin{macrocode}
\newcommand\nbLongRoman[1]{\M@DR@LongRomain{#1}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\LongRomannumeral}
%    \begin{macrocode}
\newcommand\LongRomannumeral{%
  \afterassignment\M@DR@LongRom@naux \c@M@DR@romt@mp=}
\def\M@DR@LongRom@naux{\M@DR@LongRomain\c@M@DR@romt@mp}
%    \end{macrocode}
% \end{macro}
% 
% \subsection{Autres macros / Other macros}
% 
% Je fournis ici quelques macros d'accompagnement des macros \TeX{} et
% \LaTeX{}.
% \begin{Anglais}[1]
%   I provide here some macros to go with the \TeX{} and \LaTeX{}
%   macros.
% \end{Anglais}
% \begin{macro}{\nbroman}
%    \begin{macrocode}
\newcommand\nbroman[1]{\romannumeral #1\relax}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\nbRoman}
% \cs{@Roman} est une \emph{macro cachée} du noyau de \LaTeXe.
% \begin{Anglais}
%   \cs{@Roman} is a \emph{hidden macro} of the kernel of \LaTeXe.
% \end{Anglais}
%    \begin{macrocode}
\newcommand\nbRoman[1]{\@Roman{#1}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\Romannumeral}
% Je ne reprends pas le code de \cs{Romannumeral} que l'on peut
% trouver dans \Pkg{bulgarian.ldf} car je pense que ma version, qui
% tire profit de l'existence du compteur \LaTeX ien
% \texttt{M@DR@romt@mp} est \emph{moins pire} \texttt{;-)} D'où le
% \cs{providecommand}.
% \begin{Anglais}
%   I don't take the code of \cs{Romannumeral} which can be found in
%   \Pkg{bulgarian.ldf} for I think that my version, which makes
%   profit of the \LaTeX{} counter \texttt{M@DR@romt@mp} is \emph{less
%   worse} \texttt{;-)}. Hence the \cs{providecommand}.
% \end{Anglais}
%    \begin{macrocode}
\providecommand\Romannumeral{%
  \afterassignment\M@DR@Rom@naux \c@M@DR@romt@mp=}
\def\M@DR@Rom@naux{\Roman{M@DR@romt@mp}}
%    \end{macrocode}
% \end{macro}
% 
% \subsection{Options}
% 
% \begin{macro}{\modroman}
% Je traite maintenant les options qui déterminent le
% comportement des macros \cs{modroman}, \cs{modromannumeral} et
% \cs{nbmodroman}.
% \begin{Anglais}
%   I now use the options which determine the behaviour of the macros
%   \cs{modroman}, \cs{modromannumeral}, and \cs{nbmodroman}.
% \end{Anglais}
%    \begin{macrocode}
\iftoggle{M@DR@sansmod}
%    \end{macrocode}
% option \Option{sansmod}
%    \begin{macrocode}
{\let\modroman=\roman
  \let\modromannumeral=\romannumeral
  \let\nbmodroman=\nbroman}
%    \end{macrocode}
% avec / \emph{with} modifications
%    \begin{macrocode}
{\iftoggle{M@DR@majrn}
%    \end{macrocode}
% en majuscules / \emph{uppercase}
%    \begin{macrocode}
  {\iftoggle{M@DR@longrn}
%    \end{macrocode}
% option \Option{long}
%    \begin{macrocode}
    {\let\modroman=\LongRoman
      \let\modromannumeral=\LongRomannumeral
      \let\nbmodroman=\nbLongRoman}
%    \end{macrocode}
% option \Option{court}
%    \begin{macrocode}
    {\let\modroman=\Roman
      \let\modromannumeral=\Romannumeral
      \let\nbmodroman=\nbRoman}}
%    \end{macrocode}
% en minuscules / \emph{lowercase}
%    \begin{macrocode}
  {\iftoggle{M@DR@longrn}
%    \end{macrocode}
% option \Option{long}
%    \begin{macrocode}
    {\let\modroman=\longroman
      \let\modromannumeral=\longromannumeral
      \let\nbmodroman=\nblongroman}
%    \end{macrocode}
% option \Option{court}
%    \begin{macrocode}
    {\let\modroman=\shortroman
      \let\modromannumeral=\shortromannumeral
      \let\nbmodroman=\nbshortroman}}}
%    \end{macrocode}
% \end{macro}
% 
% \subsection{\cs{printntimes}}
% 
% \begin{macro}{\printntimes}
%   Pour finir, une petite macro pour écrire \meta{nbr} \TO 1\ier
%   argument\TF fois le contenu du 2\ieme argument. J'utilise ici une
%   idée présentée par David \textsc{Kastrup} dans un papier intitulé \og
%   Iterating with roman numeral\fg que l'on pourra trouver dans la
%   page dédiée aux \og
%   \href{http://www.gust.org.pl/projects/pearls/2005p/index_html}
%   {Pearls 2005} \fg de GUST.
%   \begin{Anglais}
%     I end with a tiny macro which writes \meta{nbr} \TO 1st
%     argument\TF times the content of the 2nd argument. I use here an
%     idea presented by David \textsc{Kastrup} in a paper entitled
%     `Iterating with roman numeral' which is available on the page of
%     the
%     \href{http://www.gust.org.pl/projects/pearls/2005p/index_html}
%     {Pearls 2005} \fg of GUST.
%   \end{Anglais}
%    \begin{macrocode}
\newcommand\printntimes[2]{{%
    \renewcommand\M@DR@m{#2}%
    \nblongroman{\numexpr 1000*#1}}}
%    \end{macrocode}
% \end{macro}
% 
% Ici finit l'extension.
% \begin{Anglais}[1]Here finishes the package.\end{Anglais}
% \Finale
% \iffalse
%</package>
%<*doc>
\documentclass[a4paper]{ltxdoc}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}  
\usepackage{modroman}[2010/04/09]
\usepackage{xspace}
\usepackage{array}
\usepackage{ifthen}
\usepackage{MODRdoctools}
\IfFileExists{lmodern.sty}{\usepackage{lmodern}}{}
%<fr>\usepackage[english,frenchb]{babel}
%<en>\usepackage[frenchb,english]{babel}
\usepackage[colorlinks=true,
            linkcolor=blue,
            urlcolor=blue,
            citecolor=blue]{hyperref}

\begin{document}
\renewcommand\thepage{\textit{\modroman{page}}}
%<*fr>
\title{L'extension \textsf{modroman}\thanks{
    Ce document correspond au fichier 
    \textsf{modroman}~\fileversion, du \filedate.}}
%</fr>
%<*en>
\title{The package \textsf{modroman}\thanks{
    This document corresponds to the file 
    \textsf{modroman}~\fileversion, dated \filedate.}}
%</en>
\author{\href{mailto:le.texnicien.de.surface@wanadoo.fr}{Le \TeX
    nicien de surface}}  

\maketitle

\begin{abstract}
\begin{otherlanguage}
%<fr>{english}
%<en>{french}
\bfseries{}
%<*fr>
  This is the French documentation of \Pkg{modroman} for the final
  user.
  The English documentation is provided under the name
  \texttt{modroman-en}.
%</fr>
%<*en>
  Documentation anglaise pour l'utilisateur final de l'extension
  \Pkg{modroman}.
  La documentation française est disponible sous le nom de
  \texttt{modroman-fr}.
%</en>
\end{otherlanguage}

\vspace{6pt}
\noindent\hrulefill
\vspace{6pt}

%<*fr>
Documentation française pour l'utilisateur final de l'extension
\Pkg{modroman}.

\MODRdescrofr
%</fr>
%<*en>
This is the English documentation of \Pkg{modroman} for the final
user.

\MODRdescroen
%</en>
\end{abstract}

\tableofcontents{}

\section{Introduction}

\subsection{Motivation}

%<*fr>
Les formes d'écriture des nombres en chiffres romains telles que les
proposent \TeX, avec \cs{romannumeral}, et \LaTeX, avec \cs{roman} et
\cs{Roman}, sont loin d'être les seules qui furent en usage. J'avais
vu, il y a bien longtemps, la notation \nbshortroman{8} dans un
manuscrit. Les premières versions \TO de 0.1 à 0.4\TF de cette
extension ne permettaient que cette écriture, avec, au gré de
l'utilisateur, l'utilisation d'un |u| pour noter la \emph{cinquaine}
comme dans \og xuij\fg pour~17.
%</fr>
%<*en>
The ways of writing numbers with roman numerals are more diverse than
it could be thought when one considers the \TeX{} \cs{romannumeral}
and \LaTeX{} \cs{roman} and \cs{Roman}. Many other forms were used at
a time or another through history. I saw, many years ago, the form
\nbshortroman{8} in a manuscript. The first versions \TO from 0.1 to
0.4\TF of this package provided just that form, with, user willing,
the use of a~|u| to denote a group of~5 as in `xuij' for~17.
%</en>

%<*fr>
Le lecteur interessé pourra jeter un \oe il sur la page que wikipedia
consacre aux chiffres romains pour voir que le monde n'est pas
toujours aussi simple que l'on voudrait qu'il soit.
%</fr>
%<*en>
The interested reader could cast a glance on the page wikipedia
devotes to roman numerals to see that the world is not always as
simple as one would like it to be.
%</en>

\subsection{
%<fr>Remarques techniques
%<en>Technical Remarks
}

%<*fr>
Le code des premières versions permettait de numéroter les pages avec
les chiffres romains \emph{modifiés} mais on ne pouvait plus alors
utiliser les outils de référence comme \cs{label} et \cs{ref} ni même
espérer voir les nombres écrits correctement dans la table des
matières.
%</fr>
%<*en>
The code of the first versions enable one to number the pages with
\emph{modified} roman numerals but one could not then use the
reference tools such as \cs{label} and \cs{ref} or even hope to see
the page numbers correctly written in the table of contents.
%</en>

%<*fr>
Si les années qui passent ne me rendent pas beaucoup plus malin, elles
ont un avantage: à force de lire des documentations d'extension, je
finis par en connaitre davantage et il m'arrive de buter par hasard
sur la solution à un problème que je n'avais fait qu'entrevoir.
%</fr>
%<*en>
As the years go by I don't really become more clever but, for I read
not a few documentations of packages, I end with knowing a bit more
and I happen to stumble upon the solution to a problem I had just
caught a glimpse of.
%</en>

%<*fr>
Je n'oublie pas les idées --~nombreuses~--, les exemples
--~détaillés~-- et les explications --~claires~-- fournis par
T.~\textsc{Lachand}-\textsc{Robert} dans~\cite{tlachand} mais je
m'abreuve désormais aussi à d'autres sources --
\texttt{source2e}~\cite{source2e} pour être précis -- et c'est là
que j'ai trouvé l'\emph{astuce} qui me permet de fournir cette
nouvelle version de \Pkg{modroman}. Le lecteur intéressé jettera
un coup d'\oe il sur la définition de la macro \cs{Roman} et ses macros
auxiliaires.
%</fr>
%<*en>
I don't forget what I owe to T.~\textsc{Lachand}-\textsc{Robert}
in~\cite{tlachand} -- numerous ideas, detailed examples, clear
explanations -- but I now use other sources --
\texttt{source2e}~\cite{source2e} to be accurate. That is where I have
found the \emph{trick} which enables me to provide this new version of
\Pkg{modroman}. The reader who would like to know more should have a
look at the definition of the macro \cs{Roman} and its auxiliary
macros.
%</en>

%<*fr>
En réécrivant le code je me suis apperçu que je pouvais aller un peu
plus loin que je ne l'avais fait sans qu'il m'en coute beaucoup
plus. Voila pourquoi on trouvera désormais plus de macros et plus de
présentations des nombres en chiffres romains et une macro
supplémentaire.
%</fr>
%<*en>
While rewriting the code I happen to understand that I was able to go
a bit farther than I have gone previously without a tremendous extra
cost. That's why one will now find more macros and more presentations
of the roman numerals and an additional macro.
%</en>

%<*fr>
Cette version~1 conserve la compatibilité avec la version précédente
mais le code a été complètement réécrit et l'extension fournit
désormais à l'utilisateur outre les macros \cs{modroman} et
\cs{modromannumeral} une bonne quinzaine d'autres.
%</fr>
%<*en>
This version~1 keeps the compatibility with the previous version but
the code has been completely rewritten and the package now provides to
the user in addition to \cs{modroman} and \cs{modromannumeral} about
fifteen other macros.
%</en>

%<*fr>
Toutefois, la grande nouveauté de cette version~1 est que, désormais,
la macro \cs{modroman} \TO et ses petites camarades\TF est \og
purement développable\fg \TO voir page~\pageref{puredev} pour plus de
détails\TF, on peut donc l'utiliser pour numéroter des pages \emph{et}
obtenir ce qu'il faut dans la table des matières -- ce qui n'était pas
le cas jusqu'ici. Attention, je ne dis rien de tel à propos de
\cs{modromannumeral}.
%</fr>
%<*en>
However, the main change introduced by this version~1 is the fact that
from now on \cs{modroman} \TO and its pals \TF is purely expandable
\TO see page~\pageref{puredev} for more details. One can then use it
to number pages and obtain the correct thing in the table of content
-- which was not the case until now. Caution, I do \emph{not} say that
\cs{modromannumeral} is purely expandable -- it is not.
%</en>

\subsection{
%<fr>Macros purement développables
%<en>Purely Expandable Macros
}

%<*fr>
On pourra lire le fil de discussion \og test de développabilité pure ?
\fg dans le forum \texttt{fr.comp.text.tex} pour voir que cette notion
n'est pas aussi simple qu'elle parait au n\ieme abord \texttt{:-)}
toutefois, ici, lorsque je dirais qu'une macro est \og purement
développable\fg j'entendrai ce qui suit.
%</fr>
%<*en>
One could, if one understands French, read the thread
`\foreignlanguage{frenchb}{test de développabilité pure ?}' on the
news group \texttt{fr.comp.text.tex} to see that that notion is not as
simple as one could think at n-th sight \texttt{:-)} however, here,
when I will say that a macro is `purely expandable' I will understand
what follows.
%</en>

%<*fr>
Supposons que la macro \cs{truc} soit telle que \cs{truc}\marg{12}
donne \og xij\fg \TO ça vous dit quelque chose? \TF
alors\label{puredev}
\begin{enumerate}
\item la macro \cs{TRUC} définie par
  |\edef|\BOP|\TRUC|\BOP|{|\BOP|\truc|\BOP|{|\BOP|12|\BOP|}|\BOP|}|
  est telle que:
  \begin{enumerate}
  \item \cs{TRUC} donne bien \og xij\fg et
  \item |\meaning\TRUC| donne \og \texttt{macro:->xij}\fg
  \end{enumerate}
\item de plus, si on définit \cs{Axij}, alors la construction 
|\csname| |A|\BOP|\truc|\BOP|{|\BOP|12|\BOP|}|\BOP|\endcsname|
appelle bien la macro \cs{Axij}.
\end{enumerate}
%</fr>
%<*en>
Let's assume that the macro \cs{thing} is such that
\cs{thing}\marg{12} gives `xij' \TO does it ring a bell?\TF
then\label{puredev}
\begin{enumerate}
\item the macro \cs{THING} defined by
  |\edef|\BOP|\TRUC|\BOP|{|\BOP|\truc|\BOP|{|\BOP|12|\BOP|}|\BOP|}|
  is such that: 
  \begin{enumerate}
  \item \cs{THING} gives `xij' and
  \item |\meaning\THING| gives `\texttt{macro:->xij}'
  \end{enumerate}
\item moreover, if one defines \cs{Axij} then the construct
  |\csname| |A|\BOP|\truc|\BOP|{|\BOP|12|\BOP|}|\BOP|\endcsname|
  truly calls the macro \cs{Axij}.
\end{enumerate}
%</en>

\section{
%<fr>Utilisation
%<en>Usage
}

\subsection{
%<fr>Les macros
%<en>The Macros
}

%<*fr>
Les macros dont le nom finit par \texttt{numeral} s'utilisent comme la
macro \TeX{} \cs{romannumeral}. Elles doivent être suivies d'un nombre
et mangent les espaces qui le suivent. P.~ex. 
|\longromannumeral| \verb*+368  ET+ donne \og\longromannumeral
368   ET\fg. 
%</fr>
%<*en>
Macros the name of which ends with \texttt{numeral} are to be used as
\TeX{} \cs{romannumeral}. They must be followed by a number and eat
the spaces which are after it, e.~g. 
|\longromannumeral| \verb*+368  AND+ gives `\longromannumeral
368   AND'.
%</en>

%<*fr>
Les macros dont le nom commence par \cs{nb} prennent un argument qui
est un nombre comme |\nbLongRoman{127}| qui donne \og
\nbLongRoman{127}\fg.
%</fr>
%<*en>
Macros the name of which begins with \cs{nb} take a number as argument
such as |\nbLongRoman{127}| which gives `\nbLongRoman{127}'.
%</en>

%<*fr>
Les macros dont le nom ne commencent pas par \cs{nb} mais
finissent par \texttt{roman} s'utilisent comme le \cs{roman} de
\LaTeX: leur unique argument est le nom d'un compteur. Avec
|\newcounter{machin}|, |\setcounter{machin}{124}|,
|\shortroman{machin}| on obtient \og \nbshortroman{124}\fg.
%</fr>
%<*en>
Macros the name of which doesn't begin with \cs{nb} but ends with
\texttt{roman} are used as \LaTeX{} \cs{roman}: their only argument is
the name of a counter. With |\newcounter{machin}|,
|\setcounter{machin}{124}|, |\shortroman{machin}| one obtains
`\nbshortroman{124}'.
%</en>

%<*fr>
Dans ce qui suit \meta{nbr} indique un nombre, \meta{ctr} indique
le nom d'un compteur à la \LaTeX{} comme \texttt{page} ou
\texttt{chapter}.
%</fr>
%<*en>
In what follows \meta{nbr} denotes a number, \meta{ctr} denotes the
\LaTeX{} name of a counter such as \texttt{page} or \texttt{chapter}.
%</en>

%<*fr>
Voici maintenant une présentation de toutes les macros disponibles
dans cette extension. Elles sont rangées par famille, étant entendu
qu'une famille est définie par l'aspect de la représentation obtenue.
%</fr>
%<*en>
Here comes a presentation of all the macros available with this
package. They are grouped by family where a family is defined with
respect to the obtained presentation of roman numerals.
%</en>

%<*fr>
Après la syntaxe de la macro, on trouvera \PD pour dire que cette
macro est purement développable \TO voir page~\pageref{puredev}\TF,
\LT pour signifier qu'elle s'utilise comme une macro \LaTeX, \TX pour
signifier qu'elle s'utilise comme la macro \cs{romannumeral} de \TeX.
%</fr>
%<*en>
After the macro's syntax, there will be \PD to mean that the macro is
purely expandable \TO see page~\pageref{puredev}\TF, \LT to mean that
it is used the \LaTeX{} way, \TX to mean that it is used as the \TeX{}
\cs{romannumeral}.
%</en>

%<*fr>
Les exemples sont soumis aux options par défaut: \Option{jfinal},
\Option{vpourv}, \Option{court}, \Option{min}.
%</fr>
%<*en>
The examples are governed by the default options: \Option{jfinal},
\Option{vpourv}, \Option{court}, \Option{min}.
%</en>

\subsubsection{
%<fr>Famille
shortroman
%<en>Family
}

\begin{macro}{\shortroman}
  \cs{shortroman}\marg{ctr} \PD \LT
\end{macro}

\begin{macro}{\shortromannumeral}
  \cs{shortromannumeral} \meta{nbr} \TX
\end{macro}

\begin{macro}{\nbshortroman}
    \cs{nbshortroman}\marg{nbr} \PD \LT
\end{macro}

\Exemples{shortroman}


\subsubsection{
%<fr>Famille
longroman
%<en>Family
}

\begin{macro}{\longroman}
  \cs{longroman}\marg{ctr} \PD \LT
\end{macro}

\begin{macro}{\longromannumeral}
  \cs{longromannumeral} \meta{nbr} \TX
\end{macro}

\begin{macro}{\nblongroman}
    \cs{nblongroman}\marg{nbr} \PD \LT
\end{macro}

\Exemples{longroman}

\subsubsection{
%<fr>Famille
LongRoman
%<en>Family
}

\begin{macro}{\LongRoman}
  \cs{LongRoman}\marg{ctr} \PD \LT
\end{macro}

\begin{macro}{\LongRomannumeral}
  \cs{LongRomannumeral} \meta{nbr} \TX
\end{macro}

\begin{macro}{\nbLongRoman}
    \cs{nbLongRoman}\marg{nbr} \PD \LT
\end{macro}

\Exemples{LongRoman}


\subsubsection{
%<fr>Famille
roman
%<en>Family
}

%<*fr>
\TeX{} fournit \cs{romannumeral} et \LaTeX{} \cs{roman}. Je
complète la famille avec \cs{nbroman}.
%</fr>
%<*en>
\TeX{} provides \cs{romannumeral} and \LaTeX{} \cs{roman}. I
complete the family with \cs{nbroman}.
%</en>

\begin{macro}{\nbroman}
    \cs{nbroman}\marg{nbr} \PD \LT
\end{macro}

\Exemples{roman}

\subsubsection{
%<fr>Famille
Roman
%<en>Family
}

%<*fr>
\LaTeX{} fournit \cs{Roman}. Je complète la famille avec \cs{nbRoman}
et \cs{Romannumeral}.
%</fr>
%<*en>
\LaTeX{} provides \cs{Roman}. I complete the family with \cs{nbRoman} and
\cs{Romannumeral}.
%</en>

\begin{macro}{\Romannumeral}
  \cs{Romannumeral} \meta{nbr} \TX
\end{macro}

\begin{macro}{\nbRoman}
    \cs{nbRoman}\marg{nbr} \PD \LT
\end{macro}

\Exemples{Roman}

\subsubsection{
%<fr>Famille
modroman
%<en>Family
}

%<*fr>
Les macros \cs{modroman}, \cs{modromannumeral} et \cs{nbmodroman} ont
un rendu défini par les options choisies. Par défaut:
%</fr>
%<*en>
The output of the macros \cs{modroman}, \cs{modromannumeral}, and
\cs{nbmodroman} is determined by the chosen options. By default:
%</en>

\begin{macro}{\modroman}
  \cs{modroman}\marg{ctr} $=$ \cs{shortroman}\marg{ctr} \PD \LT
\end{macro}

\begin{macro}{\modromannumeral}
  \cs{modromannumeral}\meta{nbr} $=$ \cs{shortromannumeral}\meta{nbr} \TX
\end{macro}

\begin{macro}{\nbmodroman}
    \cs{nbmodroman}\marg{nbr} $=$ \cs{nbshortroman}\marg{nbr} \PD \LT
\end{macro}

\Exemples{modroman}

\subsubsection{
%<fr>Autres macros
%<en>Other macros
}

%<*fr>
On peut redéfinir le comportement des familles \cs{shortroman} et
\cs{longroman} en utilisant la macro \cs{RedefineMRmdclxvij}.
%</fr>
%<*en>
One can redefine the behaviour of families \cs{shortroman} and
\cs{longroman} with the macro \cs{RedefineMRmdclxvij}.
%</en>

\begin{macro}{\RedefineMRmdclxvij}
  \cs{RedefineMRmdclxvij}\oarg{ISOL}\BOP\marg{M}\BOP\marg{D}\BOP\marg{C}%
  \BOP\marg{L}\BOP\marg{X}\BOP\marg{V}\BOP\marg{I}\BOP\marg{J}
\end{macro}

%<*fr>
Les arguments ci-dessus déterminent l'aspect des nombres romains
produits ensuite \TO on fera attention aux effets de bord et on
limitera la portée de la redéfinition à un groupe si nécessaire\TF par
les familles \cs{shortroman}, \cs{longroman} et, si elle est liée à
une de ces deux précédentes, \cs{modroman}.
%</fr>
%<*en>
The above arguments determine the look of the roman numerals produced
after \TO one should take care of the side effects and one would have
to limit the scope of the redefinition ot a group if necessary\TF by
the families \cs{shortroman}, \cs{longroman}, and, if it is linked to
one of the two preceding, \cs{modroman}.
%</en>

%<*fr>
L'argument optionnel \meta{ISOL} donne l'aspect du |i| isolé \CAD le
nombre~1. Si on ne donne pas cet argument l'aspect du |i| isolé est
celui du |i| non-final déterminé par \meta{I}.
%</fr>
%<*en>
The optional argument \meta{ISOL} gives the look of the isolated |i| \CAD the
number~1. If one doesn't give the argument the look of the isolated
|i| is the look of the non-final |i| determined by \meta{I}
%</en>

%<*fr>
L'argument \meta{J} donne l'aspect du |i| final. Les autres arguments
donne l'aspect du chiffre (minuscule) correspond, p.~ex. \meta{M}
donne l'aspect du~|m|.
%</fr>
%<*en>
The look of the final~|i| is given by the argument \meta{J}. All other
arguments give the look of the corresponding (lowercase) digit,
e.~g. \meta{M} gives the look of~|m|.
%</en>

\begin{macro}{\printntimes}
  \cs{printntimes}\marg{nbr}%
%<fr>\marg{texte}
%<en>\marg{text}
\end{macro}

%<*fr>
Voici deux exemples d'utilisation de cette macro.
%</fr>
%<*en>
Here are two examples using the macro.
%</en>

|$\ast$ \texttt{\printntimes{15}{*-*}} $\ast$| 

%<fr>donne
%<en>gives

$\ast$ \texttt{\printntimes{15}{*-*}} $\ast$

\bigskip

|\newcommand\truc{\par\centering ***\par}|\par
|\newcommand\saut{\par\noindent\hrulefill\par}|\par
|\saut\texttt{\printntimes{5}{\truc}}\saut| 

%<fr>donne
%<en>gives

\newcommand\truc{\par\centering ***\par}
\newcommand\saut{\par\noindent\hrulefill\par}
\saut\texttt{\printntimes{5}{\truc}}\saut

\subsection{
%<fr>Les options
%<en>The Options
}

%<*fr>
Il existe -- depuis la version~0.2 -- à la demande générale
d'\textbf{un} contributeur de \url{fr.comp.text.tex} deux options qui
s'excluent mutuellement : l'option par défaut \Option{vpourv} qui
conserve le comportement de la version précédente et l'option
\Option{upourv} qui remplace \og v \fg par \og u \fg dans l'écriture
des chiffres romains.
%</fr>
%<*en>
There exist -- since the version~0.2 -- options \Option{vpourv} and
\Option{upourv}. The default option is \Option{vpourv} with which
\cs{modromannumeral}|5| is written as `v'. With the option
\Option{upourv} the same \cs{modromannumeral}|5| is written as `u'. It
was a special requirement from \emph{one} person posting on
\url{fr.comp.text.tex}. \emph{The (almost) French `vpourv' stands for
  `v for v'.}
%</en>

%<*fr>
Par souci de symétrie, j'ajoute, avec la version~1, deux
options antithétiques \Option{jfinal} -- option par défaut -- et
\Option{ifinal} qui permettent de choisir si le dernier |i| d'un
nombre sera transformé en~|j| ou pas.
%</fr>
%<*en>
For sake of symetry, I add, with this version~1, two
antithetical options \Option{jfinal} -- final j -- the default, and
\Option{ifinal} -- final i -- by which one can choose if the last~i of
the number will be written as a~|j| or not.
%</en>

%<*fr>
J'ajoute encore deux couples d'options antithétiques. D'abord
\Option{min} \TO pour \emph{minuscule}, option par défaut \TF et
\Option{maj} \TO pour \emph{majuscule}\TF puis \Option{court} \TO
option par défaut\TF et \Option{long}.
%</fr>
%<*en>
I add also two pairs of antithetic options. First \Option{min} \TO
\CAD \emph{minuscule} lowercase, default option \TF and \Option{maj}
\TO \CAD \emph{majuscule} uppercase\TF then \Option{court} \TO short,
default option \TF and \Option{long}.
%</en>

%<*fr>
J'ajoute enfin, une option \Option{sansmod} -- sans modification --
qui a pour effet de faire des macros de la famille \cs{modroman} des
alias de celles de la famille \cs{roman}.
%</fr>
%<*en>
Last, with this version~1, I add the option \Option{sansmod} --
without modification -- which makes the macros of the \cs{modroman}
family aliases of those of \cs{roman} family.
%</en>

%<*fr>
Les cinq dernières options déterminent le comportement des macros de
la famille \cs{modroman}.
%</fr>
%<*en>
The last five options determine the behaviour of the macros of the
family \cs{modroman}.
%</en>

\DescribeOption{upourv}
%<*fr>
Avec cette option, le chiffre romain \og v\fg est transformé en \og
u\fg et on a, par exemple, \og xuij\fg pour~17.
%</fr>
%<*en>
With that option, the roman numeral `v' is turn into an~`u' and one
obtains, e.g., `xuij' for~17.
%</en>

\DescribeOption{vpourv}
%<*fr>
Cette option, active par défaut, est l'opposée de la précédente. Avec
elle, on obtient \Exemple{17} pour~17.
%</fr>
%<*en>
That option, enforced by default, is the opposite of the previous
one. With it, one obtains \Exemple{17} for~17.
%</en>

%<*fr>
Les trois options suivantes apparaissent avec la version~1 de
l'extension.
%</fr>
%<*en>
The next three options appear with the version~1 of the package.
%</en>


\DescribeOption{jfinal}
%<*fr>
Avec cette option, active par défaut, si le nombre traité est plus
grand que~1 et si le dernier chiffre romain est un~i, ce dernier est
remplacé par un~j. Voir l'exemple précédent.
%</fr>
%<*en>
With that default option, if the processed number is greater than~1
and if the last roman \emph{digit} is an~i then it is turned into
a~j. See the examples above.
%</en>


\DescribeOption{ifinal}
%<*fr>
Cette option s'oppose à la précédente. Lorsqu'on l'a choisie, on
obtient \romannumeral 17{} pour~17.
%</fr>
%<*en>
That option is the opposite of the previous one. When enforced, one
obtains \romannumeral 17{} for~17.
%</en>

\DescribeOption{sansmod}
%<*fr>
Avec cette option, les macros \cs{modroman}, \cs{modromannumeral} et
\cs{nbmodroman} deviennent des alias -- avec \cs{let} -- de
\cs{roman}, \cs{romannumeral} et \cs{nbroman} respectivement.
%</fr>
%<*en>
With that option \cs{modroman}, \cs{modromannumeral} and
\cs{nbmodroman} are just aliases -- obtained with \cs{let} -- of
\cs{roman}, \cs{romannumeral}, and \cs{nbroman} respectively.
%</en>

%<*fr>
Choisir simultanément les options \Option{vpourv}, \Option{court},
\Option{min} et \Option{ifinal} revient à choisir l'option
\Option{sansmod}.
%</fr>
%<*en>
If one choses options \Option{vpourv}, , \Option{court}, \Option{min},
and \Option{ifinal} together, one enforces the option
\Option{sansmod}.
%</en>

\bigskip

%<*fr>
Le tableau suivant indique quelle famille est liée à la famille
\cs{modroman} suivant les options choisies lorsque \Option{sansmod}
n'est pas en vigueur.
%</fr>
%<*en>
The following table shows which family is linked to the \cs{modroman}
family according to the chosen options when \Option{sansmod} is not
enforced.
%</en>

\begin{center}
  \begin{tabular}{|*{3}{c|}}\hline
    & \Option{court} & \Option{long}\\ \hline
    \Option{min} & \cs{shortroman} & \cs{longroman} \\ \hline
    \Option{maj} & \cs{Roman} & \cs{LongRoman} \\ \hline
  \end{tabular}
\end{center}

\input{MODRbiblio}

% Il suffit de commenter le \iffalse et le \fi correspondant pour
% avoir ces quelques pages d'exemples.
% Suffices to comment out the \iffalse and the corresponding \fi to
% obtain those not few pages of examples.
\iffalse
\newpage
\section{
%<fr>Nombres de \nbmodroman{1} à \nbmodroman{1000}
%<en>Numbers from \nbmodroman{1} to \nbmodroman{1000}
}

\newcounter{machin}\setcounter{machin}{1}
\noindent
\whiledo{\value{machin}<1001}{%
  \mbox{\arabic{machin} -- \shortroman{machin} -- \longroman{machin}
    -- \LongRoman{machin}}\stepcounter{machin}\par\noindent}
\newpage
\fi
\vspace*{\stretch{4}}
\noindent\hrulefill
\begin{center}
%<fr>Dans le préambule de ce document, on trouve
%<en>In the preambule of this document, there is
\\
|\renewcommand\thepage{\textit{\modroman{page}}}|
\\
%<fr>d'où la numérotation des pages.
%<en>hence the page numbering.  
\end{center}
\noindent\hrulefill

\vspace*{\stretch{2}}

\begin{center}
\framebox{
%<fr> Ici finit la documentation de \Pkg{modroman}.
%<en> Here ends the documentation of \Pkg{modroman}.
}
\end{center}
\vspace*{\stretch{4}}
\end{document}
%</doc> 
% \fi
\endinput
%%% Local Variables: 
%%% mode: doctex
%%% coding: iso-8859-15
%%% fill-column: 70
%%% End: 
