summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/pdcmac/pdcmisc.dtx
blob: ad7cad7262adb820789fcb0eecc9514c6a30ecd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
% pdcmisc.dtx -- documentation and source code for misc macro files -*-tex-*-

%%%@TeX-document-file {
%%% title 	= "Miscellanous macro files",
%%% filename 	= "$texmf/doc/plain/pdcmac/pdcmisc.dtx",
%%% version 	= "$Revision: 1.4 $",
%%% package 	= "pdcmac 1.0",
%%% date 	= "$Date: 1995/03/30 16:13:08 $",
%%% author	= "P. Damian Cugley",
%%% email	= "damian.cugley@comlab.ox.ac.uk",
%%% address	= "Oxford University Computing Laboratory,"
%%%                Parks Road, Oxford  OX1 3QD, UK",
%%% abstract	= "This document describes and is the source code for 
%%%                the TeX definitions files pdcmigr.tex, pdcimth.tex,
%%%                pdchyex.tex, pdcmasyb.tex.
%%%                Running plain TeX on this file produces both the
%%%                definitions files and the printed documentation.",
%%% copyright	= "Copyright (c) 1991-1995 P. Damian Cugley",
%%% copying	= "This program is free software; you can redistribute
%%%		   it and/or modify it under the terms of the GNU
%%%		   General Public License as published by the Free
%%%		   Software Foundation; either version 2 of the License,
%%%		   or (at your option) any later version.",
%%% notice	= "This program is distributed in the hope that it will
%%%		   be useful, but WITHOUT ANY WARRANTY; without even the
%%%		   implied warranty of MERCHANTABILITY or FITNESS FOR A
%%%		   PARTICULAR PURPOSE.  See the GNU General Public
%%%		   License for more details.",
%%% notice	= "You should have received a copy of the GNU General
%%%		   Public License along with this program; if not, write
%%%		   to the Free Software Foundation, Inc., 675 Mass Ave,
%%%		   Cambridge, MA 02139, USA.",
%%% codetable	= "USASCII",
%%% dependencies = "pdccode.tex"
%%%}
	
%{{{ pdcmisc.dtx
%{{{  preamble

\relax
\input pdccode

\document
\rcs$Id: pdcmisc.dtx,v 1.4 1995/03/30 16:13:08 pdc Exp $\endrcs

\def\newfile{\lineno=0 }
%}}}  preamble
%{{{  intro
\author{P. Damian Cugley}
\title{Miscellaneous macro files}

%}}}  intro
%{{{  pdcmigr
	
\newfile
\section{PDCMIGR: Use math italic Greek capitals}

	Knuth notes that it is conventional to use unslanted Greek
	capitals in maths, even though other letters are slanted
	(I~personally think that it looks nicer to use slanted Greek
	caps).  Thus \TeX\ takes the Greek capitals from fam~0 by
	default.

	If you are using a body text font that does not have the Greek
	capitals---for example, almost any PostScript or Cork-style
	font---then this no longer works.  Better then to switch to
	using the Greek capitals from the math italic font (fam~1).
	That's what the file |pdcmigr.tex| does.  The characters are
	still in maths class~7, meaning that they will respect changes
	to |\fam| made by font-switching commands.
	
\codefile{pdcmigr.tex}

\code
	\|\% pdcmigr.tex \fileversion~\filedate -- see end of file %
		for more info
	\|\\message\{\fileversion~<\fileauthor~\filedate>\}
\smallbreak
	|\mathchardef\Gamma   = "7100
	|\mathchardef\Delta   = "7101
	|\mathchardef\Theta   = "7102
	|\mathchardef\Lambda  = "7103
	|\mathchardef\Xi      = "7104
	|\mathchardef\Pi      = "7105
	|\mathchardef\Sigma   = "7106
	|\mathchardef\Upsilon = "7107
	|\mathchardef\Phi     = "7108
	|\mathchardef\Psi     = "7109
	|\mathchardef\Omega   = "710A
\endcode

	This file has more comments than code.  Since the code is so
	short I think I'll get away with putting the comments after an
	|\endinput|.
\code
	|\endinput
\smallskip
	|%%%@TeX-definition-file {
	|%%% filename       = "$texmf/tex/plain/pdcmac/pdcmigr.tex",
	\|\%\%\% version~~~~~~~~= "\fileversion",
	\|\%\%\% date~~~~~~~~~~~= "\filedate",
	|%%% package        = "pdcmac 1.0",
	|%%% author         = "P. Damian Cugley",
	|%%% email          = "damian.cugley@comlab.ox.ac.uk",
	|%%% address        = "Oxford University Computing Laboratory,
	|%%%                   Parks Road, Oxford  OX1 3QD, UK",
	|%%% codetable      = "USASCII",
	|%%% keywords       = "TeX, plain TeX, macros",
	|%%% supported      = "Maybe",
	|%%% abstract       = "A definition file for TeX, which redefines
	|%%%                   \Gamma, ..., \Omega to use letters from the
	|%%%                   maths italic font instead of the roman font.
	|%%%                   This file was generated by running
	|%%%                   plain TeX on pdcmisc.dtx",
	|%%% copyright      = "Copyright (c) 1991, 1995 P. Damian Cugley",
	|%%% copying        = "DO NOT DISTRIBUTE THIS FILE.
	|%%%                   Distribute pdcmisc.dtx only as part of the
	|%%%                   package it came in.",
	|%%% dependencies   = "",
	|%%% }
\endcode

\endcodefile
%}}}  pdcmigr
%{{{  pdcimth

\newfile
\section{PDCIMTH: use text italic letters in maths mode}

	Very few existing font families have a separate math-italic font.  When
	using these fonts as body fonts, with the Computer Modern fonts as
	maths fonts, it looks wrong to have the maths letters in a completely
	different style form the text italic.  Therefore it makes sense to
	redefine maths mode so that the letters come from the text italic font.

	This is also useful when multiple-letter identifiers are used in maths
	mode.  We c an say |$difference:=height+depth$| and get `$\it
	difference:=height+depth$' instead of `$difference:=height+depth$'.

	In the following, the counters |\count0| to |\count4| are used as
	follows:
$$\centerline{\vbox{\halign{\tt\cs{#}\hfil&&\quad#\hfil\cr
	count0&mathcode for current upper case char\cr
	count1&mathcode for current lower case char\cr
	count2&ASCII code of current upper case char\cr
	count3&ASCII code of current lower case char\cr
	count4&number of characters left to redefine\cr
}}}$$
 	The grouping prevents this temporary use conflicting with \TeX's
	use of these counters.
	
\codefile{pdcimth.tex}
\code
	\|\% pdcimth.tex \fileversion~\filedate~- maths letters in text italic
	\|\\message\{\fileversion~\filedate\}
	|
	|\begingroup
\smallbreak
	|    \count0="7400 \count1=\count0
	|    \advance\count0 by`A \advance\count1 by`a
	|    \count2=`A \count3=`a \count4=26
\smallbreak
	|    \loop\ifnum\count4>0
	|        \advance\count4 by-1
	|        \global\mathcode\count2=\count0 
	|        \global\mathcode\count3=\count1
	|        \advance\count0 by1 \advance\count1 by1
	|        \advance\count2 by1 \advance\count3 by1
	|    \repeat
\smallbreak
	|\endgroup
\endcode
\noindent
	The value $\hbox{\H{}\tt 7400} + c$ used above means mathcode~7,
	fam~4 (|\itfam|), character~$c$.

	Once again, the code is short enough that I think I can get away
	with putting the comments at the end:
\code
	|\endinput
\smallskip
	|%%%@TeX-definition-file {
	|%%% filename       = "$texmf/tex/plain/pdcmac/pdcimth.tex",
	\|\%\%\% version~~~~~~~~= "\fileversion",
	\|\%\%\% date~~~~~~~~~~~= "\filedate",
	|%%% package        = "pdcmac 1.0",
	|%%% author         = "P. Damian Cugley",
	|%%% email          = "damian.cugley@comlab.ox.ac.uk",
	|%%% address        = "Oxford University Computing Laboratory,
	|%%%                   Parks Road, Oxford  OX1 3QD, UK",
	|%%% codetable      = "USASCII",
	|%%% keywords       = "TeX, plain TeX, macros",
	|%%% supported      = "Maybe",
	|%%% abstract       = "A definition file for TeX, which redefines
	|%%%                   mathcodes to use letters from the
	|%%%                   text italic font instead of math italic.
	|%%%                   This file was generated by running
	|%%%                   plain TeX on pdcmisc.dtx",
	|%%% copyright      = "Copyright (c) 1991, 1995 P. Damian Cugley",
	|%%% copying        = "DO NOT DISTRIBUTE THIS FILE.
	|%%%                   Distribute pdcmisc.dtx only as part of the
	|%%%                   package it came in.",
	|%%% dependencies   = "",
	|%%% }
\endcode
\endcodefile
%}}}  pdcimth
%{{{  pdchyex

\newfile
\section{PDCHYEX: Hyphenation exceptions}

	These hyphenation exceptions are ones I~use for must documents.

\notepar
	Of all the macro files in this package, this is the one you
	should be most chary of using.  These are written for a \TeX\
	system which uses American English hyphenation patterns, but are
	intended to help it produce hyphenations suitable for British
	English, and this peverse approach will probably lead to all
	sorts of anomalies. Ideally separate hyphenation patterns will
	be used for British English documents.
\endnotepar

\codefile{pdchyex.tex}

\subsec{File identification}

	The list of exceptions is expected to grow, so it seems best to
	have the identification at the top of the file.

\code
	\|\% pdchyex.tex \fileversion~\filedate~-- some British hyphenations
\smallskip
	|%%%@TeX-definition-file {
	|%%% filename       = "$texmf/tex/plain/pdcmac/pdchyex.tex",
	\|\%\%\% version~~~~~~~~= "\fileversion",
	\|\%\%\% date~~~~~~~~~~~= "\filedate",
	|%%% package        = "pdcmac 1.0",
	|%%% author         = "P. Damian Cugley",
	|%%% email          = "damian.cugley@comlab.ox.ac.uk",
	|%%% address        = "Oxford University Computing Laboratory,
	|%%%                   Parks Road, Oxford  OX1 3QD, UK",
	|%%% codetable      = "USASCII",
	|%%% keywords       = "TeX, plain TeX, macros",
	|%%% supported      = "Maybe",
	|%%% abstract       = "A non-exhaustive set of hyphenation exceptions
	|%%%                   designed to make TeX with American hyphenation
	|%%%                   tables produce some British hyphenations.
	|%%%                   This file was generated by running
	|%%%                   plain TeX on pdcmisc.dtx",
	|%%% copyright      = "Copyright (c) 1991, 1995 P. Damian Cugley",
	|%%% copying        = "DO NOT DISTRIBUTE THIS FILE.
	|%%%                   Distribute pdcmisc.dtx only as part of the
	|%%%                   package it came in.",
	|%%% dependencies   = "",
	|%%%}
	|
	\|\\message\{\fileversion~<\fileauthor~\filedate>\}
	|
\endcode

\subsec{Setting parameters}

	These settings are from {\it Hart's Rules} p.\thinspace141.
\code
	|\lefthyphenmin=2 \righthyphenmin=3 \uchyph=0
\endcode

\subsec{And finally, the hyphenation exceptions}

\code
	|\hyphenation{
\endcode
	First, some words from {\it Hart's Rules}\/ pp.\thinspace14--15.
	I've taken the list on p.\thinspace14 and included here those
	which were given wrong hyphenation by \TeX's default tables.
\code
	|    le-gend le-gends re-adjust re-appear exact-ing
\smallbreak

	|    abs-cess abs-cess-es abs-cessed ana-lyse ana-lyses
	|    ana-lysis ana-lyses appear-ance appear-ances bio-graphy
	|    celeb-rate celeb-rates celeb-rations cor-respond-ence
	|    depend-ent des-pise des-pises dis-pised dimin-ish
	|    dimin-ish-es dimin-ish-ed dis-connect dis-connect-ed
	|    dis-connects forget-ting gener-ally haemor-rhage
	|    illus-trate immedi-ate immedi-ately immport-ance
	|    inexplic-able inter-pret inter-est inter-ested
	|    inter-est-ing minis-ter origin-ally philo-sophy
	|    philo-sophic philo-sophic-ally prim-ary prob-ably
	|    semb-lance
\smallbreak
	|    calm-est debt-ors fea-ther fea-thers post-humous lamb-like
	|    poingn-ant tough-ish ach-ing archaeo-logy etymo-logy
	|    philo-logist psycho-logist tauto-logy zoolo-gist
\endcode
	Now some random hyphenations I~encountered in my own documents
	at some point.  I~haven't checked these in a spelling
	dictionary, so don't use them in documents where your life
	depends on correct hyphenation.
\code	

	|    art-iest cig-ar-ette bio-logy bio-chem-is-try boy-friend
	|    brit-ain brit-ish com-ic com-ics cug-ley dogs-body
	|    dor-mouse gai-man graph-ic immedie-ate immedi-ate
	|    immedi-ately issue mckean mis-hap mis-haps news-letter
	|    news-paper night-crawler origin-ally origin-ator phys-ique
	|    phys-iques porn-o-graphy porn-o-graphic rec-om-mend-ation
	|    Ser-geant ser-geant Sien-kie-wicz spon-tan-e-ous
	|    spon-tan-e-ously stop-ped strip-ped teen-ager teen-agers
	|    tem-per-men-tal Thatch-er-ism Thatch-er-ite under-ground
	|    under-grounds var-i-able venge-ance warp-smith warp-smiths
	|    whirl-pool

	|}
\endcode
\endcodefile
	
%}}}  pdchyex
%{{{  pdccmsub

\newfile
\codefile{pdccmsub.tex}
\section{PDCCNSUB: Substitutions using Computer Modern glyphs}

	The Malvern and PostScript repertoire includes some characters
	not included in the \TeX\ Text fonts used by plain \TeX.  I~have
	made macros for some of these that assemble symbols from
	existing characters.  This way documents can be switched between
	the different font encoding schemes mroe easily.  They won't
	look very pretty though.

\notepar
	These work acceptably with ten-point Computer Modern but might
	need adjustment with other fonts.
\endnotepar
	
%{{{   indentification
\subsec{File dientification}

\code
	\|\% \filename~\fileversion~\filedate~-- CM subs for PS glyphs
\smallskip
	|%%%@TeX-definition-file {
	|%%% filename       = "$texmf/tex/plain/pdcmac/pdcmigr.tex",
	\|\%\%\% version~~~~~~~~= "\fileversion",
	\|\%\%\% date~~~~~~~~~~~= "\filedate",
	|%%% package        = "pdcmac 1.0",
	|%%% author         = "P. Damian Cugley",
	|%%% email          = "damian.cugley@comlab.ox.ac.uk",
	|%%% address        = "Oxford University Computing Laboratory,
	|%%%                   Parks Road, Oxford  OX1 3QD, UK",
	|%%% codetable      = "USASCII",
	|%%% keywords       = "TeX, plain TeX, macros",
	|%%% supported      = "Maybe",
	|%%% abstract       = "Macros for simulating some PostScript characters
	|%%%                   using glyphs form the Computer Modern family.
	|%%%                   This file was generated by running
	|%%%                   plain TeX on pdcmisc.dtx",
	|%%% copyright      = "Copyright (c) 1991-1995 P. Damian Cugley",
	|%%% copying        = "DO NOT DISTRIBUTE THIS FILE.
	|%%%                   Distribute pdcmisc.dtx only as part of the
	|%%%                   package it came in.",
	|%%% dependencies   = "",
	|%%% }
	|
	\|\\message\{\fileversion~\filedate\}
	|
\endcode

%}}}   indentification


\code
	|\dimendef\dimena=0
\endcode
\dimendef\dimena=0

%{{{   currency

\subsec{Currency signs}

\def\yen{{%
    \ooalign{%
        \hfil\raise0.25ex\hbox{$\scriptscriptstyle=$}\hfil\crcr
        \hfil Y\hfil
    }%
}} 
\def\currency{{%
    \ooalign{%
	\dimena-0.10em
	\hskip\dimena \raise0.2ex \hbox{\mathhexbox202}\hskip\dimena\crcr
	\hfil \raise0.2ex \hbox{\mathhexbox20E}\hfil
    }%
}} 
	
 	The Yen sign looks like `50\thinspace000\yen', the cents sign
	like `37\rlap/c'.  The pounds-sterling sign is always italic.
\code
	|\def\pounds{{\it\char36 }}
\smallbreak
	|\def\yen{{%
	|    \ooalign{%
	|        \hfil\raise0.25ex\hbox{$\scriptscriptstyle=$}\hfil\crcr
	|        \hfil Y\hfil
	|    }%
	|}}
\smallbreak
	|\def\cents{\leavevmode\hbox{\rm\rlap/c}}
\endcode

	The ISO~646 currency sign---originally created to replace the
	dollar sign in the international reference version character
	set---is supposed to be drawn as a circle with four `ears';
	we'll have to fake it rather crudely: `\currency', as in
	`\currency100' or possibly `100\currency'.
\code
	|\def\currency{{%
	|    \ooalign{%
	|        \hskip-0.1em
	|            \raise0.2ex \hbox{\mathhexbox202}\hskip-0.1em\crcr
	|        \hfil \raise0.2ex \hbox{\mathhexbox20E}\hfil
	|    }%
	|}} 
\endcode	

	The florin sign `{\it f}' seems to have started life as a way of
	getting an italic {\it f} on dot-matrix printers.  In an italic
	context it still has to be in itaics---switching to a roman
	letter does not seem appropriate.
\code
	|\def\florin{{\it f\/}}
\endcode

%}}}   currency
%{{{   circled letters
	

\subsec{Things in circles}

\def\circledletter#1#2{{%
    \ooalign{%
	\hfil\kern#1\hbox{$\scriptstyle\rm #2$}\hfil\crcr
        \mathhexbox20D%
    }%
}}
\def\registered{\circledletter{0.02em}R}
\def\copyright{\circledletter{-0.045em}C}
	Here's a general macro for making letters in circles---like
	the registered trade mark sign `\registered', or the signs
	`\circledletter{0.04em}P' and `\circledletter{0.02em}S'
	(I~don't use them so I~haven't given them names) or even `\circledletter{0.05em}1'.  A matching
	copyright sing (using a small capital {\it c} instead of a
	lower case {\it c}) looks like `\copyright'.  Parameter |#1|
	to the macro is the amount to shift the small letter relative
	to the circle to get it optically centred.
\code
	|\def\circledletter#1#2{{%
	|    \ooalign{%
	|        \hfil\kern#1\raise0.00ex \hbox{$\scriptstyle\rm #2$}\hfil\crcr
	|        \mathhexbox20D%
	|    }%
	|}}
\smallbreak
	|\def\registered{\circledletter{0.02em}R}
	|\def\copyright{\circledletter{-0.045em}C}
\endcode
%}}}   circled letters
%{{{   guillemets
	
\subsec{Guillemets}

\def\lguillemet{\leavevmode \raise0.5ex \hbox{$\scriptscriptstyle\langle\!\langle$}}
\def\rguillemet{\leavevmode \raise0.5ex \hbox{$\scriptscriptstyle\rangle\!\rangle$}}

	Ersatz guillemets look like \lguillemet this\rguillemet.
\code
	|\def\lguillemet{%
	|    \leavevmode 
	|    \raise0.5ex \hbox{$\scriptscriptstyle\langle\!\langle$}%
	|}
\smallbreak
	|\def\rguillemet{%
	|    \leavevmode 
	|    \raise0.5ex \hbox{$\scriptscriptstyle\rangle\!\rangle$}%
	|}
\endcode
%}}}   guillemets
%{{{   misc
\subsec{Miscellaneous}

\def\permille{{%
    \setbox0 \hbox{/}%
    \flushtop{$\scriptstyle0\!$}/%
    \lower\dp0 \hbox{$\!\scriptstyle00$}%
}}
\def\orda{\flushtop{\the\scriptfont\ifnum\fam>0 \fam\else 0\fi \b a}}
\def\ordo{\flushtop{\the\scriptfont\ifnum\fam>0 \fam\else 0\fi \b o}}

	The per-mille sign `\permille' can't be made from `\%' sign because
	matching the rings is impossible, so we use `0/00':
\code
	|\def\permille{{%
	|    \setbox0 \hbox{/}%
	|    \flushtop{$\scriptstyle0\!$}/%
	|    \lower\dp0 \hbox{$\!\scriptstyle00$}%
	|}}
\endcode

	The British decimal point is a raised dot: `3\mathhexbox201141'
	instead of `3.141'.
\code
	|\def\gbdecimal{\mathhexbox201}
\endcode
	Unfortunately, this symbol has become a casualty of the `DTP
	revolution', and the American use of a full stop as a decimal
	point has become common.

	The glyphs `\orda' and `\ordo' are used in to abbreviate Spanish
	ordinal numbers: the feminine {\it primera} becomes 1\orda, and
	the masculine {\it primero} 1\ordo.
\code
	|\def\orda{\flushtop{\the\scriptfont\ifnum\fam>0 \fam\else 0\fi \b a}}
	|\def\ordo{\flushtop{\the\scriptfont\ifnum\fam>0 \fam\else 0\fi \b o}}
\endcode

	
%}}}   misc
%{{{   sc and csc
	
\subsec{Substitutions for Malvern's alphabet-switching commands}
	
	The macros used to select small capitals etc.\ in Malvern fonts
	cannot work with Computer Modern, but might appear in documents
	anyway.  Instead they are all made equivalent to |\relax|.  

\code
	|\let\sc=\relax
	|\let\csc=\relax
	|\let\mc=\relax
\endcode

%}}}   sc and csc

\endcodefile
	
%}}}  pdcmasub
\enddocument	
\bye
%}}} pdcmisc.dtx
%Local Variables:
%fill-prefix: "	"
%fold-folded-p: t
%End: