% \iffalse meta-comment
%
% epigraph.dtx
%
% Copyright 1999 Peter R. Wilson
%
% This program is provided under the terms of the
% LaTeX Project Public License distributed from CTAN
% archives in directory macros/latex/base/lppl.txt.
%
% Author: Peter Wilson (CUA) (now at: peter.r.wilson@boeing.com)
% 
%<*driver>
\documentclass{ltxdoc}
\EnableCrossrefs
\CodelineIndex
\setcounter{StandardModuleDepth}{1}
\begin{document}
  \DocInput{romannum.dtx}
\end{document}
%</driver>
%
% \fi
%
% \CheckSum{252}
%
% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
% \DoNotIndex{\@centercr,\@cite}
% \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
% \DoNotIndex{\@input,\@ixpt,\@m}
% \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint}
% \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
% \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
% \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
% \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
% \DoNotIndex{\advance,\Alph,\alph}
% \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
% \DoNotIndex{\bullet}
% \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
% \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
% \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
% \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
% \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
% \DoNotIndex{\fbox}
% \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
% \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
% \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
% \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
% \DoNotIndex{\input}
% \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
% \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
% \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
% \DoNotIndex{\NeedsTeXFormat,\newdimen}
% \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
% \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
% \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
% \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
% \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
% \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
% \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman}
% \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength}
% \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
% \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
% \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
% \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
% \DoNotIndex{\wd,\xiipt,\year,\z@}
%
% \changes{v1.0}{1999/05/08}{First public release}
%
% \def\fileversion{v1.0}
% \def\filedate{\today}
% \newcommand*{\Lpack}[1]{\textsf {#1}}           ^^A typeset a package
% \newcommand*{\Lopt}[1]{\textsf {#1}}            ^^A typeset an option
% \newcommand*{\file}[1]{\texttt {#1}}            ^^A typeset a file
% \newcommand*{\Lcount}[1]{\textsl {\small#1}}    ^^A typeset a counter
% \newcommand*{\pstyle}[1]{\textsl {#1}}          ^^A typeset a pagestyle
% \newcommand*{\Lenv}[1]{\texttt {#1}}            ^^A typeset an environment
%
% \title{The \Lpack{romannum} package\thanks{This
%        file has version number \fileversion, last revised
%        \filedate.}}
%
% \author{%
% Peter Wilson\\
% Catholic University of America\\
% Now at \texttt{peter.r.wilson@boeing.com}
% }
% \date{\filedate}
% \maketitle
% \begin{abstract}
%    The \Lpack{romannum} package changes the numbers generated by
% \LaTeX{} from arabic digits to roman numerals. The package uses
% the \Lpack{stdclsdv} package.
% \end{abstract}
% \tableofcontents
%
% \StopEventually{}
%
% 
%
% \section{Introduction}
%
%     \LaTeX{} generates numbers for things like chapters and sections,
% figure and table captions, and page numbers. Normally these are printed
% using arabic digits. The \Lpack{romannum} package modifies the typesetting
% of such generated numbers so that they are printed as roman numerals.
% 
% This manual is typeset according to the conventions of the
% \LaTeX{} \textsc{docstrip} utility which enables the automatic
% extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}.
%
%    Section~\ref{sec:usc} describes the usage of the package.
% Commented source code for the package is in Section~\ref{sec:code}.
%
% \section{The \Lpack{romannum} package} \label{sec:usc}
%
%    Using the \Lpack{romannum} package, numbers that \LaTeX{} generates will 
% be typeset as
% lowercase roman numerals. For example, `iv' instead of 4.
%
%    The following options change the generated numbers from arabic to
% roman:
% \begin{itemize}
% \item[\Lopt{Section}] Sectional numbers in uppercase roman.
% \item[\Lopt{section}] Sectional numbers in lowercase roman.
% \item[\Lopt{Equation}] Equation numbers in uppercase roman.
% \item[\Lopt{equation}] Equation numbers in lowercase roman.
% \item[\Lopt{Caption}] Table and Figure caption numbers in uppercase roman.
% \item[\Lopt{caption}] Table and Figure caption numbers in lowercase roman.
% \item[\Lopt{Footnote}] Footnote numbers in uppercase roman.
% \item[\Lopt{footnote}] Footnote numbers in lowercase roman.
% \item[\Lopt{Enumerate}] First level items in uppercase roman and third
%                         level items in lowercase roman.
% \item[\Lopt{enumerate}] First level items in lowercase roman and third
%                         level items in uppercase roman.
% \item[\Lopt{Year}] The year number from the |\today| command in uppercase 
%                    roman.
% \item[\Lopt{Day}] The year number from the |\today| command in uppercase
%                   roman and the day number in uppercase roman.
% \item[\Lopt{day}] The year number from the |\today| command in uppercase
%                   roman and the day number in uppercase roman.
% \item[\Lopt{Most}] A shorthand option equivalent to using all these options:
%    \Lopt{Section}, \Lopt{Equation}, \Lopt{Caption}, \Lopt{Footnote},
%    \Lopt{Enumerate}; that is, all the uppercasing options except for
%    \Lopt{Year} and \Lopt{Day}.
% \item[\Lopt{most}] A shorthand option equivalent to using all these options:
%    \Lopt{section}, \Lopt{equation}, \Lopt{caption}, \Lopt{footnote},
%    \Lopt{enumerate}; that is, all the lowercasingcasing options except for
%    \Lopt{day}.
% \end{itemize}
%
%    Note that the |\today|-related options are implemented by redefining the
% |\today| command. If any of these options are used together with another
% package that also redefines the |\today| command, then surprising effects
% may occur.
%
%    The package sets the the pagenumbering to be |\pagenumbering{roman}|
% at the start of the document. This can always be changed after the
% |\begin{document}| command.
%
%    Generally speaking, a number typeset using roman numerals requires more
% space than if it was typeset using arabic digits.
%    If roman numbering is used for sectional headings, captions, or page
% numbers, it is probable that the space allowed for numbers in the
% Table of Contents, and the Lists of Figures and Tables, will need to be
% increased. The amount of increase will depend on the longest (not
% necessarily the largest) roman number to be printed. The \Lpack{romannum}
% package makes no such adjustments; I suggest that the \Lpack{tocloft}
% package be used for this~\cite{TOCLOFT}.
%
% \DescribeMacro{\Romannum}
%    The command |\Romannum{|\meta{integer}|}| typesets \meta{integer} using
% uppercase roman numerals. Strictly speaking, the roman numbering system 
% system does not cater for numbers less than 1 (i.e., zero or negative
% numbers), however the command does what might be expected for zero and
% negative numbers. As normal with a \LaTeX{} command it gobbles any following
% space, so if you need a space after the number, use either of
% the forms shown below:
% \begin{verbatim}
% \Romannum{1}{} and \Romannum{2}\ make \Romannum{3}.
% \end{verbatim}
% The \meta{integer} argument must be either arabic digits or a command that
% expands solely to arabic digits (possibly preceeded by a minus sign).
%
% \DescribeMacro{\romannum}
%    The command |\romannum{|\meta{integer}|}| typesets \meta{integer} using
% lowercase roman numerals. It is the analogue of |\Romannum|.
%
% \section{The package code} \label{sec:code}
%
%    Announce the name and version of the package, which requires
% \LaTeXe{} and the \Lpack{stdclsdv} package.
%    \begin{macrocode}
%<*usc>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{romannum}[1999/05/08 v1.0 roman numerals]
\RequirePackage{stdclsdv}
%    \end{macrocode}
%
%    To try and avoid name clashes with other packages, the internal commands
% all contain the character string |rn@m|.
%
% \begin{macro}{\ifrn@mYear}
% \begin{macro}{\ifrn@mDay}
% \begin{macro}{\ifrn@mday}
% We need some booleans for the date related options.
%    \begin{macrocode}
\newif\ifrn@mYear \rn@mYearfalse
\newif\ifrn@mDay \rn@mDayfalse
\newif\ifrn@mday \rn@mdayfalse
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% Do the options. First for changing the sectioning numbers. The Part number
% is already in uppercase roman, so this is left alone.
%    \begin{macrocode}
\DeclareOption{Section}{%
  \ifSCDchapter
    \renewcommand{\thechapter}{\Roman{chapter}}
    \renewcommand{\thesection}{\thechapter.\Roman{section}}
  \else
    \renewcommand{\thesection}{\Roman{section}}
  \fi
  \renewcommand{\thesubsection}{\thesection.\Roman{subsection}}
  \renewcommand{\thesubsubsection}{\thesubsection.\Roman{subsubsection}}
  \renewcommand{\theparagraph}{\thesubsubsection.\Roman{paragraph}}
  \renewcommand{\thesubparagraph}{\theparagraph.\Roman{subparagraph}}
}
\DeclareOption{section}{%
  \ifSCDchapter
    \renewcommand{\thechapter}{\roman{chapter}}
    \renewcommand{\thesection}{\thechapter.\roman{section}}
  \else
    \renewcommand{\thesection}{\roman{section}}
  \fi
  \renewcommand{\thesubsection}{\thesection.\roman{subsection}}
  \renewcommand{\thesubsubsection}{\thesubsection.\roman{subsubsection}}
  \renewcommand{\theparagraph}{\thesubsubsection.\roman{paragraph}}
  \renewcommand{\thesubparagraph}{\theparagraph.\roman{subparagraph}}
}
%    \end{macrocode}
%
% The equation numbering.
%    \begin{macrocode}
\DeclareOption{Equation}{%
  \ifSCDchapter
    \renewcommand{\theequation}%
      {\ifnum \c@chapter>\z@ \thechapter.\fi \Roman{equation}}
  \else
    \renewcommand{\theequation}{\Roman{equation}}
  \fi
}
\DeclareOption{equation}{%
  \ifSCDchapter
    \renewcommand{\theequation}%
      {\ifnum \c@chapter>\z@ \thechapter.\fi \roman{equation}}
  \else
    \renewcommand{\theequation}{\roman{equation}}
  \fi
}
%    \end{macrocode}
%
% The captions.
%    \begin{macrocode}
\DeclareOption{Caption}{%
  \ifSCDchapter
    \renewcommand{\thefigure}%
      {\ifnum \c@chapter>\z@ \thechapter.\fi \Roman{figure}}
    \renewcommand{\thetable}%
      {\ifnum \c@chapter>\z@ \thechapter.\fi \Roman{table}}
  \else
    \renewcommand{\thefigure}{\Roman{figure}}
    \renewcommand{\thetable}{\Roman{table}}
  \fi
}
\DeclareOption{caption}{%
  \ifSCDchapter
    \renewcommand{\thefigure}%
      {\ifnum \c@chapter>\z@ \thechapter.\fi \roman{figure}}
    \renewcommand{\thetable}%
      {\ifnum \c@chapter>\z@ \thechapter.\fi \roman{table}}
  \else
    \renewcommand{\thefigure}{\roman{figure}}
    \renewcommand{\thetable}{\roman{table}}
  \fi
}
%    \end{macrocode}
%
% The footnote.
%    \begin{macrocode}
\DeclareOption{Footnote}{%
  \renewcommand{\thefootnote}{\Roman{footnote}}
}
\DeclareOption{footnote}{%
  \renewcommand{\thefootnote}{\roman{footnote}}
}
%    \end{macrocode}
%
% The enumerate.
%    Two of |enumerate| environment numbers need changing. First level 
% enumerations are normally arabic digits, and the third level are normally
% lowercase roman. These get changed to lowercase and uppercase roman.
%    \begin{macrocode}
\DeclareOption{Enumerate}{%
  \renewcommand{\theenumi}{\Roman{enumi}}
  \renewcommand{\theenumiii}{\roman{enumiii}}
}
\DeclareOption{enumerate}{%
  \renewcommand{\theenumi}{\roman{enumi}}
  \renewcommand{\theenumiii}{\Roman{enumiii}}
}
%    \end{macrocode}
%
% The date related options.
%    \begin{macrocode}
\DeclareOption{Year}{\rn@mYeartrue}
\DeclareOption{Day}{\rn@mDaytrue\rn@mYeartrue\rn@mdayfalse}
\DeclareOption{day}{\rn@mDayfalse\rn@mYeartrue\rn@mdaytrue}
%    \end{macrocode}
%
% The most options.
%    \begin{macrocode}
\DeclareOption{Most}{%
  \ExecuteOptions{Section,Equation,Caption,Footnote,Enumerate}
}
\DeclareOption{most}{%
  \ExecuteOptions{section,equation,caption,footnote,enumerate}
}
%    \end{macrocode}
%
% Now we can process the options.
%    \begin{macrocode}
\ProcessOptions\relax
%    \end{macrocode}
%
%  
%
% \begin{macro}{\theday}
% \begin{macro}{\theyear}
% \begin{macro}{\today}
%    Change the date related numerals, if asked for. This involves redefining
% the |\today| command.
%    \begin{macrocode}
\ifrn@mYear
  \newcommand{\thern@myear}{\@Roman\year}
  \ifrn@mDay
    \newcommand{\thern@mday}{\@Roman\day}
  \else
    \ifrn@mday
      \newcommand{\thern@mday}{\@roman\day}
    \else
      \newcommand{\thern@mday}{\@arabic\day}
    \fi
  \fi
  \edef\today{\ifcase\month\or
    January\or February\or March\or April\or May\or June\or
    July\or August\or September\or October\or November\or December\fi
    \space\thern@mday, \thern@myear}
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\romannum}
%    |\romannum{|\meta{integer}|}| typesets \meta{integer} using lowercase
% roman numerals.
%    The basic code for this is in the TEXbook on pages 40--41.
% I have added code to handle the cases of zero and negative integers.
%    \begin{macrocode}
\newcommand{\romannum}[1]{%
  \ifnum#1<1
    \ifnum#1=0
      o%
    \else
      -\romannumeral -#1%
    \fi
  \else
    \romannumeral #1%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Romannum}
%    Having got |\romannum|, this is easy.
%    \begin{macrocode}
\DeclareRobustCommand{\Romannum}[1]{\MakeUppercase{\romannum{#1}}}
%    \end{macrocode}
% \end{macro}
%
%    Finally, make the default page numbering lowercase roman.
%    \begin{macrocode}
\AtBeginDocument{\pagenumbering{roman}}
%    \end{macrocode}
%
%    The end of this package.
%    \begin{macrocode}
%</usc>
%    \end{macrocode}
%
%
% \bibliographystyle{alpha}
%
% \begin{thebibliography}{GMS94}
%
% \bibitem[GMS94]{GOOSSENS94}
% Michel Goossens, Frank Mittelbach, and Alexander Samarin.
% \newblock {\em The LaTeX Companion}.
% \newblock Addison-Wesley Publishing Company, 1994.
%
% \bibitem[Wil99]{TOCLOFT}
% Peter R.~Wilson.
% \newblock {\em The TOCLOFT package}.
% \newblock 1999. (Available from CTAN in \texttt{macros/latex/contrib/supported})
%
% \end{thebibliography}
%
%
% \Finale
% \PrintIndex
%
\endinput

%% \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         \~}


