% arevmath.sty
% Part of the Arev Sans package by Stephen Hartke, 20050620

\def\fileversion{0.1}%
\def\filedate{2005/05/27}%
\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{arevmath}%
[\filedate\space\fileversion\space Arev Sans Math package]%
\RequirePackage{amssymb}
\RequirePackage{ams-mdbch}
\RequirePackage{ifthen}

% The defaults for which variant letters to use
% The "@" in the variable names prevents the variables from being accessed outside of this file.
\newcommand{\var@a}{true}
\newcommand{\var@i}{true}
\newcommand{\var@I}{true}
\newcommand{\var@f}{false}
\newcommand{\var@l}{true}
\newcommand{\var@u}{true}
\newcommand{\var@v}{true}
\newcommand{\var@w}{true}
\newcommand{\var@x}{true}
\newcommand{\var@Pi}{true}
\newcommand{\var@Phi}{true}

\DeclareOption{origletters}{
\renewcommand{\var@a}{false}
\renewcommand{\var@i}{false}
\renewcommand{\var@I}{false}
\renewcommand{\var@f}{false}
\renewcommand{\var@l}{false}
\renewcommand{\var@u}{false}
\renewcommand{\var@v}{false}
\renewcommand{\var@w}{false}
\renewcommand{\var@x}{false}
\renewcommand{\var@Pi}{false}
\renewcommand{\var@Phi}{false}
}
\DeclareOption{vara}{\renewcommand{\var@a}{true}}
\DeclareOption{vari}{\renewcommand{\var@i}{true}}
\DeclareOption{varI}{\renewcommand{\var@I}{true}} % no varIota option!
\DeclareOption{varf}{\renewcommand{\var@f}{true}}
\DeclareOption{varl}{\renewcommand{\var@l}{true}}
\DeclareOption{varu}{\renewcommand{\var@u}{true}}
\DeclareOption{varv}{\renewcommand{\var@v}{true}}
\DeclareOption{varw}{\renewcommand{\var@w}{true}}
\DeclareOption{varPi}{\renewcommand{\var@Pi}{true}}
\DeclareOption{varPhi}{\renewcommand{\var@Phi}{true}}
\DeclareOption*{\message{Error: option not recognized.}\MessageBreak}
\ProcessOptions


% See the file fntguide.pdf, "LaTeX2e font selection" by the LaTeX3 Project Team
% for documentation on how to setup math fonts.

% The normal math version is predefined.
%\DeclareMathVersion{normal}

% These are the predefined symbol alphabets.
\SetSymbolFont{operators}    {normal}{OT1}{zavm}{m}{n}
\SetSymbolFont{letters}      {normal}{OML}{zavm}{m}{it}
\SetSymbolFont{symbols}      {normal}{OMS}{zavm}{m}{n}
\SetSymbolFont{largesymbols} {normal}{OMX}{mdbch}{m}{n}

% These are the predefined math alphabets.
%\SetMathAlphabet{\mathnormal}{normal}{OML}{zavm}{m}{it}
%\SetMathAlphabet{\mathit}    {normal}{OML}{zavm}{m}{it}
%\SetMathAlphabet{\mathrm}    {normal}{OT1}{zavm}{m}{n}
%\SetMathAlphabet{\mathsf}    {normal}{OML}{zavm}{m}{it}
\SetMathAlphabet{\mathbf}    {normal}{OT1}{zavm}{b}{n}
\SetMathAlphabet{\mathtt}    {normal}{T1} {fvm} {m}{n}

% Change this predefined math alphabet for bold, too.
\DeclareMathAlphabet{\mathcal}       {OMS}{cmsy}{m}{n} % Computer Modern calligraphy

% Using DeclareSymbolFontAlphabet instead of SetMathAlphabet makes better use of TeX's limited number (16) of math groups.
\DeclareSymbolFontAlphabet{\mathnormal}{letters}
\DeclareSymbolFontAlphabet{\mathit}    {letters}
\DeclareSymbolFontAlphabet{\mathrm}    {operators}
\DeclareSymbolFontAlphabet{\mathsf}    {letters}


% These math alphabets need to be declared. Since defaults are set, SetMathAlphabet is not needed.
\DeclareMathAlphabet{\mathscr}       {U}  {rsfs}{m}{n} % Ralph Smith Formal Script
\DeclareMathAlphabet{\mathbm}        {OML}{zavm}{b}{it}
%\DeclareMathAlphabet{\mathbold}      {OML}{zavm}{b}{it}

% Use Fourier for blackboard bold since it's sans serif.
% fourier-bb doesn't have a .fd font definition file in the fourier package.
\DeclareFontFamily{U}{futm}{}
\DeclareFontShape{U}{futm}{m}{n}{
  <-> s * [1.04] fourier-bb
  }{}
\DeclareMathAlphabet{\mathbb}        {U}  {futm}{m}{n} % Fourier-GUTenberg blackboard bold


% The bold math version is predefined.
%\DeclareMathVersion{bold}

% These are the predefined symbol alphabets.
\SetSymbolFont{operators}    {bold}  {OT1}{zavm}{b}{n}
\SetSymbolFont{letters}      {bold}  {OML}{zavm}{b}{it}
\SetSymbolFont{symbols}      {bold}  {OMS}{zavm}{b}{n}
\SetSymbolFont{largesymbols} {bold}  {OMX}{mdbch}{b}{n}

% These are the only alphabets that change.
\SetMathAlphabet{\mathbf}    {bold}  {OT1}{zavm}{b}{n}
\SetMathAlphabet{\mathtt}    {bold}  {T1} {fvm} {b}{n}


% From the Math Design Bitstream Charter fonts:
\DeclareMathAccent{\widetilde}{\mathord}{largesymbols}{"65}
\DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62}
\DeclareMathAccent{\widetriangle}{\mathord}{largesymbols}{"E6}
\DeclareMathAccent{\wideparen}{\mathord}{largesymbols}{"F3}


%% -------------------------------------------------------------------
%% Double left and right bracket
%% -------------------------------------------------------------------

%\MD@def\DeclareMathDelimiter{\llbracket}{\mathopen} {largesymbols}{"B9}{largesymbols}{"83}
%\MD@def\DeclareMathDelimiter{\rrbracket}{\mathclose}{largesymbols}{"BA}{largesymbols}{"8D}

%% -------------------------------------------------------------------
%% Wavy vertical lines
%% -------------------------------------------------------------------

%\MD@def\DeclareMathDelimiter{\lwave}{\mathopen} {largesymbols}{"D0}{largesymbols}{"D0}
%\MD@def\DeclareMathDelimiter{\rwave}{\mathclose}{largesymbols}{"D0}{largesymbols}{"D0}

%\MD@def\DeclareMathDelimiter{\levaw}{\mathopen} {largesymbols}{"D1}{largesymbols}{"D1}
%\MD@def\DeclareMathDelimiter{\revaw}{\mathclose}{largesymbols}{"D1}{largesymbols}{"D1}

%\def\leftwave{\left\lwave}
%\def\rightwave{\right\rwave}
%\def\leftevaw{\left\levaw}
%\def\rightevaw{\right\revaw}


% Set the default sizes larger than normal since we only have one optical size.
\def\defaultscriptratio{.76}
\def\defaultscriptscriptratio{.6}
\DeclareMathSizes{5}    {5}    {5}    {5}
\DeclareMathSizes{6}    {6}    {5}    {5}
\DeclareMathSizes{7}    {7}    {5}    {5}
\DeclareMathSizes{8}    {8}    {6}    {5}
\DeclareMathSizes{9}    {9}    {7}    {5}
\DeclareMathSizes{10}   {10}   {7.6}  {6}
\DeclareMathSizes{10.95}{10.95}{8}    {6}
\DeclareMathSizes{12}   {12}   {9}    {7}
\DeclareMathSizes{14.4} {14.4} {10}   {8}
\DeclareMathSizes{17.28}{17.28}{12}   {10}
\DeclareMathSizes{20.74}{20.74}{14.4} {12}
\DeclareMathSizes{24.88}{24.88}{20.74}{14.4}

% upright Greek? Not italicize var and orig capital Greek?
% over and under braces and square roots from mdbch are screwed up.
% accents?
% fix undefined small caps in text
% text symbols, like dagger and footnote and so on?

% for extra symbols and nonstandard alternate glyphs
\DeclareSymbolFont{extraup}          {U}{zavm}{m}{n}
\DeclareSymbolFont{extraitalic}      {U}{zavm}{m}{it}

% variant letters
\DeclareMathSymbol{\origa}     {\mathalpha}{extraitalic}{50}
\DeclareMathSymbol{\origi}     {\mathalpha}{extraitalic}{58}
\DeclareMathSymbol{\origimath} {\mathalpha}{extraitalic}{76}
\DeclareMathSymbol{\origI}     {\mathalpha}{extraitalic}{30}
\DeclareMathSymbol{\origf}     {\mathalpha}{extraitalic}{55}
\DeclareMathSymbol{\origl}     {\mathalpha}{extraitalic}{61}
\DeclareMathSymbol{\origu}     {\mathalpha}{extraitalic}{70}
\DeclareMathSymbol{\origv}     {\mathalpha}{extraitalic}{71}
\DeclareMathSymbol{\origw}     {\mathalpha}{extraitalic}{72}
\DeclareMathSymbol{\origx}     {\mathalpha}{extraitalic}{73}
\DeclareMathSymbol{\origIota}  {\mathord}  {extraitalic}{87}
\DeclareMathSymbol{\origPi}    {\mathord}  {extraup}    {93}
\DeclareMathSymbol{\origPhi}   {\mathord}  {extraup}    {94}

\DeclareMathSymbol{\vara}      {\mathalpha}{extraitalic}{139}
\DeclareMathSymbol{\vari}      {\mathalpha}{extraitalic}{140}
\DeclareMathSymbol{\varimath}  {\mathalpha}{extraitalic}{111}
\DeclareMathSymbol{\varI}      {\mathalpha}{extraitalic}{138}
\DeclareMathSymbol{\varf}      {\mathalpha}{extraitalic}{149}
\DeclareMathSymbol{\varl}      {\mathalpha}{extraitalic}{141}
\DeclareMathSymbol{\varu}      {\mathalpha}{extraitalic}{142}
\DeclareMathSymbol{\varv}      {\mathalpha}{extraitalic}{143}
\DeclareMathSymbol{\varw}      {\mathalpha}{extraitalic}{144}
\DeclareMathSymbol{\varx}      {\mathalpha}{extraitalic}{145}
\DeclareMathSymbol{\varIota}   {\mathord}  {extraitalic}{146}
\DeclareMathSymbol{\varPi}     {\mathord}  {operators}  {5}
\DeclareMathSymbol{\varPhi}    {\mathord}  {operators}  {8}

\ifthenelse{\equal{\var@a}  {true}}{}{\DeclareMathSymbol{a}         {\mathalpha}{extraitalic}{50}}
\ifthenelse{\equal{\var@i}  {true}}{}{\DeclareMathSymbol{i}         {\mathalpha}{extraitalic}{58}
                                      \DeclareMathSymbol{\imath}    {\mathord}  {extraitalic}{76}}
\ifthenelse{\equal{\var@I}  {true}}{}{\DeclareMathSymbol{I}         {\mathalpha}{extraitalic}{30}}
\ifthenelse{\equal{\var@f} {false}}{}{\DeclareMathSymbol{f}         {\mathalpha}{extraitalic}{149}}
\ifthenelse{\equal{\var@l}  {true}}{}{\DeclareMathSymbol{l}         {\mathalpha}{extraitalic}{61}}
\ifthenelse{\equal{\var@u}  {true}}{}{\DeclareMathSymbol{u}         {\mathalpha}{extraitalic}{70}}
\ifthenelse{\equal{\var@v}  {true}}{}{\DeclareMathSymbol{v}         {\mathalpha}{extraitalic}{71}}
\ifthenelse{\equal{\var@w}  {true}}{}{\DeclareMathSymbol{w}         {\mathalpha}{extraitalic}{72}}
\ifthenelse{\equal{\var@x}  {true}}{}{\DeclareMathSymbol{x}         {\mathalpha}{extraitalic}{73}}
\ifthenelse{\equal{\var@Pi} {true}}{}{\DeclareMathSymbol{\Pi}       {\mathord}  {extraup}    {93}}
\ifthenelse{\equal{\var@Phi}{true}}{}{\DeclareMathSymbol{\Phi}      {\mathord}  {extraup}    {94}}


% Extra Symbols
\DeclareMathSymbol{\varspade}  {\mathalpha}{extraup}    {85}
\DeclareMathSymbol{\varheart}  {\mathalpha}{extraup}    {86}
\DeclareMathSymbol{\vardiamond}{\mathalpha}{extraup}    {87}
\DeclareMathSymbol{\varclub}   {\mathalpha}{extraup}    {88}
\DeclareMathSymbol{\steaming}  {\mathalpha}{extraup}    {89}
\DeclareMathSymbol{\quarternote}{\mathalpha}{extraup}   {90}
\DeclareMathSymbol{\eighthnote}{\mathalpha}{extraup}    {91}
\DeclareMathSymbol{\sixteenthnote}{\mathalpha}{extraup} {92}

\endinput
