% 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: