% $Header: /usr/jjc/dvitops/RCS/ps.sty,v 1.3 89/12/11 20:35:55 jjc Exp $
% adapt LaTeX to use PostScript fonts
% you'll need a lot of font memory to use this
% math accents haven't been done yet

% you can choose here which PostScript fonts will be used

\def\roman@#1{Times-Roman at #1}
\def\mathitalic@#1{Times-Italic at #1} % should produce a proper mi font
\def\italic@#1{Times-Italic at #1}
\def\bold@#1{Times-Bold at #1}
\def\symbol@#1{Symbol at #1}
\def\extension@#1{timesex at #1}
\def\greekl@#1{symbolsl at #1} % lower case greek letters
\def\smallcaps@#1{timessc at #1}
\def\slanted@#1{timessl at #1}
\def\typewriter@#1{Courier-Bold at #1}

%% preloaded fonts
\newdimen\psdimen

\def\dopreload#1#2{%
\expandafter\font\csname #1psrm\endcsname=\roman@{#2}%
\expandafter\font\csname #1psmi\endcsname=\mathitalic@{#2}%
\expandafter\font\csname #1pssy\endcsname=\symbol@{#2}%
\expandafter\font\csname #1psex\endcsname=\extension@{#2}%
\psdimen=#2 \multiply\psdimen by 9\divide\psdimen by 10 %use Symbol-Slanted 
\expandafter\font\csname #1psgrl\endcsname=\greekl@{\psdimen}%
\expandafter\font\csname #1sc\endcsname=\smallcaps@{#2}%
\expandafter\font\csname #1bf\endcsname=\bold@{#2}%
\expandafter\font\csname #1it\endcsname=\italic@{#2}%
\expandafter\font\csname #1sl\endcsname=\slanted@{#2}%
\expandafter\font\csname #1tt\endcsname=\typewriter@{#2}%
}

\dopreload{fiv}{5pt}
\dopreload{six}{6pt}
\dopreload{sev}{7pt}
\dopreload{egt}{8pt}
\dopreload{nin}{9pt}
\dopreload{ten}{10pt}
\dopreload{elv}{11pt}
\dopreload{twl}{12pt}
\dopreload{frtn}{14pt}
\dopreload{svtn}{17pt}
\dopreload{twty}{20pt}
\dopreload{twfv}{25pt}

\newfam\psrmfam
\newfam\psmifam
\newfam\pssyfam
\newfam\psexfam
\newfam\psgrlfam

\def\addinfo#1#2#3#4{\@addfontinfo#4{%
\textfont\psrmfam=\csname #1psrm\endcsname
\scriptfont\psrmfam=\csname #2psrm\endcsname
\scriptscriptfont\psrmfam=\csname #3psrm\endcsname
\textfont\psmifam=\csname #1psmi\endcsname
\scriptfont\psmifam=\csname #2psmi\endcsname
\scriptscriptfont\psmifam=\csname #3psmi\endcsname
\textfont\pssyfam=\csname #1pssy\endcsname
\scriptfont\pssyfam=\csname #2pssy\endcsname
\scriptscriptfont\pssyfam=\csname #3pssy\endcsname
\textfont\psexfam=\csname #1psex\endcsname
\scriptfont\psexfam=\csname #2psex\endcsname
\scriptscriptfont\psexfam=\csname #3psex\endcsname
\textfont\psgrlfam=\csname #1psgrl\endcsname
\scriptfont\psgrlfam=\csname #2psgrl\endcsname
\scriptscriptfont\psgrlfam=\csname #3psgrl\endcsname
\def\prm{\fam\psrmfam\csname#1psrm\endcsname}%
\def\pit{\fam\itfam\csname#1it\endcsname}%
\def\pbf{\fam\bffam\csname#1bf\endcsname}%
\def\psc{\fam\scfam\csname#1sc\endcsname}%
\def\psl{\fam\slfam\csname#1sl\endcsname}%
\def\ptt{\fam\ttfam\csname#1tt\endcsname}%
\@prtct\rm}}

\addinfo{fiv}{fiv}{fiv}\@vpt
\addinfo{six}{six}{six}\@vipt
\addinfo{sev}{six}{fiv}\@viipt
\addinfo{egt}{six}{fiv}\@viiipt
\addinfo{nin}{six}{fiv}\@ixpt
\addinfo{ten}{sev}{fiv}\@xpt
\addinfo{elv}{egt}{six}\@xipt
\addinfo{twl}{egt}{six}\@xiipt
\addinfo{frtn}{ten}{sev}\@xivpt
\addinfo{svtn}{twl}{ten}\@xviipt
\addinfo{twty}{frtn}{twl}\@xxpt
\addinfo{twfv}{twty}{svtn}\@xxvpt


%% math mode stuff

\def\hexnumber@#1{\ifcase#1 0\or1\or2\or3\or4\or5\or6\or7\or8\or9\or
 A\or B\or C\or D\or E\or F\fi}
\edef\bffam@{\hexnumber@\bffam}

\edef\psrmfam@{\hexnumber@\psrmfam}
\edef\psmifam@{\hexnumber@\psmifam}
\edef\pssyfam@{\hexnumber@\pssyfam}
\edef\psexfam@{\hexnumber@\psexfam}
\edef\psgrlfam@{\hexnumber@\psgrlfam}

% numerals come from psrmfam

\mathcode"30="7\psrmfam@ 30
\mathcode"31="7\psrmfam@ 31
\mathcode"32="7\psrmfam@ 32
\mathcode"33="7\psrmfam@ 33
\mathcode"34="7\psrmfam@ 34
\mathcode"35="7\psrmfam@ 35
\mathcode"36="7\psrmfam@ 36
\mathcode"37="7\psrmfam@ 37
\mathcode"38="7\psrmfam@ 38
\mathcode"39="7\psrmfam@ 39
\mathcode"3A="7\psrmfam@ 3A

% upper case letters from psmifam

\mathcode"41="7\psmifam@ 41
\mathcode"42="7\psmifam@ 42
\mathcode"43="7\psmifam@ 43
\mathcode"44="7\psmifam@ 44
\mathcode"45="7\psmifam@ 45
\mathcode"46="7\psmifam@ 46
\mathcode"47="7\psmifam@ 47
\mathcode"48="7\psmifam@ 48
\mathcode"49="7\psmifam@ 49
\mathcode"4A="7\psmifam@ 4A
\mathcode"4B="7\psmifam@ 4B
\mathcode"4C="7\psmifam@ 4C
\mathcode"4D="7\psmifam@ 4D
\mathcode"4E="7\psmifam@ 4E
\mathcode"4F="7\psmifam@ 4F
\mathcode"51="7\psmifam@ 51
\mathcode"52="7\psmifam@ 52
\mathcode"53="7\psmifam@ 53
\mathcode"54="7\psmifam@ 54
\mathcode"55="7\psmifam@ 55
\mathcode"56="7\psmifam@ 56
\mathcode"57="7\psmifam@ 57
\mathcode"58="7\psmifam@ 58
\mathcode"59="7\psmifam@ 59
\mathcode"5A="7\psmifam@ 5A


% lower case letters from psmifam

\mathcode"61="7\psmifam@ 61
\mathcode"62="7\psmifam@ 62
\mathcode"63="7\psmifam@ 63
\mathcode"64="7\psmifam@ 64
\mathcode"65="7\psmifam@ 65
\mathcode"66="7\psmifam@ 66
\mathcode"67="7\psmifam@ 67
\mathcode"68="7\psmifam@ 68
\mathcode"69="7\psmifam@ 69
\mathcode"6A="7\psmifam@ 6A
\mathcode"6B="7\psmifam@ 6B
\mathcode"6C="7\psmifam@ 6C
\mathcode"6D="7\psmifam@ 6D
\mathcode"6E="7\psmifam@ 6E
\mathcode"6F="7\psmifam@ 6F
\mathcode"71="7\psmifam@ 71
\mathcode"72="7\psmifam@ 72
\mathcode"73="7\psmifam@ 73
\mathcode"74="7\psmifam@ 74
\mathcode"75="7\psmifam@ 75
\mathcode"76="7\psmifam@ 76
\mathcode"77="7\psmifam@ 77
\mathcode"78="7\psmifam@ 78
\mathcode"79="7\psmifam@ 79
\mathcode"7A="7\psmifam@ 7A

% upper case Greek letters from pssyfam

\mathchardef\Gamma="7\pssyfam@ 47
\mathchardef\Delta="7\pssyfam@ 44
\mathchardef\Theta="7\pssyfam@ 51
\mathchardef\Lambda="7\pssyfam@ 4C
\mathchardef\Xi="7\pssyfam@ 58
\mathchardef\Pi="7\pssyfam@ 50
\mathchardef\Sigma="7\pssyfam@ 53
\mathchardef\Upsilon="7\pssyfam@ A1
\mathchardef\Phi="7\pssyfam@ 46
\mathchardef\Psi="7\pssyfam@ 59
\mathchardef\Omega="7\pssyfam@ 57

% lower case Greek letters from psgrlfam

\mathchardef\alpha="0\psgrlfam@ 61
\mathchardef\beta="0\psgrlfam@ 62
\mathchardef\gamma="0\psgrlfam@ 67
\mathchardef\delta="0\psgrlfam@ 64
\mathchardef\epsilon="0\psgrlfam@ 65
\mathchardef\zeta="0\psgrlfam@ 7A
\mathchardef\eta="0\psgrlfam@ 68
\mathchardef\theta="0\psgrlfam@ 71
\mathchardef\iota="0\psgrlfam@ 69
\mathchardef\kappa="0\psgrlfam@ 6B
\mathchardef\lambda="0\psgrlfam@ 6C
\mathchardef\mu="0\psgrlfam@ 6D
\mathchardef\nu="0\psgrlfam@ 6E
\mathchardef\xi="0\psgrlfam@ 78
\mathchardef\pi="0\psgrlfam@ 70
\mathchardef\rho="0\psgrlfam@ 72
\mathchardef\sigma="0\psgrlfam@ 73
\mathchardef\tau="0\psgrlfam@ 74
\mathchardef\upsilon="0\psgrlfam@ 75
\mathchardef\phi="0\psgrlfam@ 66
\mathchardef\chi="0\psgrlfam@ 63
\mathchardef\psi="0\psgrlfam@ 79
\mathchardef\omega="0\psgrlfam@ 77
\mathchardef\varepsilon="0\psgrlfam@ 65
\mathchardef\vartheta="0\psgrlfam@ 4A
\mathchardef\varpi="0\psgrlfam@ 76
\mathchardef\varrho="0\psgrlfam@ 72
\mathchardef\varsigma="0\psgrlfam@ 56
\mathchardef\varphi="0\psgrlfam@ 6A


% psexfam

\mathchardef\sum="1\psexfam@ 50
\mathchardef\prod="1\psexfam@ 51
\mathchardef\coprod="1\psexfam@ 60


%% text mode stuff

\chardef\%=`\%
\chardef\&=`\&
\chardef\#=`\#
\chardef\$=`\$
\chardef\ss="FB
\chardef\ae="F1
\chardef\oe="FA
\chardef\o="F9
\chardef\AE="E1
\chardef\OE="EA
\chardef\O="E9
\chardef\i="F5 
\let\j=\undefined
\def\aa{\accent'312a}

\chardef\l="F8
\chardef\L="E8
%\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em}}
\chardef\_=`\_
\def\AA{\accent'312A}
\chardef\dag="B2
\chardef\ddag="B3
\chardef\S="A7
\chardef\P="B6

\ifx\protect\undefined\let\protect=\relax\fi
\def\pd#1{\oalign{#1\crcr\hidewidth.\hidewidth}}
\def\d{\protect\pd}
\def\pb#1{\oalign{#1\crcr\hidewidth
    \vbox to.2ex{\hbox{\char'305}\vss}\hidewidth}}
\def\b{\protect\pb}

\def\pc#1{\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent'313 #1%
  \else{\ooalign{\hidewidth\char'313\hidewidth\crcr\unhbox\z@}}\fi}
\def\c{\protect\pc}

\def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX}

\def\`#1{{\accent'301 #1}}
\def\'#1{{\accent'302 #1}}
\def\v#1{{\accent'317 #1}} \let\^^_=\v
\def\u#1{{\accent'306 #1}} \let\^^S=\u
\def\=#1{{\accent'305 #1}}
\def\^#1{{\accent'303 #1}} \let\^^D=\^
\def\.#1{{\accent'307 #1}}
\def\H#1{{\accent'315 #1}}
\def\~#1{{\accent'304 #1}}
\def\"#1{{\accent'310 #1}}


.
