%%
\def\fileversion{1.0}
\def\filedate{93/01/18}
%%
%% COPYRIGHT 1993 Martin Ward, Martin.Ward@durham.ac.uk
%%
%% DESCRIPTION:
%%   Set text in pandora and maths in euler fonts where possible.
%%   Uses the new font selection scheme.
%%
%% INSTALLATION:
%%   Put this file where your TeX looks for inputs, under the name
%%   pandora.sty.
%%
%% DOCUMENTATION:
%%   Include pandora as a LaTeX style option. Most text will be set in
%%   the pandora fonts (apart from caps/small caps, bold extended
%%   slanted/italic and semibold condensed, which will appear in Computer
%%   Modern).
%%   Requires the new font selection scheme.
%%
%% COPYING:
%%   This program is free software; you can redistribute it and/or modify
%%   it under the terms of the GNU General Public License as published by
%%   the Free Software Foundation; either version 2 of the License, or
%%   (at your option) any later version.
%%  
%%   This program is distributed in the hope that it will be useful,
%%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%%   GNU General Public License for more details.
%%  
%%   You should have received a copy of the GNU General Public License
%%   along with this program; if not, write to the Free Software
%%   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%%
%% CODE:
\@ifundefined{selectfont}
     {\@latexerr{`pandora' style option could only be used
		  with the new font selection scheme}\@eha
      \endinput}{}

\input{amsfonts.sty}

%% Please don't change the next lines unless you know exactly what you
%% are doing.
%%
%\def\default@shape{n}
%\def\default@series{m}
%\def\default@family{cmr}
\def\default@family{pnr}
%\def\default@errfont{cmsy10}
%%
%% Again, this is doubly dangerous bent.
%%
\fontfamily\default@family
\fontseries\default@series
\fontshape\default@shape



\new@fontshape{pnr}{m}{n}{%
      <5>pnr10 at4.82pt%
      <6>pnr10 at5.79pt%
      <7>pnr10 at6.94pt%
      <8>pnr10 at8.33pt%
      <9>pnr10 at9.13pt%
      <10>pnr10%
      <11>pnr10 at10.95pt%
      <12>pnr10 at12pt%
      <14>pnr10 at14.4pt%
      <17>pnr10 at17.28pt%
      <20>pnr10 at20.74pt%
      <25>pnr10 at24.88pt}{}
\extra@def{pnr}{}{}
\new@fontshape{pnr}{m}{sl}{%
      <5>pnsl10 at4.82pt%
      <6>pnsl10 at5.79pt%
      <7>pnsl10 at6.94pt%
      <8>pnsl10 at8.33pt%
      <9>pnsl10 at9.13pt%
      <10>pnsl10%
      <11>pnsl10 at10.95pt%
      <12>pnsl10 at12pt%
      <14>pnsl10 at14.4pt%
      <17>pnsl10 at17.28pt%
      <20>pnsl10 at20.74pt%
      <25>pnsl10 at24.88pt}{}

\subst@fontshape{pnr}{m}{it}{pnr}{m}{sl}

% \new@fontshape{pnr}{m}{it}{%
%       <5>pnsl10 at4.82pt%
%       <6>pnsl10 at5.79pt%
%       <7>pnsl10 at6.94pt%
%       <8>pnsl10 at8.33pt%
%       <9>pnsl10 at9.13pt%
%       <10>pnsl10%
%       <11>pnsl10 at10.95pt%
%       <12>pnsl10 at12pt%
%       <14>pnsl10 at14.4pt%
%       <17>pnsl10 at17.28pt%
%       <20>pnsl10 at20.74pt%
%       <25>pnsl10 at24.88pt}{}

% Hmmm... can't find a Pandora small caps, use cmsc for now:
\subst@fontshape{pnr}{m}{sc}{cmr}{m}{sc}

% \new@fontshape{pnr}{m}{sc}{%
%       <5>cmsl10 at4.82pt%
%       <6>cmsl10 at5.79pt%
%       <7>cmsl10 at6.94pt%
%       <8>cmsl10 at8.33pt%
%       <9>cmsl10 at9.13pt%
%       <10>cmsl10%
%       <11>cmsl10 at10.95pt%
%       <12>cmsl10 at12pt%
%       <14>cmsl10 at14.4pt%
%       <17>cmsl10 at17.28pt%
%       <20>cmsl10 at20.74pt%
%       <25>cmsl10 at24.88pt}{}

\new@fontshape{pnr}{b}{n}{%
      <5>pnb10 at4.82pt%
      <6>pnb10 at5.79pt%
      <7>pnb10 at6.94pt%
      <8>pnb10 at8.33pt%
      <9>pnb10 at9.13pt%
      <10>pnb10%
      <11>pnb10 at10.95pt%
      <12>pnb10 at12pt%
      <14>pnb10 at14.4pt%
      <17>pnb10 at17.28pt%
      <20>pnb10 at20.74pt%
      <25>pnb10 at24.88pt}{}

%%%%%%%%% bold extended series
\subst@fontshape{pnr}{bx}{n}{pnr}{b}{n}
\subst@fontshape{pnr}{bx}{sl}{cmr}{bx}{sl}
\subst@fontshape{pnr}{bx}{it}{cmr}{bx}{sl}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%  Sans serif font shapes
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\new@fontshape{pnss}{m}{n}{%
      <5>pnss10 at4.82pt%
      <6>pnss10 at5.79pt%
      <7>pnss10 at6.94pt%
      <8>pnss10 at8.33pt%
      <9>pnss10 at9.13pt%
      <10>pnss10%
      <11>pnss10 at10.95pt%
      <12>pnss10 at12pt%
      <14>pnss10 at14.4pt%
      <17>pnss10 at17.28pt%
      <20>pnss10 at20.74pt%
      <25>pnss10 at24.88pt}{}

\subst@fontshape{pnss}{m}{it}{pnss}{m}{sl}

\new@fontshape{pnss}{m}{sl}{%
      <5>pnssi10 at4.82pt%
      <6>pnssi10 at5.79pt%
      <7>pnssi10 at6.94pt%
      <8>pnssi10 at8.33pt%
      <9>pnssi10 at9.13pt%
      <10>pnssi10%
      <11>pnssi10 at10.95pt%
      <12>pnssi10 at12pt%
      <14>pnssi10 at14.4pt%
      <17>pnssi10 at17.28pt%
      <20>pnssi10 at20.74pt%
      <25>pnssi10 at24.88pt}{}


%%%%%%% Font/shape undefined, therefore substituted

\subst@fontshape{pnss}{m}{sc}{cmr}{m}{sc}

%%%%%%%% semibold condensed series
\subst@fontshape{pnss}{sbc}{n}{cmr}{sbc}{n}

%%%%%%%%% bold extended series

\new@fontshape{pnss}{bx}{n}{%
      <5>pnssb10 at4.82pt%
      <6>pnssb10 at5.79pt%
      <7>pnssb10 at6.94pt%
      <8>pnssb10 at8.33pt%
      <9>pnssb10 at9.13pt%
      <10>pnssb10%
      <11>pnssb10 at10.95pt%
      <12>pnssb10 at12pt%
      <14>pnssb10 at14.4pt%
      <17>pnssb10 at17.28pt%
      <20>pnssb10 at20.74pt%
      <25>pnssb10 at24.88pt}{}


\extra@def{pnss}{}{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%  Typewriter font shapes
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\new@fontshape{pntt}{m}{n}{%
      <5>pntt9 at4.82pt%
      <6>pntt9 at5.79pt%
      <7>pntt9 at6.94pt%
      <8>pntt9 at8.33pt%
      <9>pntt9%
      <10>pntt9 at 10pt%
      <11>pntt9 at10.95pt%
      <12>pntt9 at12pt%
      <14>pntt9 at14.4pt%
      <17>pntt9 at17.28pt%
      <20>pntt9 at20.74pt%
      <25>pntt9 at24.88pt}{}


\subst@fontshape{pntt}{m}{it}{cmtt}{m}{it}

\subst@fontshape{pntt}{m}{sl}{cmtt}{m}{sl}

\subst@fontshape{pntt}{m}{sc}{cmtt}{m}{sc}


% From the Euler fonts designed by Hermann Zapf we need the families
% `euler cursive'. (Others will follow in the finial version of this
% option.) 
\new@fontshape{eur}{m}{n}{%
   <5>eurm5%
   <6>eurm6%
   <7>eurm7%
   <8>eurm8%
   <9>eurm9%
   <10>eurm10%
   <11>eurm10 at10.95pt%
   <12>eurm10 at12pt%
   <14>eurm10 at14.4pt%
   <17>eurm10 at17.28pt%
   <20>eurm10 at20.74pt%
   <25>eurm10 at24.88pt}{}
% We will have to set a \verb+\skewchar+ but I don't know the right
% value. 
\extra@def{eur}{\skewchar#1'177}{}
%
% Don Knuth re-designed some of the math extension symbols to blend
% better with the euler fonts. So we have a font called `Euler
% compatible extension font'  available in 7 to 10pt. 
\new@fontshape{euex}{m}{n}{%
   <5>1euex7%
   <6>1euex7%
   <7>euex7%
   <8>euex8%
   <9>euex9%
   <10>euex10%
   <11>1euex10%
   <12>1euex10%
   <14>1euex10%
   <17>1euex10%
   <20>1euex10%
   <25>1euex10}{}
%
\extra@def{euex}{}{}

\new@mathversion\mv@euler
%    Now we define the basic {\em math groups\/} for the new version,
%    i.e.\ the groups 0 to 3.
\define@mathgroup\mv@euler{0}
		 {pnr}{m}{n}
\define@mathgroup\mv@euler{1}
		 {eur}{m}{n}
\define@mathgroup\mv@euler{2}
		 {cmsy}{m}{n}

%    We also add a special math group to the euler version which
%    contains the redesigned math symbols. Since we don't assume that
%    this version has to live in coexistance with the `normal' or `bold'
%    version we don't add this group to the other versions.
\new@mathgroup\euex@group
\define@mathgroup\mv@euler\euex@group
		 {euex}{m}{n}
%
% To set up the math version properly we have to reset some
% \verb+\mathcode+s. We have to take, for example, digits in math
% from the math group number one, i.e.\ from the euler cursive font.
% If we do this globally switching back to, let's say, \LaTeX{}s
% normal version will produces an undesired effect: we will then get
% oldstyle numerals in math.  
%
% We will leave this problem open at the moment until there is more
% experience with this new font selection scheme.  After all, it does
% not seem a very good idea to use such incompatible math versions
% together in one document.
%
% So here we are, re-arranging some of the internal tables:
\mathcode`\0="7130
\mathcode`\1="7131
\mathcode`\2="7132
\mathcode`\3="7133
\mathcode`\4="7134
\mathcode`\5="7135
\mathcode`\6="7136
\mathcode`\7="7137
\mathcode`\8="7138
\mathcode`\9="7139
%
% And here are some example for using the symbols from the special
% extension font. We use \verb+\hexnumber@+ to get the unknown assignment to
% \verb+\euex@group+ as a hexadecimal number into  the macro \verb+\@tempa+.
\edef\@tempa{\hexnumber@\euex@group}
\mathchardef\intop="1\@tempa 52
\mathchardef\ointop="1\@tempa 48
\mathchardef\sum="1\@tempa 50
\mathchardef\prod="1\@tempa 51
%
%    Since numbers for footnotes are text numbers and not math
%    formulas we prefere shapes comming from Concrete roman (like
%    12345) instead of $12345$. So we have to change the footnote mark
%    generation to avoid using math mode.
\def\@makefnmark{\raise 1ex\hbox{\scriptsize\@thefnmark}}
%
%
\mathversion{euler}


%% switch to Pandora Roman family:
\family{pnr}\selectfont%
\renewcommand{\rmdefault}{pnr}%

%% Make the msam and msbm fonts available to the "euler" math version:
\define@mathgroup\mv@euler\msa@group{msa}{m}{n}%
\define@mathgroup\mv@euler\msb@group{msb}{m}{n}%



