Ship all the intermediate files too.
[mdwfonts] / mdwfonts.dtx
CommitLineData
c369c819 1% \begin{meta-comment}
2%
3% $Id: mdwfonts.dtx,v 1.1 2002/02/19 22:54:13 mdw Exp $
4%
5% PostScript fonts for more excitement
6%
7% (c) 1996 Mark Wooding
8%
9%----- Revision history -----------------------------------------------------
10%
11% $Log: mdwfonts.dtx,v $
12% Revision 1.1 2002/02/19 22:54:13 mdw
13% Initial revision.
14%
15% Revision 1.1 1996/11/19 22:02:15 mdw
16% Initial revision
17%
18%
19% \end{meta-comment}
20%
21% \begin{meta-comment} <general public licence>
22%<*sty|mttpcr|fontinst>
23%%
24%% mdwtools common declarations
25%% Copyright (c) 1996 Mark Wooding
26%%
27%% This program is free software; you can redistribute it and/or modify
28%% it under the terms of the GNU General Public License as published by
29%% the Free Software Foundation; either version 2 of the License, or
30%% (at your option) any later version.
31%%
32%% This program is distributed in the hope that it will be useful,
33%% but WITHOUT ANY WARRANTY; without even the implied warranty of
34%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35%% GNU General Public License for more details.
36%%
37%% You should have received a copy of the GNU General Public License
38%% along with this program; if not, write to the Free Software
39%% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
40%%
41% \end{meta-comment}
42%
43% \begin{meta-comment} <file preamble>
44%<+sty>\NeedsTeXFormat{LaTeX2e}
45%<+sty>\ProvidesPackage{mdwfonts}
46%<+mttpcr>\ProvidesFile{mTTpcr.fd}
47%<*fontinst>
48\ifx\ProvidesFile\mdwundefined
49 \def\ProvidesFile#1[#2]{\wlog{File: #1 #2}}
50\fi
51\ProvidesFile{mdwfonts.tex}
52%</fontinst>
53 [1997/01/11 1.2 PostScript fonts for my documents]
54% \end{meta-comment}
55%
56% \CheckSum{593}
57%% \CharacterTable
58%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
59%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
60%% Digits \0\1\2\3\4\5\6\7\8\9
61%% Exclamation \! Double quote \" Hash (number) \#
62%% Dollar \$ Percent \% Ampersand \&
63%% Acute accent \' Left paren \( Right paren \)
64%% Asterisk \* Plus \+ Comma \,
65%% Minus \- Point \. Solidus \/
66%% Colon \: Semicolon \; Less than \<
67%% Equals \= Greater than \> Question mark \?
68%% Commercial at \@ Left bracket \[ Backslash \\
69%% Right bracket \] Circumflex \^ Underscore \_
70%% Grave accent \` Left brace \{ Vertical bar \|
71%% Right brace \} Tilde \~}
72%%
73%
74% \begin{meta-comment}
75%</sty|mttpcr|fontinst>
76%
77%<*driver>
78\input{mdwtools}
79\usepackage{mflogo}
80\describespackage{mdwfonts}
81\mdwdoc
82%</driver>
83%
84% \end{meta-comment}
85%
86%
87%^^A-------------------------------------------------------------------------
88% \section{Overview}
89%
90% This suite of \LaTeX\ bits is intended to provide some configurability
91% for the fonts used by documents. It lets users define their favourite
92% collection of fonts, and any documents using this package will
93% automatically honour those design decisions.
94%
95% It goes a little beyond this brief, however, by supplying some missing
96% PostScript fonts which may be useful. (Well, the author uses them a lot.)
97% In particular:
98% \begin{itemize}
99% \item The `squashed' Courier from David Carlisle's \package{pslatex}
100% package is included, and extended to cover the other known variants of
101% Courier (e.g., bold and oblique).
102% \item A maths symbol font for Palatino has been added. It works in a
103% similar way to the \package{mathptm} package's support for Times (i.e.,
104% it grabs glyphs from the normal Palatino font, and from the Computer
105% Modern symbols).
106% \end{itemize}
107%
108%
109% \section{Installing \package{mdwfonts}}
110%
111% The package comes with a large number of miscellaneous font files. They
112% ought to be placed in appropriate directories where \TeX and/or other
113% programs can find them. Exactly where this will be depends heavily on your
114% installation: try looking for the other fonts and put these with them.
115% The various extensions for the font files are:
116% \begin{description}
117% \item [.tfm] is a \TeX\ Font Metric file, needed by \TeX.
118% \item [.vf] is a virtual font description file, needed by DVI-drivers.
119% \item [.fd] is a font description file, required by \LaTeX.
120% \end{description}
121%
122% You'll also need to put |mdwfonts.sty| somewhere where \LaTeX\ will find
123% it. What you do with the documentation file is up to you.
124%
125% The files |mTTpcr.fd| and |mdwfonts.sty| may not have been included in
126% your distribution. If you don't have them, run \LaTeX\ on |mdwfonts.ins|
127% to build them. I'm explicitly not giving instructions for building all
128% the other font files, because I'd much prefer it if they were distributed
129% as they are, please -- building them is a fiddly business, and I'd rather
130% that only I had to do it.
131%
132% Once you've done all that, you must tell \textit{dvips} about your new
133% fonts, so add the following lines to the |psfonts.map| file, unless they're
134% already there:
135% \begin{listing}
136%pcrb8rn Courier-Bold ".85 ExtendFont TeXBase1Encoding ReEncodeFont" <8r.enc
137%pcrbo8rn Courier-BoldOblique ".85 ExtendFont TeXBase1Encoding ReEncodeFont" <8r.enc
138%pcrr8rn Courier ".85 ExtendFont TeXBase1Encoding ReEncodeFont" <8r.enc
139%pcrro8rn Courier-Oblique ".85 ExtendFont TeXBase1Encoding ReEncodeFont" <8r.enc
140% \end{listing}
141% The |pcrr8rn| line will already be in the file if you've installed the
142% \package{pslatex} package, so don't bother putting it in again.
143%
144%
145% \section{Using \package{mdwfonts}}
146%
147% \subsection{Defining fonts to use}
148%
149% The font faces you can use, with their names as used by this package,
150% currently are:
151% \begin{itemize}
152% \item Computer Modern Roman (|cmr|)
153% \item Computer Modern Sans (|cmss|)
154% \item Times Roman (|times|)
155% \item Helvetica (|helvetica|)
156% \item Palatino (|palatino|)
157% \item Computer Modern Typewriter (|cmtt|)
158% \item Courier (condensed version) (|courier|)
159% \end{itemize}
160% Only Computer Modern Roman, Times Roman and Palatino may be used as a maths
161% family.
162%
163% The \package{mdwfonts} package knows about five font families which
164% documents probably want to use. The available families you can set, with
165% their names as used by this package, are:
166% \begin{description}
167% \item [The body text family] (|body|) is the main font your document uses.
168% The default body family is Computer Modern Roman.
169% \item [The maths family] (|maths|) is the font used for mathematics.
170% The default maths family is the same as the body family.
171% \item [The sans serif family] (|sans|) is used for sans serif text.
172% The default sans serif family is Computer Modern Sans.
173% \item [The headings family] (|head|) is used for headings, if your
174% document class supports this.\footnote{
175% The \texttt{\char`\\headfam} command is configured to change to the
176% chosen headings family. Co-operating document classes should use this
177% hook when typesetting chapter and section headings, etc.}
178% Most document classes don't support this, but \package{mdwfonts} patches
179% the standard \LaTeX\ classes so that they work. The default headings
180% family is Computer Modern Roman.
181% \item [The typewriter family] (|tt|) is used for monospaced text. The
182% default typewriter family is Computer Modern Typewriter.
183% \end{description}
184% American users not used to spelling \lit{maths} correctly may use the
185% alternative spelling \lit{math} instead. If only the rest of \LaTeX\ were
186% this considerate.
187%
188%
189% \subsection{Assigning faces to families}
190%
191% \DescribeMacro\mdwfont
192% This is fairly simple, really. The |\mdwfont| will attach a typeface to a
193% given family. The syntax is as follows:
194% \begin{syntdiag}
195% "\\mdwfont" "{" \< <family-name> "=" <face-name> \\ "," \> "}"
196% \end{syntdiag}
197% For example, saying
198% \begin{listing}
199%\mdwfont{body=palatino, maths=palatino,
200% sans=helvetica, head=helvetica
201% tt=courier}
202% \end{listing}
203% uses Palatino for the main body text, and for maths, Helvetica for sans
204% serif text, and for headings (again, only if your document class supports
205% this).
206%
207% The \package{mdwfonts} package also supports a collection of options which
208% may be passed to the package. The syntax of the package invocation is:
209% \begin{syntdiag}
210% "\\usepackage"
211% \[ "["
212% \< \( <face-name> \\ <family-name> "=" <face-name> \) \\ "," \>
213% "]" \]
214% \\
215% "{" "mdwfonts" "}"
216% \end{syntdiag}
217%
218% A face name on its own configures families sensibly to use that face.
219% The actual behaviour is as follows:
220% \begin{description}
221% \item [times] Set body and maths families to Times Roman.
222% \item [palatino] Set body and maths families to Palatino.
223% \item [cmr] Set body, headings and maths families to Computer Modern Roman.
224% \item [helvetica] Set sans serif and headings families to Helvetica.
225% \item [cmss] Set sans serif family to Computer Modern Sans.
226% \item [courier] Set typewriter family to Courier.
227% \item [cmtt] Set typewriter family to Computer Modern Typewriter.
228% \end{description}
229% Astute readers will be able to deduce the author's personal preferences
230% for assigning typefaces to families from the above rules. However, they
231% should suffice for most simple configurations. Moreover, the direct
232% assignment of faces to families is supported in case the above aren't
233% expressive enough.
234%
235% When \package{mdwfonts} starts up, it reads a file called |mdwfonts.cfg|,
236% if it exists. This file should set up defaults for the various families
237% according to the user's preferences. The decisions made by the
238% configuration file may be overridden by the document, however, since
239% package options are processed after running |mdwfonts.cfg|.
240%
241%
242% \implementation
243%
244% \section{The package}
245%
246% \begin{macrocode}
247%<*sty>
248% \end{macrocode}
249%
250%
251% \subsection{Options handing}
252%
253% There are several font choices to be made. These can be made from the
254% package options or the configuration file; the former takes precedence over
255% the latter.
256%
257% I'll use David Carlisle's rather good \package{keyval} package to handle
258% this lot because it saves a lot of hassle in the long run.
259%
260% \begin{macrocode}
261\RequirePackage{keyval}
262% \end{macrocode}
263%
264% Now to define how all this actually works. Maintain a variable for each
265% family that I understand, and a list of which fonts people have expressed
266% an interest in.
267%
268% \begin{macrocode}
269\def\mdwf@bodyfont{\mdwf@cmr}
270\def\mdwf@mathsfont{\mdwf@bodyfont}
271\def\mdwf@sansfont{\mdwf@cmss}
272\def\mdwf@headfont{\mdwf@cmr}
273\def\mdwf@ttfont{\mdwf@cmtt}
274% \end{macrocode}
275%
276% Now to define the keys and values which I'll accept.
277%
278% \begin{macrocode}
279\def\mdwf@set#1#2{\edef#1{\expandafter\noexpand\csname mdwf@#2\endcsname}}
280\define@key{mdwf}{body}{\mdwf@set\mdwf@bodyfont{#1}}
281\define@key{mdwf}{maths}{\mdwf@set\mdwf@mathsfont{#1}}
282\define@key{mdwf}{math}{\mdwf@set\mdwf@mathsfont{#1}}
283\define@key{mdwf}{sans}{\mdwf@set\mdwf@sansfont{#1}}
284\define@key{mdwf}{head}{\mdwf@set\mdwf@headfont{#1}}
285\define@key{mdwf}{tt}{\mdwf@set\mdwf@ttfont{#1}}
286% \end{macrocode}
287%
288% Now input the configuration file.
289%
290% \begin{macrocode}
291\def\mdwfont{\setkeys{mdwf}}
292\@input{mdwfonts.cfg}
293% \end{macrocode}
294%
295% Set up some package options which handle the common cases. Then add
296% a catch-all option which just gets bundled to \package{keyval}.
297%
298% \begin{macrocode}
299\DeclareOption{times}{\mdwfont{body=times, maths=times}}
300\DeclareOption{palatino}{\mdwfont{body=palatino, maths=palatino}}
301\DeclareOption{cmr}{\mdwfont{body=cmr, maths=cmr, head=cmr}}
302\DeclareOption{helvetica}{\mdwfont{sans=helvetica, head=helvetica}}
303\DeclareOption{cmss}{\mdwfont{sans=cmss}}
304\DeclareOption{courier}{\mdwfont{tt=courier}}
305\DeclareOption{cmtt}{\mdwfont{tt=cmtt}}
306\DeclareOption*{\expandafter\mdwfont\expandafter{\CurrentOption}}
307\ProcessOptions*
308% \end{macrocode}
309%
310% Now, if a client wants a really odd setup not provided by the above
311% interface, it can define |\mdwfonts| to declare its decision.
312%
313% \begin{macrocode}
314\ifx\mdwfonts\@@undefined\else
315 \def\@tempa#1\@@{\mdwfont{#1}}
316 \expandafter\@tempa\mdwfonts\@@
317\fi
318% \end{macrocode}
319%
320%
321% \subsection{Setting up the actual fonts}
322%
323% \begin{macro}{\mdwf@iffont}
324%
325% I need to check whether a font's been used. This macro will help.
326%
327% First, I'll define some numeric values for various fonts.
328%
329% \begin{macrocode}
330\count@\z@
331\def\@tempa#1{%
332 \expandafter\chardef\csname mdwf@#1\endcsname\count@%
333 \advance\count@\@ne%
334}
335\@tempa{cmr}\@tempa{cmss}\@tempa{cmtt}
336\@tempa{times}\@tempa{palatino}\@tempa{helvetica}\@tempa{courier}
337% \end{macrocode}
338%
339% And now to check whether a font is being used. This is rather horrible.
340%
341% \begin{macrocode}
342\def\mdwf@iffont#1{\if1%
343 \ifnum\mdwf@bodyfont=#11\else%
344 \ifnum\mdwf@headfont=#11\else%
345 \ifnum\mdwf@sansfont=#11\else%
346 \ifnum\mdwf@ttfont=#11\else0%
347 \fi\fi\fi\fi%
348}
349% \end{macrocode}
350%
351% \end{macro}
352%
353% \subsubsection{Text fonts}
354%
355% \paragraph{Courier}
356% The courier family is redefined in its entirety here. I use the condensed
357% courier provided by David Carlisle's \package{pslatex} package, although
358% I've extended it to cover all the shapes and not just medium roman.
359% \begin{macrocode}
360\mdwf@iffont\mdwf@courier
361\DeclareFontFamily{OT1}{pcr}{\hyphenchar\font=-1}
362\DeclareFontShape{OT1}{pcr}{b}{n}{<-> pcrb7tn}{}
363\DeclareFontShape{OT1}{pcr}{b}{sc}{<-> pcrbc7tn}{}
364\DeclareFontShape{OT1}{pcr}{b}{sl}{<-> pcrbo7tn}{}
365\DeclareFontShape{OT1}{pcr}{m}{n}{<-> pcrr7tn}{}
366\DeclareFontShape{OT1}{pcr}{m}{sc}{<-> pcrrc7tn}{}
367\DeclareFontShape{OT1}{pcr}{m}{sl}{<-> pcrro7tn}{}
368\DeclareFontShape{OT1}{pcr}{bx}{n}{<->ssub * pcr/b/n}{}
369\DeclareFontShape{OT1}{pcr}{bx}{sc}{<->ssub * pcr/b/sc}{}
370\DeclareFontShape{OT1}{pcr}{bx}{sl}{<->ssub * pcr/b/sl}{}
371\DeclareFontShape{OT1}{pcr}{b}{it}{<->ssub * pcr/b/sl}{}
372\DeclareFontShape{OT1}{pcr}{bx}{it}{<->ssub * pcr/b/it}{}
373\DeclareFontShape{OT1}{pcr}{m}{it}{<->ssub * pcr/m/sl}{}
374\DeclareFontFamily{T1}{pcr}{\hyphenchar\font=-1}
375\DeclareFontShape{T1}{pcr}{b}{n}{<-> pcrb8tn}{}
376\DeclareFontShape{T1}{pcr}{b}{sc}{<-> pcrbc8tn}{}
377\DeclareFontShape{T1}{pcr}{b}{sl}{<-> pcrbo8tn}{}
378\DeclareFontShape{T1}{pcr}{m}{n}{<-> pcrr8tn}{}
379\DeclareFontShape{T1}{pcr}{m}{sc}{<-> pcrrc8tn}{}
380\DeclareFontShape{T1}{pcr}{m}{sl}{<-> pcrro8tn}{}
381\DeclareFontShape{T1}{pcr}{bx}{n}{<->ssub * pcr/b/n}{}
382\DeclareFontShape{T1}{pcr}{bx}{sc}{<->ssub * pcr/b/sc}{}
383\DeclareFontShape{T1}{pcr}{bx}{sl}{<->ssub * pcr/b/sl}{}
384\DeclareFontShape{T1}{pcr}{b}{it}{<->ssub * pcr/b/sl}{}
385\DeclareFontShape{T1}{pcr}{bx}{it}{<->ssub * pcr/b/it}{}
386\DeclareFontShape{T1}{pcr}{m}{it}{<->ssub * pcr/m/sl}{}
387\fi
388% \end{macrocode}
389%
390% \paragraph{Helvetica}
391% Again the whole of helvetica is defined here, this time so that the font
392% can be scaled a little.
393% \begin{macrocode}
394\mdwf@iffont\mdwf@helvetica
395\DeclareFontFamily{OT1}{phv}{}
396\DeclareFontShape{OT1}{phv}{b}{n}{<-> s * [.9] phvb7t}{}
397\DeclareFontShape{OT1}{phv}{b}{sc}{<-> s * [.9] phvbc7t}{}
398\DeclareFontShape{OT1}{phv}{b}{sl}{<-> s * [.9] phvbo7t}{}
399\DeclareFontShape{OT1}{phv}{bc}{n}{<-> s * [.9] phvbrn7t}{}
400\DeclareFontShape{OT1}{phv}{bc}{sc}{<-> s * [.9] phvbcn7t}{}
401\DeclareFontShape{OT1}{phv}{bc}{sl}{<-> s * [.9] phvbon7t}{}
402\DeclareFontShape{OT1}{phv}{m}{n}{<-> s * [.9] phvr7t}{}
403\DeclareFontShape{OT1}{phv}{m}{sc}{<-> s * [.9] phvrc7t}{}
404\DeclareFontShape{OT1}{phv}{m}{sl}{<-> s * [.9] phvro7t}{}
405\DeclareFontShape{OT1}{phv}{mc}{n}{<-> s * [.9] phvrrn7t}{}
406\DeclareFontShape{OT1}{phv}{mc}{sc}{<-> s * [.9] phvrcn7t}{}
407\DeclareFontShape{OT1}{phv}{mc}{sl}{<-> s * [.9] phvron7t}{}
408\DeclareFontShape{OT1}{phv}{bx}{n}{<->ssub * phv/b/n}{}
409\DeclareFontShape{OT1}{phv}{bx}{sc}{<->ssub * phv/b/sc}{}
410\DeclareFontShape{OT1}{phv}{bx}{sl}{<->ssub * phv/b/sl}{}
411\DeclareFontShape{OT1}{phv}{b}{it}{<->ssub * phv/b/sl}{}
412\DeclareFontShape{OT1}{phv}{bx}{it}{<->ssub * phv/b/it}{}
413\DeclareFontShape{OT1}{phv}{bc}{it}{<->ssub * phv/bc/sl}{}
414\DeclareFontShape{OT1}{phv}{m}{it}{<->ssub * phv/m/sl}{}
415\DeclareFontShape{OT1}{phv}{mc}{it}{<->ssub * phv/mc/sl}{}
416\DeclareFontFamily{T1}{phv}{}
417\DeclareFontShape{T1}{phv}{b}{n}{<-> s * [.9] phvb8t}{}
418\DeclareFontShape{T1}{phv}{b}{sc}{<-> s * [.9] phvbc8t}{}
419\DeclareFontShape{T1}{phv}{b}{sl}{<-> s * [.9] phvbo8t}{}
420\DeclareFontShape{T1}{phv}{bc}{n}{<-> s * [.9] phvbrn8t}{}
421\DeclareFontShape{T1}{phv}{bc}{sc}{<-> s * [.9] phvbcn8t}{}
422\DeclareFontShape{T1}{phv}{bc}{sl}{<-> s * [.9] phvbon8t}{}
423\DeclareFontShape{T1}{phv}{m}{n}{<-> s * [.9] phvr8t}{}
424\DeclareFontShape{T1}{phv}{m}{sc}{<-> s * [.9] phvrc8t}{}
425\DeclareFontShape{T1}{phv}{m}{sl}{<-> s * [.9] phvro8t}{}
426\DeclareFontShape{T1}{phv}{mc}{n}{<-> s * [.9] phvrrn8t}{}
427\DeclareFontShape{T1}{phv}{mc}{sc}{<-> s * [.9] phvrcn8t}{}
428\DeclareFontShape{T1}{phv}{mc}{sl}{<-> s * [.9] phvron8t}{}
429\DeclareFontShape{T1}{phv}{bx}{n}{<->ssub * phv/b/n}{}
430\DeclareFontShape{T1}{phv}{bx}{sc}{<->ssub * phv/b/sc}{}
431\DeclareFontShape{T1}{phv}{bx}{sl}{<->ssub * phv/b/sl}{}
432\DeclareFontShape{T1}{phv}{b}{it}{<->ssub * phv/b/sl}{}
433\DeclareFontShape{T1}{phv}{bx}{it}{<->ssub * phv/b/it}{}
434\DeclareFontShape{T1}{phv}{bc}{it}{<->ssub * phv/bc/sl}{}
435\DeclareFontShape{T1}{phv}{m}{it}{<->ssub * phv/m/sl}{}
436\DeclareFontShape{T1}{phv}{mc}{it}{<->ssub * phv/mc/sl}{}
437\fi
438% \end{macrocode}
439%
440% \paragraph{Palatino}
441% Might as well define palatino too, for completeness' sake.
442% \begin{macrocode}
443\mdwf@iffont\mdwf@palatino
444\DeclareFontFamily{OT1}{ppl}{}
445\DeclareFontShape{OT1}{ppl}{b}{n}{<-> pplb7t}{}
446\DeclareFontShape{OT1}{ppl}{b}{sc}{<-> pplbc7t}{}
447\DeclareFontShape{OT1}{ppl}{b}{sl}{<-> pplbo7t}{}
448\DeclareFontShape{OT1}{ppl}{b}{it}{<-> pplbi7t}{}
449\DeclareFontShape{OT1}{ppl}{m}{n}{<-> pplr7t}{}
450\DeclareFontShape{OT1}{ppl}{m}{sc}{<-> pplrc7t}{}
451\DeclareFontShape{OT1}{ppl}{m}{sl}{<-> pplro7t}{}
452\DeclareFontShape{OT1}{ppl}{m}{it}{<-> pplri7t}{}
453\DeclareFontShape{OT1}{ppl}{bx}{n}{<->ssub * ppl/b/n}{}
454\DeclareFontShape{OT1}{ppl}{bx}{sc}{<->ssub * ppl/b/sc}{}
455\DeclareFontShape{OT1}{ppl}{bx}{sl}{<->ssub * ppl/b/sl}{}
456\DeclareFontShape{OT1}{ppl}{bx}{it}{<->ssub * ppl/b/it}{}
457\DeclareFontShape{OT1}{ppl}{l}{n}{<->ssub * ppl/m/n}{}
458\DeclareFontShape{OT1}{ppl}{l}{sc}{<->ssub * ppl/m/sc}{}
459\DeclareFontShape{OT1}{ppl}{l}{sl}{<->ssub * ppl/m/sl}{}
460\DeclareFontShape{OT1}{ppl}{l}{it}{<->ssub * ppl/m/it}{}
461\DeclareFontFamily{T1}{ppl}{}
462\DeclareFontShape{T1}{ppl}{b}{n}{<-> pplb8t}{}
463\DeclareFontShape{T1}{ppl}{b}{sc}{<-> pplbc8t}{}
464\DeclareFontShape{T1}{ppl}{b}{sl}{<-> pplbo8t}{}
465\DeclareFontShape{T1}{ppl}{b}{it}{<-> pplbi8t}{}
466\DeclareFontShape{T1}{ppl}{m}{n}{<-> pplr8t}{}
467\DeclareFontShape{T1}{ppl}{m}{sc}{<-> pplrc8t}{}
468\DeclareFontShape{T1}{ppl}{m}{sl}{<-> pplro8t}{}
469\DeclareFontShape{T1}{ppl}{m}{it}{<-> pplri8t}{}
470\DeclareFontShape{T1}{ppl}{bx}{n}{<->ssub * ppl/b/n}{}
471\DeclareFontShape{T1}{ppl}{bx}{sc}{<->ssub * ppl/b/sc}{}
472\DeclareFontShape{T1}{ppl}{bx}{sl}{<->ssub * ppl/b/sl}{}
473\DeclareFontShape{T1}{ppl}{bx}{it}{<->ssub * ppl/b/it}{}
474\DeclareFontShape{T1}{ppl}{l}{n}{<->ssub * ppl/m/n}{}
475\DeclareFontShape{T1}{ppl}{l}{sc}{<->ssub * ppl/m/sc}{}
476\DeclareFontShape{T1}{ppl}{l}{sl}{<->ssub * ppl/m/sl}{}
477\DeclareFontShape{T1}{ppl}{l}{it}{<->ssub * ppl/m/it}{}
478\fi
479% \end{macrocode}
480%
481% \paragraph{Times}
482% Finally, times, for those who like it\dots
483% \begin{macrocode}
484\mdwf@iffont\mdwf@times
485\DeclareFontFamily{OT1}{ptm}{}
486\DeclareFontShape{OT1}{ptm}{b}{n}{<-> ptmb7t}{}
487\DeclareFontShape{OT1}{ptm}{b}{sc}{<-> ptmbc7t}{}
488\DeclareFontShape{OT1}{ptm}{b}{sl}{<-> ptmbo7t}{}
489\DeclareFontShape{OT1}{ptm}{b}{it}{<-> ptmbi7t}{}
490\DeclareFontShape{OT1}{ptm}{m}{n}{<-> ptmr7t}{}
491\DeclareFontShape{OT1}{ptm}{m}{sc}{<-> ptmrc7t}{}
492\DeclareFontShape{OT1}{ptm}{m}{sl}{<-> ptmro7t}{}
493\DeclareFontShape{OT1}{ptm}{m}{it}{<-> ptmri7t}{}
494\DeclareFontShape{OT1}{ptm}{bx}{n}{<->ssub * ptm/b/n}{}
495\DeclareFontShape{OT1}{ptm}{bx}{sc}{<->ssub * ptm/b/sc}{}
496\DeclareFontShape{OT1}{ptm}{bx}{sl}{<->ssub * ptm/b/sl}{}
497\DeclareFontShape{OT1}{ptm}{bx}{it}{<->ssub * ptm/b/it}{}
498\DeclareFontShape{OT1}{ptm}{l}{n}{<->ssub * ptm/m/n}{}
499\DeclareFontShape{OT1}{ptm}{l}{sc}{<->ssub * ptm/m/sc}{}
500\DeclareFontShape{OT1}{ptm}{l}{sl}{<->ssub * ptm/m/sl}{}
501\DeclareFontShape{OT1}{ptm}{l}{it}{<->ssub * ptm/m/it}{}
502\DeclareFontFamily{T1}{ptm}{}
503\DeclareFontShape{T1}{ptm}{b}{n}{<-> ptmb8t}{}
504\DeclareFontShape{T1}{ptm}{b}{sc}{<-> ptmbc8t}{}
505\DeclareFontShape{T1}{ptm}{b}{sl}{<-> ptmbo8t}{}
506\DeclareFontShape{T1}{ptm}{b}{it}{<-> ptmbi8t}{}
507\DeclareFontShape{T1}{ptm}{m}{n}{<-> ptmr8t}{}
508\DeclareFontShape{T1}{ptm}{m}{sc}{<-> ptmrc8t}{}
509\DeclareFontShape{T1}{ptm}{m}{sl}{<-> ptmro8t}{}
510\DeclareFontShape{T1}{ptm}{m}{it}{<-> ptmri8t}{}
511\DeclareFontShape{T1}{ptm}{bx}{n}{<->ssub * ptm/b/n}{}
512\DeclareFontShape{T1}{ptm}{bx}{sc}{<->ssub * ptm/b/sc}{}
513\DeclareFontShape{T1}{ptm}{bx}{sl}{<->ssub * ptm/b/sl}{}
514\DeclareFontShape{T1}{ptm}{bx}{it}{<->ssub * ptm/b/it}{}
515\DeclareFontShape{T1}{ptm}{l}{n}{<->ssub * ptm/m/n}{}
516\DeclareFontShape{T1}{ptm}{l}{sc}{<->ssub * ptm/m/sc}{}
517\DeclareFontShape{T1}{ptm}{l}{sl}{<->ssub * ptm/m/sl}{}
518\DeclareFontShape{T1}{ptm}{l}{it}{<->ssub * ppl/m/it}{}
519\fi
520% \end{macrocode}
521%
522% \subsubsection{Maths fonts}
523%
524% \paragraph{Palatino}
525% Easy stuff.
526% \begin{macrocode}
527\ifnum\mdwf@mathsfont=\mdwf@palatino
528\DeclareSymbolFont{operators} {OT1}{pplcm}{m}{n}
529\DeclareSymbolFont{letters} {OML}{pplcm}{m}{it}
530\DeclareSymbolFont{bold} {OT1}{ppl}{bx}{n}
531\DeclareSymbolFont{italic} {OT1}{ppl}{m}{it}
532\DeclareSymbolFontAlphabet{\mathit}{italic}
533\fi
534% \end{macrocode}
535%
536% \paragraph{Times}
537% Also easy.
538% \begin{macrocode}
539\ifnum\mdwf@mathsfont=\mdwf@times
540\DeclareSymbolFont{operators} {OT1}{ptmcm}{m}{n}
541\DeclareSymbolFont{letters} {OML}{ptmcm}{m}{it}
542\DeclareSymbolFont{bold} {OT1}{ptm}{bx}{n}
543\DeclareSymbolFont{italic} {OT1}{ptm}{m}{it}
544\DeclareSymbolFontAlphabet{\mathit}{italic}
545\fi
546% \end{macrocode}
547%
548% \paragraph{Computer Modern}
549% Silliness required.
550% \begin{macrocode}
551\ifnum\mdwf@mathsfont=\mdwf@cmr
552\DeclareSymbolFont{operators} {OT1}{cmr}{m}{n}
553\DeclareSymbolFont{letters} {OML}{cmr}{m}{it}
554\DeclareSymbolFont{bold} {OT1}{cmr}{bx}{n}
555\DeclareSymbolFont{italic} {OT1}{cmr}{m}{it}
556\DeclareSymbolFontAlphabet{\mathit}{italic}
557\fi
558% \end{macrocode}
559%
560% \paragraph{General PostScript things}
561% Set up the symbols and large symbols fonts. This lot is all from
562% \package{mathptm}.
563% \begin{macrocode}
564\if1\ifnum\mdwf@mathsfont=\mdwf@times1\else
565 \ifnum\mdwf@mathsfont=\mdwf@palatino1\else0\fi\fi
566\DeclareSymbolFont{symbols} {OMS}{pzccm}{m}{n}
567\DeclareSymbolFont{largesymbols}{OMX}{psycm}{m}{n}
568% \end{macrocode}
569% Adjust the spacing around operators and things to fit PostScript fonts
570% better.
571% \begin{macrocode}
572\thinmuskip=2mu
573\medmuskip=2.5mu plus 1mu minus 1mu
574\thickmuskip=4mu plus 1.5mu minus 1mu
575% \end{macrocode}
576% There isn't a bold symbol font.
577% \begin{macrocode}
578\def\boldmath{%
579 \@warning{there is no bold Symbol font}%
580 \global\let\boldmath=\relax
581}
582% \end{macrocode}
583% Provide an |\omicron| character. No idea why\dots
584% \begin{macrocode}
585\DeclareMathSymbol{\omicron}{0}{operators}{`\o}
586% \end{macrocode}
587% Make scripts a bit bigger.
588% \begin{macrocode}
589\DeclareMathSizes{5}{5}{5}{5}
590\DeclareMathSizes{6}{6}{5}{5}
591\DeclareMathSizes{7}{7}{5}{5}
592\DeclareMathSizes{8}{8}{6}{5}
593\DeclareMathSizes{9}{9}{7}{5}
594\DeclareMathSizes{10}{10}{7.4}{6}
595\DeclareMathSizes{10.95}{10.95}{8}{6}
596\DeclareMathSizes{12}{12}{9}{7}
597\DeclareMathSizes{14.4}{14.4}{10.95}{8}
598\DeclareMathSizes{17.28}{17.28}{12}{10}
599\DeclareMathSizes{20.74}{20.74}{14.4}{12}
600\DeclareMathSizes{24.88}{24.88}{17.28}{14.4}
601% \end{macrocode}
602% Redefine the standard font for the symbols encoding.
603% \begin{macrocode}
604\DeclareFontSubstitution{OMS}{pzccm}{m}{n}
605\fi
606% \end{macrocode}
607%
608%
609% \subsection{Setting the font families}
610%
611% First, define the family names for everything.
612%
613% \begin{macrocode}
614\def\mdwf@cmr{cmr}
615\def\mdwf@cmss{cmss}
616\def\mdwf@cmtt{cmtt}
617\def\mdwf@times{ptm}
618\def\mdwf@palatino{ppl}
619\def\mdwf@helvetica{phv}
620\def\mdwf@courier{pcr}
621% \end{macrocode}
622%
623% Now assign families to the various variables.
624%
625% \begin{macrocode}
626\edef\rmdefault{\mdwf@bodyfont}
627\edef\sfdefault{\mdwf@sansfont}
628\edef\ttdefault{\mdwf@ttfont}
629\edef\headdefault{\mdwf@headfont}
630% \end{macrocode}
631%
632% Set various maths families.
633%
634% \begin{macrocode}
635\def\mdwf@mathsfam#1#2#3{%
636 \edef\@tempa{\noexpand\DeclareMathAlphabet{\noexpand#1}{#2}{#3}}%
637 \@tempa%
638}
639\DeclareSymbolFontAlphabet{\mathit}{italic}
640\DeclareSymbolFontAlphabet{\mathrm}{operators}
641\DeclareSymbolFontAlphabet{\mathbf}{bold}
642\mdwf@mathsfam{\mathsf}{OT1}{\sfdefault}{m}{n}
643\mdwf@mathsfam{\mathtt}{OT1}{\ttdefault}{m}{n}
644% \end{macrocode}
645%
646% Finally, set |\headfam| nicely.
647%
648% \begin{macrocode}
649\def\headfam{\fontfamily\headdefault\selectfont}
650% \end{macrocode}
651%
652% \subsection{Clobber standard packages}
653%
654% Now, if I recognise this document class, patch it until it accepts
655% |\headfam| correctly. This stuff isn't terribly pleasant, but I don't
656% care about that.
657%
658% First see if I'm in familiar territory.
659%
660% \begin{macrocode}
661\begingroup
662\catcode`\.11
663\if1\ifx\ver@article.cls\@@undefined
664 \ifx\ver@report.cls\@@undefined
665 \ifx\ver@book.cls\@@undefined
666 \ifx\ver@amsart.cls\@@undefined
667 \ifx\ver@amsproc.cls\@@undefined
668 \ifx\ver@amsbook.cls\@@undefined0%
669 \else1\fi
670 \else1\fi
671 \else1\fi
672 \else1\fi
673 \else1\fi
674 \else1\fi
675% \end{macrocode}
676%
677% Looks like it. Now to patch the |\@startsection|-based commands. I'll
678% redefine |\@startsection| to do the atching for me, and then just run
679% all the commands which want patching.
680%
681% \begin{macrocode}
682 \def\@startsection#1#2#3#4#5#6#7{%
683 \gdef#7{\@startsection{#1}{#2}{#3}{#4}{#5}{#6\headfam}}%
684 }
685 \section\section
686 \subsection\subsection
687 \subsubsection\subsubsection
688 \paragraph\paragraph
689 \subparagraph\subparagraph
690 \if1\ifx\ver@amsart.cls\@@undefined\ifx\ver@amsproc.cls\@@undefined0%
691 \else1\fi\else1\fi
692 \part\part
693 \fi
694% \end{macrocode}
695%
696% Now for the difficult bits. Firstly, deal with part headings for normal
697% \LaTeX\ classes.
698%
699% \begin{macrocode}
700 \long\def\mdwf@grab#1{\expandafter\mdwf@grab@i#1\@@delim}
701 \long\def\mdwf@grab@i#1\@@delim#2{#2{#1}}
702 \def\mdwf@patch@opt#1{\mdwf@grab{#1[##1]{##2}}\mdwf@patch@opt@i#1}
703 \long\def\mdwf@patch@opt@i#1#2{\gdef#2[##1]##2{%
704 \let\mdwf@@bfseries\bfseries\def\bfseries{\headfam\mdwf@@bfseries}%
705 #1%
706 \let\bfseries\mdwf@@bfseries%
707 }}%
708 \def\mdwf@patch#1{\mdwf@grab{#1{##1}}\mdwf@patch@i#1}
709 \long\def\mdwf@patch@i#1#2{\gdef#2##1{%
710 \let\mdwf@@bfseries\bfseries\def\bfseries{\headfam\mdwf@@bfseries}%
711 #1%
712 \let\bfseries\mdwf@@bfseries%
713 }}%
714 \if0\ifx\ver@amsart.cls\@@undefined\ifx\ver@amsproc.cls\@@undefined0%
715 \else1\fi\else1\fi
716 \mdwf@patch@opt\@part
717 \mdwf@patch\@spart
718 \fi
719 \ifx\@makechapterhead\@@undefined\else
720 \mdwf@patch\@makechapterhead
721 \mdwf@patch\@makeschapterhead
722 \fi
723\fi
724\endgroup
725% \end{macrocode}
726%
727% Wasn't that fun?
728%
729%
730% That's it for the package.
731%
732% \begin{macrocode}
733%</sty>
734% \end{macrocode}
735%
736%
737% \section{Font installation script}
738%
739% If you're lucky you'll never need to use this.
740%
741% \begin{macrocode}
742%<*fontinst>
743\input fontinst.sty
744% \end{macrocode}
745%
746% Firstly, some code for building squashed courier fonts.
747%
748% \begin{macrocode}
749\def\squashcourier#1{%
750 \transformfont{pcr#18rn}{%
751 \xscalefont{850}{%
752 \reencodefont{8r}{\fromafm{pcr#18a}}}}}
753\squashcourier{b}
754\squashcourier{bo}
755\squashcourier{r}
756\squashcourier{ro}
757% \end{macrocode}
758%
759% Now start installing fonts.
760%
761% \begin{macrocode}
762\installfonts
763% \end{macrocode}
764%
765% Start with the courier ones.
766%
767% \begin{macrocode}
768\installfont{pcrb7tn}{pcrb8rn,psyr,latin}{OT1tt}{OT1}{pcr}{b}{n}{}
769\installfont{pcrb8tn}{pcrb8rn,psyr,latin}{T1}{T1}{pcr}{b}{n}{}
770\installfont{pcrbc7tn}{pcrb8rn,psyr,latin}{OT1ctt}{OT1}{pcr}{b}{sc}{}
771\installfont{pcrbc8tn}{pcrb8rn,psyr,latin}{T1c}{T1}{pcr}{b}{sc}{}
772\installfont{pcrbo7tn}{pcrbo8rn,psyr,latin}{OT1tt}{OT1}{pcr}{b}{sl}{}
773\installfont{pcrbo8tn}{pcrbo8rn,psyr,latin}{T1}{T1}{pcr}{b}{sl}{}
774\installfont{pcrr7tn}{pcrr8rn,psyr,latin}{OT1tt}{OT1}{pcr}{m}{n}{}
775\installfont{pcrr8tn}{pcrr8rn,psyr,latin}{T1}{T1}{pcr}{m}{n}{}
776\installfont{pcrrc7tn}{pcrr8rn,psyr,latin}{OT1ctt}{OT1}{pcr}{m}{sc}{}
777\installfont{pcrrc8tn}{pcrr8rn,psyr,latin}{T1c}{T1}{pcr}{m}{sc}{}
778\installfont{pcrro7tn}{pcrro8rn,psyr,latin}{OT1tt}{OT1}{pcr}{m}{sl}{}
779\installfont{pcrro8tn}{pcrro8rn,psyr,latin}{T1}{T1}{pcr}{m}{sl}{}
780% \end{macrocode}
781%
782% Now build palatino-based maths fonts. This lot seems to work. It's based
783% on \package{mathptm}, and hacked a bit.
784%
785% \begin{macrocode}
786\installfamily{OT1}{pplcm}{}
787\installfamily{OML}{pplcm}{\skewchar\font=127}
788\transformfont{pplr8r}{\reencodefont{8r}{\fromafm{pplr8a}}}
789\transformfont{pplri8r}{\reencodefont{8r}{\fromafm{pplri8a}}}
790\transformfont{pzcmi8r}{\reencodefont{8r}{\fromafm{pzcmi8a}}}
791\installfont{zpplcmr}
792 {pplr8r,psyr,latin,zrhax,kernoff,cmr10}
793 {OT1}{OT1}{pplcm}{m}{n}{}
794\installfont{zpplcmrm}
795 {kernoff,cmmi10,kernon,unsetalf,unsetnum,pplri8r,psyr,mathit,zrmhax,kernoff,cmmi10}
796 {OML}{OML}{pplcm}{m}{it}{}
797% \end{macrocode}
798%
799% Done.
800%
801% \begin{macrocode}
802\endinstallfonts
803\end
804%</fontinst>
805% \end{macrocode}
806%
807% But it's not over yet. For some reason, I don't have `|ot1tt.etx|' in my
808% distribution. Here's one which ought to do.
809%
810% \begin{macrocode}
811%<*ttetx>
812\relax
813% OT1tt.etx -- install an OT1-encoded typewriter font
814\encoding
815\def\tty{y}
816\inputetx{OT1}
817\endencoding
818%</ttetx>
819% \end{macrocode}
820%
821% And again, for `|ot1ctt.etx|'.
822%
823% \begin{macrocode}
824%<*cttetx>
825\relax
826% OT1tt.etx -- install an OT1-encoded typewriter font
827\encoding
828\def\tty{y}
829\inputetx{OT1c}
830\endencoding
831%</cttetx>
832% \end{macrocode}
833%
834% Before I leave this section, I'll just write out the appropriate magical
835% definitions for the DVIPS |psfonts.map| file.
836%
837% \begin{macrocode}
838%<*fontmap>
839pcrb8rn Courier-Bold ".85 ExtendFont TeXBase1Encoding ReEncodeFont" <8r.enc
840pcrbo8rn Courier-BoldOblique ".85 ExtendFont TeXBase1Encoding ReEncodeFont" <8r.enc
841pcrr8rn Courier ".85 ExtendFont TeXBase1Encoding ReEncodeFont" <8r.enc
842pcrro8rn Courier-Oblique ".85 ExtendFont TeXBase1Encoding ReEncodeFont" <8r.enc
843%</fontmap>
844% \end{macrocode}
845%
846%
847% \section{Description file for courier}
848%
849% Here's a short |.fd| file for the squashed courier font which makes it
850% work in my `|mTT|' encoding.
851%
852% \begin{macrocode}
853%<*mttpcr>
854\DeclareFontFamily{mTT}{pcr}{\hyphenchar\font=-1}
855\DeclareFontShape{mTT}{pcr}{b}{n}{<-> pcrb7tn}{}
856\DeclareFontShape{mTT}{pcr}{b}{sc}{<-> pcrbc7tn}{}
857\DeclareFontShape{mTT}{pcr}{b}{sl}{<-> pcrbo7tn}{}
858\DeclareFontShape{mTT}{pcr}{m}{n}{<-> pcrr7tn}{}
859\DeclareFontShape{mTT}{pcr}{m}{sc}{<-> pcrrc7tn}{}
860\DeclareFontShape{mTT}{pcr}{m}{sl}{<-> pcrro7tn}{}
861\DeclareFontShape{mTT}{pcr}{bx}{n}{<->ssub * pcr/b/n}{}%
862\DeclareFontShape{mTT}{pcr}{bx}{sc}{<->ssub * pcr/b/sc}{}%
863\DeclareFontShape{mTT}{pcr}{bx}{sl}{<->ssub * pcr/b/sl}{}%
864\DeclareFontShape{mTT}{pcr}{b}{it}{<->ssub * pcr/b/sl}{}%
865\DeclareFontShape{mTT}{pcr}{bx}{it}{<->ssub * pcr/b/it}{}%
866\DeclareFontShape{mTT}{pcr}{m}{it}{<->ssub * pcr/m/sl}{}%
867%</mttpcr>
868% \end{macrocode}
869%
870%
871% Done.
872%
873% \hfill Mark Wooding, \today
874%
875% \Finale
876%
877\endinput