% +--------------------------------------------------+
% | Documentation in clear text follows              |
% +--------------------------------------------------+
%
%% Copyright (C) 2006 Javier Bezos
%% All Rights Reserved
%% http://www.texytipografia.com
%%
%% This work may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, either version 1.3 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.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% This Current Maintainer of this work is Javier Bezos.
%%
%% This work consists of this file.
%
% Usage
% ~~~~~
%
% This package modifies the definitions of \frontmatter and
% \mainmatter so that page numbering starts in arabic style from the
% front matter while preserving the rest of the original definitions.
% For it to work, \pagenumbering has to be inside these macros -- most
% of classes do that, but there are exceptions like memoir.
%
% To use it, just \usepackage{arabicfront}.
%
% Code
% ~~~~

\def\fileversion{1.0}
\def\filedate{2006/09/03}

\ProvidesPackage{arabicfront}[2006/09/03 v1.0 Arabic page numbering]

\def\arfr@rep#1\@@\@@#2#3{%
  \in@{\pagenumbering}{#1}%
  \ifin@
    #2#1\@@\@@
  \else
    \PackageWarningNoLine{arabicfront}%
      {Skipping \string#3 -- no \string\pagenumbering}%
  \fi}

\def\arfr@front#1\pagenumbering#2#3\@@\@@{%
  \renewcommand\frontmatter{#1\pagenumbering{arabic}#3}}

\def\arfr@main#1\pagenumbering#2#3\@@\@@{%
  \renewcommand\mainmatter{#1#3}}
  
\expandafter\arfr@rep\mainmatter\@@\@@\arfr@main\mainmatter
\expandafter\arfr@rep\frontmatter\@@\@@\arfr@front\frontmatter

\endinput