%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% old-arrows.sty. Version: 1.2 - October 11, 2015.
% Author: Riccardo DOSSENA <riccardo.dossena@gmail.com>
%
% This package provides old-style cm arrows with smaller arrowheads,
% associated with ordinary commands.
% Use the option `new' if you want to use the new-style
% cm arrows simultaneously: simply put \var before every command.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright 2015 R. Dossena
%
% 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 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is R. Dossena.
%
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{old-arrows}[2015/10/11 v1.2 Old Arrows]

\@ifpackageloaded{lmodern}{%
\DeclareFontFamily{OMS}{oasy}{\skewchar\font48 }
\DeclareFontShape{OMS}{oasy}{m}{n}{%
         <-5.5> oasy5     <5.5-6.5> oasy6
      <6.5-7.5> oasy7     <7.5-8.5> oasy8
      <8.5-9.5> oasy9     <9.5->  oasy10
      }{}
\DeclareFontShape{OMS}{oasy}{b}{n}{%
       <-6> oabsy5
      <6-8> oabsy7
      <8->  oabsy10
      }{}
\relax}{%
\DeclareFontFamily{OMS}{oasy}{\skewchar\font48 }
\DeclareFontShape{OMS}{oasy}{m}{n}{%
      <5><6><7><8><9><10>gen*oasy%
      <10.95><12><14.4><17.28><20.74><24.88>oasy10%
      }{}
\DeclareFontShape{OMS}{oasy}{b}{n}{%
      <5><6><7><8><9>gen*oabsy%
      <10><10.95><12><14.4><17.28><20.74><24.88>oabsy10%
      }{}
\relax}

\DeclareSymbolFont{oasy}{OMS}{oasy}{m}{n}

\SetSymbolFont{oasy}{normal}{OMS}{oasy}{m}{n}
\SetSymbolFont{oasy}{bold}{OMS}{oasy}{b}{n}

\DeclareMathSymbol{\leftarrow}          {\mathrel}{oasy}{"20}
   \let\gets=\leftarrow
\DeclareMathSymbol{\rightarrow}         {\mathrel}{oasy}{"21}
   \let\to=\rightarrow
\DeclareMathSymbol{\leftrightarrow}     {\mathrel}{oasy}{"24}
\DeclareMathSymbol{\nearrow}            {\mathrel}{oasy}{"25}
\DeclareMathSymbol{\searrow}            {\mathrel}{oasy}{"26}
\DeclareMathSymbol{\nwarrow}            {\mathrel}{oasy}{"2D}
\DeclareMathSymbol{\swarrow}            {\mathrel}{oasy}{"2E}
\DeclareMathSymbol{\mapstochar}         {\mathrel}{oasy}{"37}
   \def\mapsto{\mapstochar\rightarrow}

\DeclareMathDelimiter{\uparrow}     {\mathrel}{oasy}{"22}{largesymbols}{"78}
\DeclareMathDelimiter{\downarrow}   {\mathrel}{oasy}{"23}{largesymbols}{"79}
\DeclareMathDelimiter{\updownarrow} {\mathrel}{oasy}{"6C}{largesymbols}{"3F}

%definitions of \meno, \joinrelaz and \relbarra
\DeclareMathSymbol{\meno} {\mathbin}{oasy}{"00}
\DeclareRobustCommand
  \joinrelaz{\mathrel{\mkern-3mu}}
\DeclareRobustCommand
  \relbarra{\mathrel{\smash\meno}} % \smash, because -
                               % has the same height as +

\DeclareRobustCommand\longrightarrow
     {\relbarra\joinrelaz\rightarrow}
\DeclareRobustCommand\longleftarrow
     {\leftarrow\joinrelaz\relbarra}

\def\rightarrowfill{$\m@th\smash\meno\mkern-7mu%
  \cleaders\hbox{$\mkern-2mu\smash\meno\mkern-2mu$}\hfill
  \mkern-7mu\mathord\rightarrow$}
\def\leftarrowfill{$\m@th\mathord\leftarrow\mkern-7mu%
  \cleaders\hbox{$\mkern-2mu\smash\meno\mkern-2mu$}\hfill
  \mkern-7mu\smash\meno$}

%amsmath redefinitions, if loaded
\@ifpackageloaded{amsmath}{%
\ams@def\relbarra{\mathrel{\mathpalette\mathsm@sh\meno}}
\def\leftarrowfill@{\arrowfill@\leftarrow\relbarra\relbarra}
\def\rightarrowfill@{\arrowfill@\relbarra\relbarra\rightarrow}
\def\leftrightarrowfill@{\arrowfill@\leftarrow\relbarra\rightarrow}
\relax}{}

%mathtools redefinitions, if loaded
\@ifpackageloaded{mathtools}{%
\renewcommand{\xleftrightarrow}[2][]{%
  \ext@arrow 3095\MTleftrightarrowfill@{#1}{#2}}
\def\MTleftrightarrowfill@{%
  \arrowfill@\leftarrow\relbarra\rightarrow}
\renewcommand{\xhookleftarrow}[2][]{%
  \ext@arrow 3095\MThookleftfill@{#1}{#2}}
\def\MThookleftfill@{%
  \arrowfill@\leftarrow\relbarra{\relbarra\joinrelaz\rhook}}
\renewcommand{\xhookrightarrow}[2][]{%
  \ext@arrow 3095\MThookrightfill@{#1}{#2}}
\def\MThookrightfill@{%
  \arrowfill@{\lhook\joinrelaz\relbarra}\relbarra\rightarrow}
\renewcommand{\xmapsto}[2][]{%
  \ext@arrow 0395\MTmapstofill@{#1}{#2}}
\def\MTmapstofill@{%
  \arrowfill@{\mapstochar\relbarra}\relbarra\rightarrow}
\relax}{}

%stmaryrd xmapsfrom (mathtools or amsmath needed)
\@ifpackageloaded{stmaryrd}{%
\newcommand{\xmapsfrom}[2][]{%
  \ext@arrow 3095\SMRmapsfromfill@{#1}{#2}}
\def\SMRmapsfromfill@{%
  \arrowfill@\leftarrow\relbarra{\relbarra\mapsfromchar}}
\relax}{}


%arrow commands provided by old-arrows
\DeclareRobustCommand\longhookrightarrow
    {\lhook\joinrelaz\longrightarrow}
\DeclareRobustCommand\longhookleftarrow
    {\longleftarrow\joinrelaz\rhook}
\DeclareRobustCommand\longrightharpoonup
    {\relbar\joinrel\rightharpoonup}
\DeclareRobustCommand\longrightharpoondown
    {\relbar\joinrel\rightharpoondown}
\DeclareRobustCommand\longleftharpoonup
    {\leftharpoonup\joinrel\relbar}
\DeclareRobustCommand\longleftharpoondown
    {\leftharpoondown\joinrel\relbar}


%new style arrows: \var before every command
\DeclareOption{new}{

\@ifpackageloaded{lmodern}{%
\DeclareSymbolFont{lmsy}{OMS}{lmsy}{m}{n}

\SetSymbolFont{lmsy}{normal}{OMS}{lmsy}{m}{n}
\SetSymbolFont{lmsy}{bold}{OMS}{lmsy}{b}{n}

\DeclareMathSymbol{\varleftarrow}{\mathrel}{lmsy}{"20}
   \let\vargets=\varleftarrow
\DeclareMathSymbol{\varrightarrow}{\mathrel}{lmsy}{"21}
   \let\varto=\varrightarrow
\DeclareMathSymbol{\varleftrightarrow}     {\mathrel}{lmsy}{"24}
\DeclareMathSymbol{\varnearrow}            {\mathrel}{lmsy}{"25}
\DeclareMathSymbol{\varsearrow}            {\mathrel}{lmsy}{"26}
\DeclareMathSymbol{\varnwarrow}            {\mathrel}{lmsy}{"2D}
\DeclareMathSymbol{\varswarrow}            {\mathrel}{lmsy}{"2E}
\DeclareMathSymbol{\varmapstochar}         {\mathrel}{lmsy}{"37}
   \def\varmapsto{\varmapstochar\varrightarrow}
   \def\varhookrightarrow{\lhook\joinrel\varrightarrow}
   \def\varhookleftarrow{\varleftarrow\joinrel\rhook}

\DeclareMathDelimiter{\varuparrow}     {\mathrel}{lmsy}{"22}{largesymbols}{"78}
\DeclareMathDelimiter{\vardownarrow}   {\mathrel}{lmsy}{"23}{largesymbols}{"79}
\DeclareMathDelimiter{\varupdownarrow} {\mathrel}{lmsy}{"6C}{largesymbols}{"3F}
\relax}{%
\DeclareSymbolFont{cmsy}{OMS}{cmsy}{m}{n}

\SetSymbolFont{cmsy}{normal}{OMS}{cmsy}{m}{n}
\SetSymbolFont{cmsy}{bold}{OMS}{cmsy}{b}{n}

\DeclareMathSymbol{\varleftarrow}{\mathrel}{cmsy}{"20}
   \let\vargets=\varleftarrow
\DeclareMathSymbol{\varrightarrow}{\mathrel}{cmsy}{"21}
   \let\varto=\varrightarrow
\DeclareMathSymbol{\varleftrightarrow}     {\mathrel}{cmsy}{"24}
\DeclareMathSymbol{\varnearrow}            {\mathrel}{cmsy}{"25}
\DeclareMathSymbol{\varsearrow}            {\mathrel}{cmsy}{"26}
\DeclareMathSymbol{\varnwarrow}            {\mathrel}{cmsy}{"2D}
\DeclareMathSymbol{\varswarrow}            {\mathrel}{cmsy}{"2E}
\DeclareMathSymbol{\varmapstochar}         {\mathrel}{cmsy}{"37}
   \def\varmapsto{\varmapstochar\varrightarrow}
   \def\varhookrightarrow{\lhook\joinrel\varrightarrow}
   \def\varhookleftarrow{\varleftarrow\joinrel\rhook}

\DeclareMathDelimiter{\varuparrow}     {\mathrel}{cmsy}{"22}{largesymbols}{"78}
\DeclareMathDelimiter{\vardownarrow}   {\mathrel}{cmsy}{"23}{largesymbols}{"79}
\DeclareMathDelimiter{\varupdownarrow} {\mathrel}{cmsy}{"6C}{largesymbols}{"3F}
\relax}

\def\varoverrightarrow#1{\vbox{\m@th\ialign{##\crcr
      \varrightarrowfill\crcr\noalign{\kern-\p@\nointerlineskip}
      $\hfil\displaystyle{#1}\hfil$\crcr}}}
\def\varoverleftarrow#1{\vbox{\m@th\ialign{##\crcr
      \varleftarrowfill\crcr\noalign{\kern-\p@\nointerlineskip}%
      $\hfil\displaystyle{#1}\hfil$\crcr}}}
\def\varrightarrowfill{$\m@th\smash-\mkern-7mu%
  \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
  \mkern-7mu\mathord\varrightarrow$}
\def\varleftarrowfill{$\m@th\mathord\varleftarrow\mkern-7mu%
  \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
  \mkern-7mu\smash-$}

\DeclareRobustCommand\varlongrightarrow
     {\relbar\joinrel\varrightarrow}
\DeclareRobustCommand\varlongleftarrow
     {\varleftarrow\joinrel\relbar}
\DeclareRobustCommand
  \varlongmapsto{\varmapstochar\varlongrightarrow}
\DeclareRobustCommand
  \varlongleftrightarrow{\varleftarrow\joinrel\varrightarrow}

%new commands provided by old-arrows with option new
\DeclareRobustCommand\varlonghookrightarrow
    {\lhook\joinrel\varlongrightarrow}
\DeclareRobustCommand\varlonghookleftarrow
    {\varlongleftarrow\joinrel\rhook}


%new-style arrows provided by amsmath, if loaded
\@ifpackageloaded{amsmath}{%
\def\varleftarrowfill@{\arrowfill@\varleftarrow\relbar\relbar}
\def\varrightarrowfill@{\arrowfill@\relbar\relbar\varrightarrow}
\def\varleftrightarrowfill@{\arrowfill@\varleftarrow\relbar\varrightarrow}
\ams@renewcommand{\varoverrightarrow}{%
  \mathpalette{\overarrow@\varrightarrowfill@}}
\ams@renewcommand{\varoverleftarrow}{%
  \mathpalette{\overarrow@\varleftarrowfill@}}
\ams@newcommand{\varoverleftrightarrow}{%
  \mathpalette{\overarrow@\varleftrightarrowfill@}}
\ams@newcommand{\varunderrightarrow}{%
  \mathpalette{\underarrow@\varrightarrowfill@}}
\ams@newcommand{\varunderleftarrow}{%
  \mathpalette{\underarrow@\varleftarrowfill@}}
\ams@newcommand{\varunderleftrightarrow}{%
  \mathpalette{\underarrow@\varleftrightarrowfill@}}
\newcommand{\varxrightarrow}[2][]{\ext@arrow 0359\varrightarrowfill@{#1}{#2}}
\newcommand{\varxleftarrow}[2][]{\ext@arrow 3095\varleftarrowfill@{#1}{#2}}
\def\varvarinjlim{%
  \mathop{\mathpalette\varlim@{\varrightarrowfill@\textstyle}}\nmlimits@
}
\def\varvarprojlim{%
  \mathop{\mathpalette\varlim@{\varleftarrowfill@\textstyle}}\nmlimits@
}
\relax}{}

%new-style support for mathtools
\@ifpackageloaded{mathtools}{%
\newcommand{\varxleftrightarrow}[2][]{%
  \ext@arrow 3095\varMTleftrightarrowfill@{#1}{#2}}
\def\varMTleftrightarrowfill@{%
  \arrowfill@\varleftarrow\relbar\varrightarrow}
\newcommand{\varxhookleftarrow}[2][]{%
  \ext@arrow 3095\varMThookleftfill@{#1}{#2}}
\def\varMThookleftfill@{%
  \arrowfill@\varleftarrow\relbar{\relbar\joinrel\rhook}}
\newcommand{\varxhookrightarrow}[2][]{%
  \ext@arrow 3095\varMThookrightfill@{#1}{#2}}
\def\varMThookrightfill@{%
  \arrowfill@{\lhook\joinrel\relbar}\relbar\varrightarrow}
\newcommand{\varxmapsto}[2][]{%
  \ext@arrow 0395\varMTmapstofill@{#1}{#2}}
\def\varMTmapstofill@{%
  \arrowfill@{\mapstochar\relbar}\relbar\varrightarrow}
\relax}{}

%new-style support for St Mary's Road fonts
\@ifpackageloaded{stmaryrd}{%
\stmry@if\def\varmapsfrom{\varleftarrow\mapsfromchar}\fi
\stmry@if\def\varlongmapsfrom{\varlongleftarrow\mapsfromchar}\fi
%stmaryrd new-style xmapsfrom (mathtools or amsmath needed)
\newcommand{\varxmapsfrom}[2][]{%
  \ext@arrow 3095\varSMRmapsfromfill@{#1}{#2}}
\def\varSMRmapsfromfill@{%
  \arrowfill@\varleftarrow\relbar{\relbar\mapsfromchar}}
\relax}{}

}
\ProcessOptions\relax
\endinput
