%%
%% This is file `modref.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% modref.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from modref.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file modref.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% =============================================================================================
\def\basename{modref}
\def\fullname{restyle: cross-referencing hacks for LaTeX}
\def\revisiondate{2009/02/02}
\def\revision{0.9}
\def\writtenby{J. Niel de Beaudrap}
%% \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         \~}
%%
%% Package `modref' to use with LaTeX 2e
%% Copyright (C) 2007 J. Niel de Beaudrap, all rights reserved.
\typeout{-------}
\typeout{\fullname \space v\revision \space(\basename)}
\typeout{\writtenby, \revisiondate}
\typeout{-------}
\ProvidesPackage{modref}[\revisiondate {} {v\revision} {\writtenby}]
\RequirePackage{kvoptions}

\DeclareOption*{\PackageWarning{Unknown option `\CurrentOption'.}}
\makeatletter
%% Main text:
\newcommand\modref@error{\PackageError{modref}}
\edef\reserved@a{Ref}%
\@ifundefined\reserved@a{%
   \let\Ref\ref
}{%
   \modref@error{%
     Command \string\Ref\ defined already; refer to the help message.%
   }{%
     The "modref" package defines the command \string\Ref\ to allow you (and
     the package) to use the original functionality of \string\ref. However, in
     this instance, \string\Ref\ already had a meaning when "modref" started
     running. Please determine what is defining \string\Ref, and whether you need
     it.}}
\def\@ifempty#1{\@xifempty#1@@..\@nil}
\long\def\@xifempty#1#2@#3#4#5\@nil{      %
  \ifx#3#4\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
\DeclareStringOption[:]{delimiter}
\ProcessKeyvalOptions*
\newcommand\setrefdelimiter[1]{%
   \def\ref##1{\modref@ref##1#1\egroup\modref@basestyle}%
   \def\varref##1{\modref@ref##1#1\egroup\modref@varbasestyle}%
   \def\modref@ref##1#1##2\egroup##3{%
      \@ifempty{##2}{%
         \expandafter\@setref\csname r@##1\endcsname{##3\expandafter\@iden}{##1}%
      }{%
         \modref@@ref##1#1##2\egroup##3}}%
   \def\modref@@ref##1#1##2#1\egroup##3{%
      \@ifundefined{@modref@##1}{%
         \expandafter\@setref\csname r@##1#1##2\endcsname{%
            ##3\expandafter\@iden}{##1#1##2}%
      }{%
         \expandafter\def\expandafter\@tempa\expandafter{%
            \csname @modref@##1\endcsname}%
         \expandafter\@setref\csname r@##1#1##2\endcsname{%
            ##3\expandafter\@tempa}{##1#1##2}%
   }}%
}%
\ifx\modref@delimiter\@empty
   \modref@error{Option "delimiter" must be set to a non-empty value}{%
         The option "delimiter" was used, but seems to have been set to the
         empty string. I require a character, or a multi-character string, to
         delimit reference style names within cross-reference labels. If in
         doubt, just remove the "delimiter" option, and this should fix things.}%
\else
   \expandafter\setrefdelimiter\expandafter{\modref@delimiter}%
\fi
\newcommand\GlobalRefStyle[1]{\def\modref@@basestyle##1##2{#1}}
\newcommand\GlobalVarRefStyle[1]{\def\modref@@varbasestyle##1##2{#1}}
\@onlypreamble\GlobalRefStyle
\@onlypreamble\GlobalVarRefStyle
\def\modref@basestyle#1#2#3{\modref@@basestyle{#1{#2}}{#3}}%
\def\modref@varbasestyle#1#2#3{\modref@@varbasestyle{#1{#2}}{#3}}%
\GlobalRefStyle{#1}%
\GlobalVarRefStyle{#1}%
\edef\reserved@a{refstyle}%
\@ifundefined\reserved@a{%
   \newcommand\refstyle[2]{%
      \expandafter\def\csname @modref@#1\endcsname##1{#2}}%
}{%
   \modref@error{%
       Command \string\refstyle\ defined already; refer to the help message.
   }{%
       The "modref" package defines the command \string\refstyle; however,
       in this instance, \string\refstyle\ already had a meaning when "modref"
       started running. Please determine what is defining \string\refstyle, and
       whether you need it.}}
\newcommand\eqrefstyle[1]{%
   \def\eqref##1{%
      \maketag@@@{%
         \expandafter\@setref\csname r@##1\endcsname{%
            \modref@trivbasestyle\expandafter\modref@eqref}{##1}}}%
   \def\modref@eqref##1{#1}}%
\def\modref@trivbasestyle#1#2#3{#1{#2}}
\newcommand\displaytagstyle[1]{%
   \def\modref@tagstyle##1{#1}%
   \def\tagform@##1{\maketag@@@{\modref@tagstyle{##1}}}%
   \@ifundefined{modref@eqref}{%
      \eqrefstyle{\textup{(\ignorespaces#1\unskip\@@italiccorr)}}%
   }\relax
}%
\makeatother
\endinput
%%
%% End of file `modref.sty'.
