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