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