%% eulerpx.sty
%% Copyright 2017 J. A. Ouassou
%%
%% 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 J. A. Ouassou.
%%
%% This work consists of the file eulerpx.sty.
%%

% Package metadata
\def\fileversion{v0.2}
\def\filedate{2017/02/03}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{eulerpx}[\filedate\space\fileversion]
\typeout{Package: `eulerpx' \fileversion\space<\filedate>}

% Make sure we have support for T1 symbols
\RequirePackage[T1]{fontenc}

% Inherit math symbols from the `newpxmath' package
\RequirePackage[varbb,upint]{newpxmath}

% Declare the math serif font
\DeclareMathVersion{normal}
\SetSymbolFont{operators}{normal}{T1}{\rmdefault}{m}{n} 
\SetMathAlphabet{\mathrm}{normal}{T1}{\rmdefault}{m}{n}

% Declare the math sans font
\DeclareMathVersion{sans}
\SetSymbolFont{operators}{sans}{T1}{\sfdefault}{m}{n} 
\SetMathAlphabet{\mathrm}{sans}{T1}{\sfdefault}{m}{n}

% Make the package toggle between sans/serif math automatically
\let\oldrmfamily=\rmfamily
\let\oldsffamily=\sffamily
\renewcommand{\rmfamily}{\oldrmfamily\mathversion{normal}}
\renewcommand{\sffamily}{\oldsffamily\mathversion{sans}}

%% Get rid of the existing \mathbf font
\let\mathbf=\relax

% Declare Euler math alphabets
\DeclareSymbolFont{letters}      {U}{zeur}{m}{n}
\SetSymbolFont{letters}{bold}    {U}{zeur}{b}{n}
\DeclareMathAlphabet{\mathbf}    {U}{zeur}{b}{n}

% Upper-case greek letters
\DeclareMathSymbol{\Gamma}      {\mathalpha}{letters}{"00}
\DeclareMathSymbol{\Delta}      {\mathalpha}{letters}{"01}
\DeclareMathSymbol{\Theta}      {\mathalpha}{letters}{"02}
\DeclareMathSymbol{\Lambda}     {\mathalpha}{letters}{"03}
\DeclareMathSymbol{\Xi}         {\mathalpha}{letters}{"04}
\DeclareMathSymbol{\Pi}         {\mathalpha}{letters}{"05}
\DeclareMathSymbol{\Sigma}      {\mathalpha}{letters}{"06}
\DeclareMathSymbol{\Upsilon}    {\mathalpha}{letters}{"07}
\DeclareMathSymbol{\Phi}        {\mathalpha}{letters}{"08}
\DeclareMathSymbol{\Psi}        {\mathalpha}{letters}{"09}
\DeclareMathSymbol{\Omega}      {\mathalpha}{letters}{"0A}

\DeclareMathSymbol{\upOmega}    {\mathord}{letters}{"0A}
\DeclareMathSymbol{\upDelta}    {\mathord}{letters}{"01}

% Lower-case greek letters
\DeclareMathSymbol{\alpha}      {\mathalpha}{letters}{"0B}
\DeclareMathSymbol{\beta}       {\mathalpha}{letters}{"0C}
\DeclareMathSymbol{\gamma}      {\mathalpha}{letters}{"0D}
\DeclareMathSymbol{\delta}      {\mathalpha}{letters}{"0E}
\DeclareMathSymbol{\epsilon}    {\mathalpha}{letters}{"0F}
\DeclareMathSymbol{\zeta}       {\mathalpha}{letters}{"10}
\DeclareMathSymbol{\eta}        {\mathalpha}{letters}{"11}
\DeclareMathSymbol{\theta}      {\mathalpha}{letters}{"12}
\DeclareMathSymbol{\iota}       {\mathalpha}{letters}{"13}
\DeclareMathSymbol{\kappa}      {\mathalpha}{letters}{"14}
\DeclareMathSymbol{\lambda}     {\mathalpha}{letters}{"15}
\DeclareMathSymbol{\mu}         {\mathalpha}{letters}{"16}
\DeclareMathSymbol{\nu}         {\mathalpha}{letters}{"17}
\DeclareMathSymbol{\xi}         {\mathalpha}{letters}{"18}
\DeclareMathSymbol{\pi}         {\mathalpha}{letters}{"19}
\DeclareMathSymbol{\rho}        {\mathalpha}{letters}{"1A}
\DeclareMathSymbol{\sigma}      {\mathalpha}{letters}{"1B}
\DeclareMathSymbol{\tau}        {\mathalpha}{letters}{"1C}
\DeclareMathSymbol{\upsilon}    {\mathalpha}{letters}{"1D}
\DeclareMathSymbol{\phi}        {\mathalpha}{letters}{"1E}
\DeclareMathSymbol{\chi}        {\mathalpha}{letters}{"1F}
\DeclareMathSymbol{\psi}        {\mathalpha}{letters}{"20}
\DeclareMathSymbol{\omega}      {\mathalpha}{letters}{"21}
\DeclareMathSymbol{\varepsilon} {\mathalpha}{letters}{"22}
\DeclareMathSymbol{\vartheta}   {\mathalpha}{letters}{"23}
\DeclareMathSymbol{\varpi}      {\mathalpha}{letters}{"24}
\DeclareMathSymbol{\varphi}     {\mathalpha}{letters}{"27}

\let\varsigma=\sigma
\let\varrho=\rho

% Math accents
\DeclareMathAccent{\acute}{\mathalpha}{operators}{1}
\DeclareMathAccent{\grave}{\mathalpha}{operators}{0}
\DeclareMathAccent{\ddot}{\mathalpha}{operators}{4}
\DeclareMathAccent{\tilde}{\mathalpha}{operators}{3}
\DeclareMathAccent{\bar}{\mathalpha}{operators}{9}
\DeclareMathAccent{\breve}{\mathalpha}{operators}{8}
\DeclareMathAccent{\check}{\mathalpha}{operators}{7}
\DeclareMathAccent{\hat}{\mathalpha}{operators}{2}
\DeclareMathAccent{\dot}{\mathalpha}{operators}{10}

% Numbers
\DeclareMathSymbol{0}{\mathord}{operators}{`0}
\DeclareMathSymbol{1}{\mathord}{operators}{`1}
\DeclareMathSymbol{2}{\mathord}{operators}{`2}
\DeclareMathSymbol{3}{\mathord}{operators}{`3}
\DeclareMathSymbol{4}{\mathord}{operators}{`4}
\DeclareMathSymbol{5}{\mathord}{operators}{`5}
\DeclareMathSymbol{6}{\mathord}{operators}{`6}
\DeclareMathSymbol{7}{\mathord}{operators}{`7}
\DeclareMathSymbol{8}{\mathord}{operators}{`8}
\DeclareMathSymbol{9}{\mathord}{operators}{`9}

% Punctuation
\DeclareMathSymbol{!}{\mathclose}{operators}{"21}
\DeclareMathSymbol{,}{\mathpunct}{operators}{`\,}
\DeclareMathSymbol{.}{\mathord}{operators}{`\.}
\DeclareMathSymbol{:}{\mathrel}{operators}{`\:}
\DeclareMathSymbol{;}{\mathpunct}{operators}{`\;}
\DeclareMathSymbol{?}{\mathclose}{operators}{`\?}

% Miscellaneous
\DeclareMathSymbol{\hbar}{\mathord}{letters}{128}
\DeclareMathSymbol{\infty}{\mathord}{largesymbols}{153}

% Unicode input
\DeclareOption{utf8}%
{
  \DeclareUnicodeCharacter{0393}{\Gamma}
  \DeclareUnicodeCharacter{0394}{\Delta}
  \DeclareUnicodeCharacter{0398}{\Theta}     
  \DeclareUnicodeCharacter{039B}{\Lambda}
  \DeclareUnicodeCharacter{039E}{\Xi}
  \DeclareUnicodeCharacter{03A0}{\Pi}
  \DeclareUnicodeCharacter{03A3}{\Sigma}
  \DeclareUnicodeCharacter{03A5}{\Upsilon}
  \DeclareUnicodeCharacter{03A6}{\Phi}
  \DeclareUnicodeCharacter{03A8}{\Psi}
  \DeclareUnicodeCharacter{03A9}{\Omega}
  \DeclareUnicodeCharacter{03B1}{\alpha}
  \DeclareUnicodeCharacter{03B2}{\beta}
  \DeclareUnicodeCharacter{03B3}{\gamma}
  \DeclareUnicodeCharacter{03B4}{\delta}
  \DeclareUnicodeCharacter{03B5}{\epsilon}
  \DeclareUnicodeCharacter{03B6}{\zeta}
  \DeclareUnicodeCharacter{03B7}{\eta}
  \DeclareUnicodeCharacter{03B8}{\theta}
  \DeclareUnicodeCharacter{03B9}{\iota}
  \DeclareUnicodeCharacter{03BA}{\kappa}
  \DeclareUnicodeCharacter{03BB}{\lambda}
  \DeclareUnicodeCharacter{03BC}{\mu}
  \DeclareUnicodeCharacter{03BD}{\nu}
  \DeclareUnicodeCharacter{03BE}{\xi}
  \DeclareUnicodeCharacter{03C0}{\pi}
  \DeclareUnicodeCharacter{03C1}{\rho}
  \DeclareUnicodeCharacter{03C2}{\sigma}
  \DeclareUnicodeCharacter{03C3}{\sigma}
  \DeclareUnicodeCharacter{03C4}{\tau}
  \DeclareUnicodeCharacter{03C5}{\upsilon}
  \DeclareUnicodeCharacter{03C6}{\varphi}
  \DeclareUnicodeCharacter{03C7}{\chi}
  \DeclareUnicodeCharacter{03C8}{\psi}
  \DeclareUnicodeCharacter{03C9}{\omega}
}

\ProcessOptions\relax
